From 4d5f9b2c6177b5018e2c34ade73e53410345d1b5 Mon Sep 17 00:00:00 2001
From: gongzuming <gongzuming>
Date: 星期一, 02 九月 2024 09:22:44 +0800
Subject: [PATCH] 积分过期优化
---
src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml | 92 +++++++++++++++++++++++++++++++++++++++------
1 files changed, 79 insertions(+), 13 deletions(-)
diff --git a/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml b/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml
index 62f1f26..33fe113 100644
--- a/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml
+++ b/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml
@@ -37,31 +37,94 @@
</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>
<select id="getCouponTemplatePage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO">
- <include refid="QuerySql2"></include>
+ <include refid="QuerySql2"/>
</select>
<select id="getList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO">
- <include refid="QuerySql2"></include>
+ <include refid="QuerySql2"/>
</select>
+ <select id="getCouponPointList" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO">
+ <include refid="QueryPointSql" />
+ </select>
+ <select id="getPointPage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO">
+ <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 <= NOW()
+ AND NOW() <= 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
+ where deleted=0
+ <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.minPoint != null ">
+ AND point >= #{param.minPoint}
+ </if>
+ <if test="param.maxPoint != null ">
+ AND point <= #{param.maxPoint}
+ </if>
+ <if test="param.orderStr != null and param.orderStr != '' ">
+ order by ${param.orderStr}
+ </if>
+
+ </sql>
<sql id="QuerySql2">
select *
@@ -70,11 +133,11 @@
create_by_user.nick_name as createByName,
IFNULL(get_num.cnt, 0) as getNum,
IFNULL(t.coupon_amount, 0) - IFNULL(get_num.cnt, 0) as unGetNum
- from t_coupon_template t
- left join t_user create_by_user
- on t.create_by =create_by_user.id
- left join (select coupon_template_id,count(1) as cnt from t_coupon_usage where deleted=0 group by coupon_template_id) get_num
- on t.id=get_num.coupon_template_id
+ from t_coupon_template t
+ left join t_user create_by_user
+ on t.create_by =create_by_user.id
+ left join (select coupon_id,count(1) as cnt from t_coupon_record where deleted=0 group by coupon_id) get_num
+ on t.id=get_num.coupon_id
) t
where t.deleted=0
<if test="param.name != null and param.name != ''">
@@ -95,6 +158,9 @@
<if test="param.category != null and param.category != ''">
AND t.category = #{param.category}
</if>
+ <if test="param.status != null and param.status != ''">
+ AND t.status = #{param.status}
+ </if>
order by t.create_time desc
</sql>
--
Gitblit v1.9.3