Преглед изворни кода

修改产品类目状态启用/停用

1018653686@qq.com пре 1 година
родитељ
комит
2c893fd176

+ 9 - 0
hx-xmhjc/src/main/java/com/fjhx/xmhjc/controller/product/ProductCategoryController.java

@@ -1,6 +1,7 @@
 package com.fjhx.xmhjc.controller.product;
 
 import cn.hutool.core.collection.CollectionUtil;
+import com.fjhx.xmhjc.entity.product.dto.ProductInfoDto;
 import com.fjhx.xmhjc.entity.product.dto.ProductInfoSelectDto;
 import com.fjhx.xmhjc.entity.product.po.ProductInfo;
 import com.fjhx.xmhjc.entity.product.vo.ProductInfoVo;
@@ -88,4 +89,12 @@ public class ProductCategoryController {
         productCategoryService.delete(dto.getId());
     }
 
+    /**
+     * 产品信息修改状态
+     */
+    @PostMapping("/changeStatus")
+    public void changeStatus(@RequestBody ProductCategoryDto productCategoryDto) {
+        productCategoryService.changeStatus(productCategoryDto);
+    }
+
 }

+ 2 - 0
hx-xmhjc/src/main/java/com/fjhx/xmhjc/service/product/ProductCategoryService.java

@@ -50,4 +50,6 @@ public interface ProductCategoryService extends BaseService<ProductCategory> {
     void delete(Long id);
 
     List<ProductCategoryVo> listByOpen();
+
+    void changeStatus(ProductCategoryDto productCategoryDto);
 }

+ 7 - 2
hx-xmhjc/src/main/java/com/fjhx/xmhjc/service/product/impl/ProductCategoryServiceImpl.java

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
 import com.fjhx.file.entity.FileInfoVo;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.fjhx.xmhjc.entity.product.po.ProductCategory;
+import com.fjhx.xmhjc.entity.product.po.ProductInfo;
 import com.fjhx.xmhjc.entity.product.po.ProductSubCategory;
 import com.fjhx.xmhjc.entity.product.vo.ProductSubCategoryVo;
 import com.fjhx.xmhjc.mapper.product.ProductCategoryMapper;
@@ -110,8 +111,12 @@ public class ProductCategoryServiceImpl extends ServiceImpl<ProductCategoryMappe
             Map<Long, List<FileInfoVo>> fileMap = ObsFileUtil.getFileMap(businessIdList, 1);
             x.setCategoryCoverList(fileMap.get(x.getId()));
         });
-
-
         return list;
     }
+
+    @Override
+    public void changeStatus(ProductCategoryDto productCategoryDto) {
+        lambdaUpdate().set(ProductCategory::getStatus, productCategoryDto.getStatus())
+                .eq(ProductCategory::getId, productCategoryDto.getId()).update();
+    }
 }