Pārlūkot izejas kodu

http://192.168.0.21/index.php?m=bug&f=view&bugID=25782

lyhzzz 3 gadi atpakaļ
vecāks
revīzija
747d40a1fc

+ 6 - 0
platform-common/src/main/java/com/platform/service/custom/MySysUserBrandService.java

@@ -116,4 +116,10 @@ public class MySysUserBrandService extends SysUserBrandServiceImpl {
         wrapper.in("brand_id",ids);
         remove(wrapper);
     }
+
+    public void deleteByUserId(Long userId) {
+        QueryWrapper wrapper = new QueryWrapper();
+        wrapper.eq("user_id",userId);
+        remove(wrapper);
+    }
 }

+ 21 - 0
platform-shop/src/main/java/com/platform/controller/ZfbController.java

@@ -25,6 +25,7 @@ public class ZfbController {
     @Autowired
     private BrandService brandService;
 
+
     @Autowired
     private ZhiHouseService zhiHouseService;
 
@@ -71,6 +72,26 @@ public class ZfbController {
         return Result.success(resultMap);
     }
 
+    @PostMapping("/queryBrandByUserId")
+    public Result queryBrandByUserId(@RequestBody JSONObject param) {
+        Long  userId = param.getLong("userId");
+        if(userId == null){
+            return Result.failure("用户id为空");
+        }
+        List<Long> longs = mySysUserBrandService.queryBrandIdList(userId);
+        return  Result.success(longs.size());
+    }
+
+    @PostMapping("/deleteBrandUser")
+    public Result deleteBrandUser(@RequestBody JSONObject param) {
+        Long  userId = param.getLong("userId");
+        if(userId == null){
+            return Result.failure("用户id为空");
+        }
+        mySysUserBrandService.deleteByUserId(userId);
+        return  Result.success();
+    }
+
 
 
 }

+ 2 - 2
platform-shop/src/main/java/com/platform/service/impl/GoodsServiceImpl.java

@@ -411,7 +411,7 @@ public class GoodsServiceImpl implements GoodsService {
         if(goodsEntity == null){
             throw new RRException("此商品不存在!");
         }
-        if (1 == goodsEntity.getIsOnSale()) {
+        if (goodsEntity.getIsOnSale()!=null && 1 == goodsEntity.getIsOnSale()) {
             throw new RRException("此商品已处于上架状态!");
         }
         goodsEntity.setIsOnSale(1);
@@ -427,7 +427,7 @@ public class GoodsServiceImpl implements GoodsService {
         if(goodsEntity == null){
             throw new RRException("此商品不存在!");
         }
-        if (0 == goodsEntity.getIsOnSale()) {
+        if (goodsEntity.getIsOnSale()!=null && 0 == goodsEntity.getIsOnSale()) {
             throw new RRException("此商品已处于下架状态!");
         }
         goodsEntity.setIsOnSale(0);