Commit d3512206b95213f8beb358a3cca3487e60624d38
1 parent
94a16c3783
Exists in
master
and in
6 other branches
优惠劵统计优化
Showing 2 changed files with 7 additions and 12 deletions
platform-biz-service/src/main/resources/mainOrm/master/CouponMapper.xml
View file @
d351220
... | ... | @@ -846,9 +846,11 @@ |
846 | 846 | select a.ymd, a.user_id from ( |
847 | 847 | select DATE_FORMAT(a.create_date, '%Y-%m-%d') as ymd, a.user_id |
848 | 848 | from coupon_info a, coupon_template b, coupon_type c |
849 | - where a.user_id in | |
850 | - <foreach collection="userIds" open="(" close=")" separator="," item="uid"> | |
851 | - #{uid} | |
849 | + where a.coupon_template_id = b.id and b.type_id = c.id | |
850 | + and a.${hospitalFlag} = #{hid} | |
851 | + and c.type in | |
852 | + <foreach collection="couponType" open="(" close=")" separator="," item="type"> | |
853 | + #{type} | |
852 | 854 | </foreach> |
853 | 855 | <if test="startDate != null"> |
854 | 856 | and a.create_date >= #{startDate} |
... | ... | @@ -856,12 +858,6 @@ |
856 | 858 | <if test="endDate != null"> |
857 | 859 | and a.create_date <![CDATA[ < ]]> #{endDate} |
858 | 860 | </if> |
859 | - and a.coupon_template_id = b.id and b.type_id = c.id | |
860 | - and a.${hospitalFlag} = #{hid} | |
861 | - and c.type in | |
862 | - <foreach collection="couponType" open="(" close=")" separator="," item="type"> | |
863 | - #{type} | |
864 | - </foreach> | |
865 | 861 | order by a.create_date desc |
866 | 862 | ) a group by a.ymd, a.user_id |
867 | 863 | ) a group by a.user_id |
... | ... | @@ -872,8 +868,7 @@ |
872 | 868 | select a.ymd, a.user_id from ( |
873 | 869 | select DATE_FORMAT(a.create_date, '%Y-%m-%d') as ymd, a.user_id |
874 | 870 | from coupon_info a, coupon_template b, coupon_type c |
875 | - where 1=1 | |
876 | - and a.coupon_template_id = b.id and b.type_id = c.id | |
871 | + where a.coupon_template_id = b.id and b.type_id = c.id | |
877 | 872 | and a.${hospitalFlag} = #{hid} |
878 | 873 | and c.type in |
879 | 874 | <foreach collection="couponType" open="(" close=")" separator="," item="type"> |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/service/impl/ReportServiceImpl.java
View file @
d351220
... | ... | @@ -2608,7 +2608,7 @@ |
2608 | 2608 | List<String> usedUserIds2 = new ArrayList<>(); |
2609 | 2609 | if(CollectionUtils.isNotEmpty(usedUserIds)) { |
2610 | 2610 | // List<Map<String, Object>> mulitPatienInfo = couponMapper.findMulitPatienInfo(CollectionUtils.createMap("userIds", usedUserIds, "startDate", param.get("startDate"))); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */ |
2611 | - param.put("userIds", usedUserIds); | |
2611 | +// param.put("userIds", usedUserIds); | |
2612 | 2612 | param.put("hospitalFlag", "used_hospital_id"); |
2613 | 2613 | List<Map<String, Object>> mulitPatienInfo = couponMapper.findMulitPatienInfo(param); /** 查询需要添加人数的总数, 例如A发了两次优惠券 那么这里返回需要加的值为1 */ |
2614 | 2614 | for (Map<String, Object> m : mulitPatienInfo) { |