<?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.zsElectric.boot.business.mapper.PromotionCouponTemplateMapper">

    <!-- 获取优惠劵模板分页列表 -->
    <select id="getPromotionCouponTemplatePage" resultType="com.zsElectric.boot.business.model.vo.PromotionCouponTemplateVO">
        SELECT
        id,
        name,
        description,
        status,
        total_count,
        take_limit_count,
        failure_time,
        use_price,
        discount_price,
        valid_time_weeks,
        valid_time_hour,
        create_time,
        create_by,
        update_time,
        update_by
        FROM
        c_promotion_coupon_template
        <where>
            is_deleted = 0
            <if test="queryParams.name != null and queryParams.name != ''">
                AND name LIKE CONCAT('%', #{queryParams.name}, '%')
            </if>
            <if test="queryParams.status != null">
                AND status = #{queryParams.status}
            </if>
            <if test="queryParams.startTime != null">
                AND create_time <![CDATA[  >=  ]]> #{queryParams.startTime,jdbcType=DATE}
            </if>
            <if test="queryParams.endTime != null">
                AND create_time <![CDATA[  <=  ]]> #{queryParams.endTime,jdbcType=DATE}
            </if>
        </where>
    </select>

</mapper>
