From 1b665d44cecaaf94bed0dba7390ff2d91cb497fe Mon Sep 17 00:00:00 2001 From: guyue <1721849008@qq.com> Date: 星期一, 18 八月 2025 21:11:46 +0800 Subject: [PATCH] 待接单改为待应答 --- UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml | 142 +++++++++++++++++++++++++++++++++++++--------- 1 files changed, 113 insertions(+), 29 deletions(-) diff --git a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml index b253b6d..11a15c3 100644 --- a/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml +++ b/UserOKTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml @@ -41,12 +41,111 @@ <if test="null != couponUseType"> and a.couponUseType = #{couponUseType} </if> - <if test="null != money"> - and if(a.couponType = 1, a.money <= #{money}, a.fullMoney <= #{money}) - </if> </select> <select id="queryCoupon" resultType="map"> + select + a.id as id, + a.money as money, + a.couponUseType as userType, + DATE_FORMAT(a.expirationTime, '%Y-%m-%d') as time, + a.couponType as `type`, + a.fullMoney as fullMoney, + a.state as state, + b.`name` as `name`, + c.citys + from t_user_coupon_record a + left join t_company b on (a.companyId = b.id) + left join t_sys_coupon_record c on (a.couponId = c.id) + where a.expirationTime >= now() + <if test="null != uid"> + and a.userId = #{uid} + </if> + <if test="null != companyId"> + and a.companyId = #{companyId} + </if> + <if test="null != state"> + and a.state = #{state} + </if> + <if test="null != couponUseType"> + and a.couponUseType = #{couponUseType} + </if> + order by a.insertTime desc + </select> + + + + + <select id="queryCoupon1" resultType="map"> + select + a.id as id, + a.money as money, + a.couponUseType as userType, + DATE_FORMAT(a.expirationTime, '%Y-%m-%d') as time, + a.couponType as `type`, + a.fullMoney as fullMoney, + a.state as state, + b.`name` as `name`, + c.citys + from t_user_coupon_record a + left join t_company b on (a.companyId = b.id) + left join t_sys_coupon_record c on (a.couponId = c.id) + where a.expirationTime >= now() + <if test="null != uid"> + and a.userId = #{uid} + </if> + <if test="null != cityCode and '' != cityCode"> + and JSON_OVERLAPS(c.citys, #{cityCode}) + </if> + <if test="null != state"> + and a.state = #{state} + </if> + <if test="null != couponUseType"> + and a.couponUseType = #{couponUseType} + </if> + <if test="null != money"> + and if(a.couponType = 1, a.money <= #{money}, a.fullMoney <= #{money}) + </if> + order by a.insertTime desc + <if test="null != pageNum and null != size"> + limit #{pageNum}, #{size} + </if> + </select> + + + + <select id="queryMyCoupons" resultType="map"> + select + a.id as id, + a.money as money, + a.couponUseType as userType, + DATE_FORMAT(a.expirationTime, '%Y-%m-%d') as time, + a.couponType as `type`, + a.fullMoney as fullMoney, + a.state as state, + b.`name` as `name`, + c.citys + from t_user_coupon_record a + left join t_company b on (a.companyId = b.id) + left join t_sys_coupon_record c on (a.couponId = c.id) + where 1 = 1 + <if test="null != uid"> + and a.userId = #{uid} + </if> + <if test="null != state"> + <if test="state == 1"> + and a.state = 1 + </if> + <if test="state == 2"> + and a.state in (2,3) + </if> + </if> + order by a.insertTime desc + <if test="null != pageNum and null != size"> + limit #{pageNum}, #{size} + </if> + </select> + <select id="queryAvailable_" resultType="map"> select a.id as id, a.money as money, @@ -71,21 +170,16 @@ <if test="null != couponUseType"> and a.couponUseType = #{couponUseType} </if> - <if test="null != money"> - and if(a.couponType = 1, a.money <= #{money}, a.fullMoney <= #{money}) - </if> order by a.insertTime desc - <if test="null != pageNum and null != size"> - limit #{pageNum}, #{size} - </if> </select> + <update id="updateTimeOut"> + update t_user_coupon_record set state = 3,endTime = now() where now() > expirationTime and state = 1 + </update> - - - <select id="queryMyCoupons" resultType="map"> + <select id="queryCouponCrossCity" resultType="map"> select a.id as id, a.money as money, @@ -97,27 +191,17 @@ b.`name` as `name` from t_user_coupon_record a left join t_company b on (a.companyId = b.id) - where 1 = 1 - <if test="null != uid"> - and a.userId = #{uid} - </if> - <if test="null != state"> - <if test="state == 1"> - and a.state = 1 + <where> + <if test="ids != null and ids.size()>0"> + and a.id in + <foreach collection="ids" item="id" index="index" open="(" close=")" separator=","> + #{id} + </foreach> </if> - <if test="state == 2"> - and a.state in (2,3) - </if> - </if> + </where> order by a.insertTime desc <if test="null != pageNum and null != size"> limit #{pageNum}, #{size} </if> </select> - - - - <update id="updateTimeOut"> - update t_user_coupon_record set state = 3,endTime = now() where now() > expirationTime and state = 1 - </update> </mapper> \ No newline at end of file -- Gitblit v1.7.1