<?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.SeckillSkuNoticeMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.mall.coupon.domain.entity.SeckillSkuNotice">
            <id column="id" property="id"/>
            <id column="member_id" property="memberId"/>
            <id column="sku_id" property="skuId"/>
            <id column="session_id" property="sessionId"/>
            <id column="subcribe_time" property="subcribeTime"/>
            <id column="send_time" property="sendTime"/>
            <id column="notice_type" property="noticeType"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id,member_id,sku_id,session_id,subcribe_time,send_time,notice_type
    </sql>

    <!-- 分页查询秒杀商品通知订阅内容 -->
    <select id="selectListByPage" resultType="com.mall.coupon.domain.vo.SeckillSkuNoticeVo">
        select
        <include refid="Base_Column_List"/>
        from sms_seckill_sku_notice
        <where>
                <if test="dto.id != null and dto.id != ''">
                    and id like CONCAT('%',#{dto.id},'%')
                </if>
                <if test="dto.memberId != null and dto.memberId != ''">
                    and member_id like CONCAT('%',#{dto.memberId},'%')
                </if>
                <if test="dto.skuId != null and dto.skuId != ''">
                    and sku_id like CONCAT('%',#{dto.skuId},'%')
                </if>
                <if test="dto.sessionId != null and dto.sessionId != ''">
                    and session_id like CONCAT('%',#{dto.sessionId},'%')
                </if>
                <if test="dto.subcribeTime != null and dto.subcribeTime != ''">
                    and subcribe_time like CONCAT('%',#{dto.subcribeTime},'%')
                </if>
                <if test="dto.sendTime != null and dto.sendTime != ''">
                    and send_time like CONCAT('%',#{dto.sendTime},'%')
                </if>
                <if test="dto.noticeType != null and dto.noticeType != ''">
                    and notice_type like CONCAT('%',#{dto.noticeType},'%')
                </if>
        </where>
    </select>

</mapper>
