Ver Fonte

fix(coupon):修复优惠券查询条件过滤不全的问题

- 增加对未使用且未过期优惠券的筛选条件
- 添加按用户ID查询的参数支持
- 完善现金券查询中的状态与用户ID过滤逻辑
xw há 1 mês atrás
pai
commit
2767529799

+ 8 - 2
fs-service/src/main/java/com/fs/hisStore/mapper/FsStoreCouponUserScrmMapper.java

@@ -86,7 +86,7 @@ public interface FsStoreCouponUserScrmMapper
     List<FsStoreCouponUserScrm> selectFsStoreCouponUserListByEnable(@Param("maps")FsCouponUserEnableParam param);
     @Select({"<script> " +
             "select cu.*,u.nickname,u.phone from fs_store_coupon_user_scrm cu inner join fs_user u  on u.user_id=cu.user_id inner join fs_store_coupon_scrm c on c.coupon_id = cu.coupon_id  " +
-            "where  cu.is_del=0 and c.type!=3 " +
+            "where  cu.is_del=0 and c.type!=3 and cu.status=0 and cu.limit_time &gt; now() " +
             "<if test = 'maps.status != null     '> " +
             "and cu.status =#{maps.status} " +
             "</if>" +
@@ -99,18 +99,24 @@ public interface FsStoreCouponUserScrmMapper
             "<if test = 'maps.endTime != null and maps.endTime != \"\" '> " +
             "and date_format(cu.create_time,'%y%m%d') &lt;= date_format(#{maps.endTime},'%y%m%d') " +
             "</if>" +
+            "<if test = 'maps.userId != null     '> " +
+            "and cu.user_id =#{maps.userId} " +
+            "</if>" +
             "order by cu.id desc " +
             "</script>"})
     List<FsStoreCouponUserVO> selectFsStoreCouponUserListVO(@Param("maps") FsStoreCouponUserScrm fsStoreCouponUser);
     @Select({"<script> " +
             "select cu.*,u.nickname,u.phone from fs_store_coupon_user_scrm cu inner join fs_user u  on u.user_id=cu.user_id inner join fs_store_coupon_scrm c on c.coupon_id = cu.coupon_id   " +
-            "where  cu.is_del=0 and c.type=3 " +
+            "where  cu.is_del=0 and c.type=3 and cu.status=0 " +
             "<if test = 'maps.status != null     '> " +
             "and cu.status =#{maps.status} " +
             "</if>" +
             "<if test = 'maps.isDel != null     '> " +
             "and cu.is_del =#{maps.isDel} " +
             "</if>" +
+            "<if test = 'maps.userId != null     '> " +
+            "and cu.user_id =#{maps.userId} " +
+            "</if>" +
             "</script>"})
     List<FsStoreCouponUserVO> selectFsStoreCouponUserListVOForCash(@Param("maps")FsStoreCouponUserScrm fsStoreCouponUser);