From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001 From: Pu Zhibing <393733352@qq.com> Date: 星期五, 28 三月 2025 19:57:56 +0800 Subject: [PATCH] 修改bug --- ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml | 76 ++++++++++++++++++++++++++++++++++--- 1 files changed, 69 insertions(+), 7 deletions(-) diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml index ee06215..d742bb3 100644 --- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml +++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/UserCouponRecordMapper.xml @@ -383,7 +383,7 @@ left join t_user_activity_balance b on (a.couponActivityId = b.id and a.activityType = 4) left join t_user_activity c on (b.userActivityId = c.id) </if> - where activityType = #{type} + where a.activityType = #{type} <if test="null != name and '' != name"> and c.`name` like CONCAT('%', #{name}, '%') </if> @@ -408,7 +408,7 @@ sum(aa.receiveMoney) as useMoney from ( select - DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, a.userId, count(a.id) as receive, sum(a.money) as receiveMoney @@ -430,12 +430,12 @@ and c.`name` like CONCAT('%', #{name}, '%') </if> <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} </if> <if test="null != companyId"> and c.companyId = #{companyId} </if> - GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId + GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId ) as aa GROUP BY aa.time <if test="2 == type"> @@ -468,6 +468,37 @@ and b.companyId = #{companyId} </if> GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time + + union all + + select + aa.time, + 0, + 0, + 0, + count(aa.userId) as usePeople, + sum(aa.receive) as `use`, + sum(aa.receiveMoney) as useMoney + from ( + select + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) + where a.activityType = 1 and a.state = 2 + <if test="null != name and '' != name"> + and b.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and b.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId ) as aa GROUP BY aa.time </if> ) as da GROUP BY da.time order by da.time desc @@ -534,7 +565,7 @@ sum(aa.receiveMoney) as useMoney from ( select - DATE_FORMAT(a.insertTime, '%Y-%m-%d') as time, + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, a.userId, count(a.id) as receive, sum(a.money) as receiveMoney @@ -556,12 +587,12 @@ and c.`name` like CONCAT('%', #{name}, '%') </if> <if test="null != start and '' != start and null != end and '' != end"> - and DATE_FORMAT(a.insertTime, '%Y-%m-%d') between #{start} and #{end} + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} </if> <if test="null != companyId"> and c.companyId = #{companyId} </if> - GROUP BY DATE_FORMAT(insertTime, '%Y-%m-%d'),userId + GROUP BY DATE_FORMAT(endTime, '%Y-%m-%d'),userId ) as aa GROUP BY aa.time <if test="2 == type"> @@ -595,6 +626,37 @@ </if> GROUP BY DATE_FORMAT(a.insertTime, '%Y-%m-%d'),userId ) as aa GROUP BY aa.time + + union all + + select + aa.time, + 0, + 0, + 0, + count(aa.userId) as usePeople, + sum(aa.receive) as `use`, + sum(aa.receiveMoney) as useMoney + from ( + select + DATE_FORMAT(a.endTime, '%Y-%m-%d') as time, + a.userId, + count(a.id) as receive, + sum(a.money) as receiveMoney + from t_user_coupon_record a + left join t_sys_coupon_record b on (a.couponActivityId = b.id and a.activityType = 1) + where a.activityType = 1 and a.state = 2 + <if test="null != name and '' != name"> + and b.`name` like CONCAT('%', #{name}, '%') + </if> + <if test="null != start and '' != start and null != end and '' != end"> + and DATE_FORMAT(a.endTime, '%Y-%m-%d') between #{start} and #{end} + </if> + <if test="null != companyId"> + and b.companyId = #{companyId} + </if> + GROUP BY DATE_FORMAT(a.endTime, '%Y-%m-%d'),userId + ) as aa GROUP BY aa.time </if> ) as da GROUP BY da.time ) as w -- Gitblit v1.7.1