Sfoglia il codice sorgente

http://192.168.0.21/index.php?m=bug&f=view&bugID=25922
删除商品分类

lyhzzz 3 anni fa
parent
commit
114e988fdc

+ 5 - 2
platform-shop/src/main/java/com/platform/controller/BrandController.java

@@ -309,7 +309,7 @@ public class BrandController extends AbstractController{
         params.put("isDelete", 0);
         List<GoodsEntity> goodsEntities = goodsService.queryList(params);
         if (!ObjectUtils.isEmpty(goodsEntities)) {
-            return Result.failure("该场景或者直播间已经设置了商品,不允许删除!");
+            return Result.failure("删除失败,先删除直播间绑定的商品后再重试!");
         }
         //获取数据,推送给api
         Arrays.stream(ids).map(id-> brandService.queryObject(id)).forEach(entity->{
@@ -346,8 +346,11 @@ public class BrandController extends AbstractController{
                 params.put("createUserId",getUser().getId());
             }
         }
-
         List<BrandEntity> list = brandService.queryList(params);
+        if(roleIds.contains(8L)){
+            List<BrandEntity> list2 = brandService.getBrandByUserId(getUser().getId());
+            list.addAll(list2);
+        }
 
         return Result.success(list);
     }

+ 2 - 0
platform-shop/src/main/java/com/platform/controller/GoodsController.java

@@ -81,6 +81,8 @@ public class GoodsController extends AbstractController{
             } else if (roleIdList.contains(8L) || roleIdList.contains(2L)) {
                 // 公司员工只能获取当前绑定当前用户直播间的商品数据
                 List<Long> brandIds = mySysUserBrandService.queryBrandIdList(getUserId());
+                List<Long> brandIds2 =  brandService.queryIdByUser(getUserId());
+                brandIds.addAll(brandIds2);
                 if(ObjectUtils.isEmpty(brandIds)){
                     return Result.success(pageUtil);
                 }

+ 4 - 0
platform-shop/src/main/java/com/platform/dao/BrandDao.java

@@ -27,4 +27,8 @@ public interface BrandDao extends BaseDao<BrandEntity> {
     IPage<BrandEntity> getBrandBindListWithPage(IPage<BrandEntity> page, @Param("ew") QueryWrapper<BrandEntity> queryWrapper);
 
     List<String> queryAllLiveSceneNum();
+
+    List<Long> queryIdByUser(Long userId);
+
+    List<BrandEntity> getBrandByUserId(Long userId);
 }

+ 4 - 0
platform-shop/src/main/java/com/platform/service/BrandService.java

@@ -107,4 +107,8 @@ public interface BrandService {
     void bindUser(Long userId,Integer brandId,Integer canShow);
 
     void unbindUser(Long userId,Integer brandId);
+
+    List<Long> queryIdByUser(Long userId);
+
+    List<BrandEntity> getBrandByUserId(Long id);
 }

+ 10 - 0
platform-shop/src/main/java/com/platform/service/impl/BrandServiceImpl.java

@@ -440,4 +440,14 @@ public class BrandServiceImpl implements BrandService {
         dbUserBrand.setEnable(0);
         mySysUserBrandService.updateSysUserBrand(dbUserBrand);
     }
+
+    @Override
+    public List<Long> queryIdByUser(Long userId) {
+        return brandDao.queryIdByUser(userId);
+    }
+
+    @Override
+    public List<BrandEntity> getBrandByUserId(Long userId) {
+        return brandDao.getBrandByUserId(userId);
+    }
 }

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

@@ -55,6 +55,8 @@ public class GoodsServiceImpl implements GoodsService {
             return null;
         }
         map.put("goodsId", goodsEntity.getId() + "");
+        map.put("sidx","uuid");
+        map.put("order","asc");
         goodsEntity.setGoodsSpecificationList(goodsSpecificationService.queryList(map));
         map.put("sidx","uuid_link");
         map.put("order","asc");

+ 9 - 0
platform-shop/src/main/resources/com/platform/dao/BrandDao.xml

@@ -177,4 +177,13 @@
         </foreach>
     </delete>
 
+    <select id="queryIdByUser" resultType="long">
+       select id from nideshop_brand where create_user_id = #{userId}
+    </select>
+
+    <select id="getBrandByUserId" resultType="com.platform.entity.BrandEntity">
+       select *  from nideshop_brand b left join sys_user_brand s on b.id = s.brand_id
+       where user_id = #{userId}
+    </select>
+
 </mapper>