|
@@ -1,5 +1,6 @@
|
|
|
package cn.cslg.pas.controller;
|
|
|
|
|
|
+import cn.cslg.pas.common.auth.checkAuth;
|
|
|
import cn.cslg.pas.common.core.base.Constants;
|
|
|
import cn.cslg.pas.common.dto.business.ProductCategoryDTO;
|
|
|
import cn.cslg.pas.common.dto.business.UpdateProductCategoryDTO;
|
|
@@ -26,6 +27,7 @@ import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 产品类别的Controller层
|
|
|
+ *
|
|
|
* @Author xiexiang
|
|
|
* @Date 2023/10/24
|
|
|
*/
|
|
@@ -38,7 +40,8 @@ public class ProductCategoryController {
|
|
|
|
|
|
@Operation(summary = "查询产品类别")
|
|
|
@PostMapping("/queryProductCategory")
|
|
|
- public Response queryProductCategory(@RequestBody StringRequest stringRequest) throws Exception {
|
|
|
+ @checkAuth(FunId = "xiaoshi/product")
|
|
|
+ public Response queryProductCategory(@RequestBody StringRequest stringRequest) throws Exception {
|
|
|
Business business = businessFactory.getClass("productCategoryService");
|
|
|
Records records = (Records) business.queryMessage(stringRequest);
|
|
|
return Response.success(records);
|
|
@@ -46,6 +49,7 @@ public class ProductCategoryController {
|
|
|
|
|
|
@Operation(summary = "添加产品类别")
|
|
|
@PostMapping("/addProductCategory")
|
|
|
+ @checkAuth(FunId = "xiaoshi/product")
|
|
|
public Response addProductCategory(String productCategory, List<MultipartFile> files) throws Exception {
|
|
|
if (productCategory != null && productCategory != "") {
|
|
|
ProductCategoryDTO productCategoryDTO = JSONObject.parseObject(productCategory, ProductCategoryDTO.class);
|
|
@@ -53,8 +57,8 @@ public class ProductCategoryController {
|
|
|
Integer id = null;
|
|
|
try {
|
|
|
id = (Integer) business.addMessage(productCategoryDTO, files);
|
|
|
- } catch (Exception e){
|
|
|
- if(e instanceof XiaoShiException) {
|
|
|
+ } catch (Exception e) {
|
|
|
+ if (e instanceof XiaoShiException) {
|
|
|
return Response.error(e.getMessage());
|
|
|
} else if (e instanceof UnLoginException) {
|
|
|
return Response.unLogin(e.getMessage());
|
|
@@ -70,18 +74,21 @@ public class ProductCategoryController {
|
|
|
|
|
|
@Operation(summary = "更新产品类别")
|
|
|
@PostMapping("/updateProductCategory")
|
|
|
+ @checkAuth(FunId = "xiaoshi/product")
|
|
|
public Response updateProductCategory(String productCategory, List<MultipartFile> files) throws Exception {
|
|
|
if (productCategory != null) {
|
|
|
UpdateProductCategoryDTO updateProductCategoryDTO = JSONObject.parseObject(productCategory, UpdateProductCategoryDTO.class);
|
|
|
Business business = businessFactory.getClass("productCategoryService");
|
|
|
- business.updateMessage(updateProductCategoryDTO,files);
|
|
|
+ business.updateMessage(updateProductCategoryDTO, files);
|
|
|
return Response.success(1);
|
|
|
} else {
|
|
|
return Response.error("网络异常");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Operation(summary = "删除产品类别")
|
|
|
@PostMapping("/deleteProductCategory")
|
|
|
+ @checkAuth(FunId = "xiaoshi/product")
|
|
|
public String deleteProductCategory(@RequestBody List<Integer> ids) throws Exception {
|
|
|
Business business = businessFactory.getClass("productCategoryService");
|
|
|
business.deleteMessage(ids);
|