Cui Zhi Feng
2024-08-30 852ec1d729b61077d8131591a5349c7e4a1bed79
src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml
@@ -37,21 +37,21 @@
    </resultMap>
    <update id="activeBatchCouponTemplate">
        update t_coupon_template set status='active',update_by=#{dto.updateBy},update_time=now() where id in
        <foreach collection="dto.idList" item="item" open="(" separator="," close=")">
        update t_coupon_template set status='active',update_by=#{param.updateBy},update_time=now() where id in
        <foreach collection="param.idList" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
    <update id="expireBatchCouponTemplate">
        update t_coupon_template set status='expired',update_by=#{dto.updateBy},update_time=now() where id in
        <foreach collection="dto.idList" item="item" open="(" separator="," close=")">
        update t_coupon_template set status='expired',update_by=#{param.updateBy},update_time=now() where id in
        <foreach collection="param.idList" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
    <update id="deleteBatchCouponTemplate">
        update t_coupon_template set deleted=true ,update_by=#{dto.updateBy},update_time=now() where id in
        <foreach collection="dto.idList" item="item" open="(" separator="," close=")">
        update t_coupon_template set deleted=true ,update_by=#{param.updateBy},update_time=now() where id in
        <foreach collection="param.idList" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </update>
@@ -69,6 +69,41 @@
        <include refid="QueryPointSql" />
    </select>
<!--    app活动优惠券-->
    <select id="getActivityEffectList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO">
        SELECT *
        FROM t_coupon_template t
        WHERE t.deleted = FALSE
        AND t.get_start_date &lt;= NOW()
        AND NOW() &lt;= t.get_end_date
        <if test="param.category != null and param.category != ''">
            AND category =  #{param.category}
        </if>
        <if test="param.status != null and param.status != ''">
            AND status =  #{param.status}
        </if>
        <if test="param.getType != null and param.getType != ''">
            AND t.get_type =  #{param.getType}
        </if>
        ORDER BY t.create_time DESC
    </select>
    <select id="getCouponCustomerList"
            resultType="com.mzl.flower.dto.response.coupon.CouponTemplateCustomerVO">
        select ci.id,ci.name,u.tel
        from t_coupon_template c
        left JOIN t_coupon_template_customer cc
        on c.id=cc.coupon_id
        left join t_customer_info ci
        on cc.custom_id=ci.id
        left join t_user u
        on ci.user_id=u.id
        where c.deleted= false
        and c.id=#{id}
    </select>
    <sql id="QueryPointSql">
        select *
        from t_coupon_template