Bladeren bron

团购增加已售数量返回

jyc 1 maand geleden
bovenliggende
commit
922372c9d2

+ 3 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LifeGroupBuyThaliVo.java

@@ -256,4 +256,7 @@ public class LifeGroupBuyThaliVo {
     @ApiModelProperty(value = "是否收藏")
     private String isCollect;
 
+    @ApiModelProperty(value = "已售数量")
+    private Integer saleNum;
+
 }

+ 3 - 0
alien-entity/src/main/java/shop/alien/mapper/LifeUserOrderMapper.java

@@ -72,4 +72,7 @@ public interface LifeUserOrderMapper extends BaseMapper<LifeUserOrder> {
      * @return
      */
     List<LifeUserOrderVo> selectRefundList(LambdaUpdateWrapper<LifeUserOrder> selectWrapper);
+
+    @Select("SELECT count( luo.id ) FROM life_user_order luo LEFT JOIN order_coupon_middle ocm ON luo.id = ocm.order_id WHERE luo.`status` IN ( 0, 1, 2, 7 ) AND luo.delete_flag = 0 AND luo.coupon_type = 2 AND ocm.coupon_id = #{groupId}")
+    Integer countBuyGroup(@Param("groupId") String groupId);
 }

+ 6 - 0
alien-store/src/main/java/shop/alien/store/service/impl/LifeGroupBuyServiceImpl.java

@@ -46,6 +46,8 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
 
     private final WebAuditMapper webAuditMapper;
 
+    private final LifeUserOrderMapper lifeUserOrderMapper;
+
     @Override
     public boolean saveThali(LifeGroupBuyDto lifeGroupBuyDto) {
         JSONObject currentUserInfo = JwtUtil.getCurrentUserInfo();
@@ -187,6 +189,10 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
         }
         lifeGroupBuyThaliVo.setDetails(resultMap);
         getMainImgAndDisableDate(lifeGroupBuyThaliVo);
+
+        //已售数量
+        lifeGroupBuyThaliVo.setSaleNum(lifeUserOrderMapper.countBuyGroup(id));
+
         return lifeGroupBuyThaliVo;
     }