From d2e9373d08edad3ebccbcf1831c2e809a693ae6a Mon Sep 17 00:00:00 2001 From: cloudroam <cloudroam> Date: 星期三, 27 十一月 2024 13:49:31 +0800 Subject: [PATCH] 565-订单列表:增加用户账号搜索框 --- src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml | 86 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 83 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml b/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml index 1972404..485f9b1 100644 --- a/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml +++ b/src/main/resources/mapper/coupon/CouponTemplateMapperCustom.xml @@ -34,8 +34,9 @@ <result column="status" property="status" /> <result column="point" property="point" /> <result column="member_id" property="memberId" /> - </resultMap> + + <update id="activeBatchCouponTemplate"> 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=")"> @@ -54,6 +55,12 @@ <foreach collection="param.idList" item="item" open="(" separator="," close=")"> #{item} </foreach> + </update> + <update id="expireHomeActivityCouponTemplate"> + update t_coupon_template set status='expired' where category='activity' and get_type='home' and status='active' + </update> + <update id="expireActivityCouponTemplateAll"> + update t_coupon_template set status='expired' where category='activity' and get_end_date < NOW() </update> <select id="getCouponTemplatePage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> @@ -75,8 +82,11 @@ 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 param.category == 'activity' "> + AND t.get_start_date <= NOW() + AND NOW() <= t.get_end_date + </if> + <if test="param.category != null and param.category != ''"> AND category = #{param.category} </if> @@ -109,6 +119,76 @@ <select id="getCouponTemplateVipPage" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> <include refid="QuerySqlVip" /> </select> + <select id="getHomeActivityEffectAlert" resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> + SELECT * + FROM t_coupon_template t + WHERE t.deleted = FALSE + + <if test="param.category != null and param.category != '' and param.category == 'activity' "> + AND t.get_start_date <= NOW() + AND NOW() <= t.get_end_date + </if> + + <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> + <if test="param.getType != null and param.getType != ''"> + AND t.get_type = #{param.getType} + </if> + ORDER BY t.create_time DESC + limit 1 + </select> + <select id="getActivityEffectListWithMine" + resultType="com.mzl.flower.dto.response.coupon.CouponTemplateVO"> + select t2.*,t2.get_limit,IFNULL(t2.get_limit- t2.getNum,0) as left_num from ( + SELECT + t.*, + ( + SELECT count( 1 ) + FROM t_coupon_record cr + WHERE cr.coupon_id = t.id AND cr.deleted = 0 + <if test="param.userId != null and param.userId != ''"> + AND cr.user_id = #{param.userId} + </if> + + ) AS getNum, + ( + SELECT min( cr.create_time ) + FROM t_coupon_record cr + WHERE cr.coupon_id = t.id AND cr.deleted = 0 + <if test="param.userId != null and param.userId != ''"> + AND cr.user_id = #{param.userId} + </if> + ) AS record_create_time + FROM + t_coupon_template t + WHERE + t.deleted = FALSE + <if test="param.category != null and param.category != '' and param.category == 'activity' "> + AND t.get_start_date <= NOW() + AND NOW() <= t.get_end_date + </if> + + <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> + + ) t2 + + ORDER BY + left_num desc, + create_time DESC, + record_create_time ASC + </select> <sql id="QueryPointSql"> select * -- Gitblit v1.9.3