Bladeren bron

Merge remote-tracking branch 'origin/dev' into dev

wxd 1 maand geleden
bovenliggende
commit
74b2b8954b

+ 10 - 8
alien-entity/src/main/java/shop/alien/mapper/LifeGroupBuyMainMapper.java

@@ -31,14 +31,16 @@ public interface LifeGroupBuyMainMapper extends BaseMapper<LifeGroupBuyMain> {
 
 
     @Update("UPDATE life_group_buy_main\n" +
-            "    SET \n" +
-            "        inventory_num = inventory_num - #{buyCount},\n" +
-            "        status = CASE WHEN (inventory_num - #{buyCount}) = 0 \n" +
-            "                     THEN #{soldOutStatus} \n" +
-            "                     ELSE status END\n" +
-            "    WHERE \n" +
-            "        id = #{couponId} \n" +
-            "        AND inventory_num >= #{buyCount}")
+            "SET \n" +
+            "  status = CASE \n" +
+            "    WHEN (inventory_num - #{buyCount}) = 0 THEN #{soldOutStatus}  \n" +
+            "    ELSE status \n" +
+            "  END,\n" +
+            "  inventory_num = inventory_num - #{buyCount}\n" +
+            "WHERE \n" +
+            "   id = #{couponId}\n" +
+            "\t AND inventory_num >= #{buyCount}"
+    )
     int deductInventoryAtomically(
             @Param("couponId") Integer couponId,
             @Param("buyCount") int buyCount,

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

@@ -132,12 +132,16 @@ public class LifeGroupBuyServiceImpl extends ServiceImpl<LifeGroupBuyMainMapper,
     @Override
     public IPage<LifeGroupBuyThaliVo> getThaliList(int page, int size, String storeId, String status, String groupName, String groupType) {
         QueryWrapper<LifeGroupBuyThaliVo> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq(StringUtils.isNotEmpty(storeId), "store_id", storeId)
-                .eq(StringUtils.isNotEmpty(status), "status", status)
-                .eq(StringUtils.isNotEmpty(groupType), "group_type", groupType)
-                .like(StringUtils.isNotEmpty(groupName), "group_name", groupName)
-                .eq("delete_flag", 0)
-                .orderByDesc("created_time");
+        queryWrapper.eq(StringUtils.isNotEmpty(storeId), "store_id", storeId);
+        if(status.equals("8")){
+            queryWrapper.in(StringUtils.isNotEmpty(status), "status", 2, 6);
+        }else{
+            queryWrapper.eq(StringUtils.isNotEmpty(status), "status", status);
+        }
+        queryWrapper.eq(StringUtils.isNotEmpty(groupType), "group_type", groupType);
+        queryWrapper.like(StringUtils.isNotEmpty(groupName), "group_name", groupName);
+        queryWrapper.eq("delete_flag", 0);
+        queryWrapper.orderByDesc("created_time");
         IPage<LifeGroupBuyThaliVo> lifeGroupBuyThaliVoIPage = new Page<>(page, size);
         IPage<LifeGroupBuyThaliVo> voIPage = lifeGroupBuyMainMapper.selectPageByThaliVo(lifeGroupBuyThaliVoIPage, queryWrapper);
         voIPage.getRecords().forEach(this::getMainImgAndDisableDate);