<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.mall.coupon.mapper.SeckillPromotionMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.coupon.domain.entity.SeckillPromotion">
            <id column="id" property="id"/>
            <id column="title" property="title"/>
            <id column="start_time" property="startTime"/>
            <id column="end_time" property="endTime"/>
            <id column="status" property="status"/>
            <id column="create_time" property="createTime"/>
            <id column="user_id" property="userId"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,title,start_time,end_time,status,create_time,user_id
    </sql>

    <!-- 分页查询秒杀活动内容 -->
    <select id="selectListByPage" resultType="com.mall.coupon.domain.vo.SeckillPromotionVo">
        select
        <include refid="Base_Column_List"/>
        from sms_seckill_promotion
        <where>
                <if test="dto.id != null and dto.id != ''">
                    and id like CONCAT('%',#{dto.id},'%')
                </if>
                <if test="dto.title != null and dto.title != ''">
                    and title like CONCAT('%',#{dto.title},'%')
                </if>
                <if test="dto.startTime != null and dto.startTime != ''">
                    and start_time like CONCAT('%',#{dto.startTime},'%')
                </if>
                <if test="dto.endTime != null and dto.endTime != ''">
                    and end_time like CONCAT('%',#{dto.endTime},'%')
                </if>
                <if test="dto.status != null and dto.status != ''">
                    and status like CONCAT('%',#{dto.status},'%')
                </if>
                <if test="dto.createTime != null and dto.createTime != ''">
                    and create_time like CONCAT('%',#{dto.createTime},'%')
                </if>
                <if test="dto.userId != null and dto.userId != ''">
                    and user_id like CONCAT('%',#{dto.userId},'%')
                </if>
        </where>
    </select>

</mapper>
