From 225c57690f7c8bfc969108b9934838663cde7c4c Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 19 九月 2023 09:45:43 +0800
Subject: [PATCH] 新增源数据菜单

---
 server/company/src/main/java/com/doumee/api/business/GoodsController.java |   40 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 39 insertions(+), 1 deletions(-)

diff --git a/server/company/src/main/java/com/doumee/api/business/GoodsController.java b/server/company/src/main/java/com/doumee/api/business/GoodsController.java
index 50df5e6..0b62d52 100644
--- a/server/company/src/main/java/com/doumee/api/business/GoodsController.java
+++ b/server/company/src/main/java/com/doumee/api/business/GoodsController.java
@@ -3,13 +3,17 @@
 import com.doumee.api.BaseController;
 import com.doumee.core.annotation.excel.ExcelExporter;
 import com.doumee.core.annotation.pr.PreventRepeat;
+import com.doumee.core.model.LoginUserInfo;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.dao.business.model.Goods;
+import com.doumee.dao.business.model.dto.BatchDisableDTO;
 import com.doumee.dao.business.model.dto.GoodCreatePlatRequest;
 import com.doumee.dao.business.model.dto.GoodsRequest;
+import com.doumee.service.CateParamSelectService;
 import com.doumee.service.business.GoodsService;
 import io.swagger.annotations.*;
+import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -33,6 +37,8 @@
 
     @Autowired
     private GoodsService goodsService;
+    @Autowired
+    private CateParamSelectService cateParamSelectService;
 
     @PreventRepeat
     @ApiOperation("鏂板缓")
@@ -41,6 +47,19 @@
     public ApiResponse create(@RequestBody Goods goods) {
         return ApiResponse.success(goodsService.create(goods));
     }
+
+
+
+    @PreventRepeat
+    @ApiOperation("浼佷笟鏂板缓鍟嗗搧")
+    @PostMapping("/companyCreate")
+//    @RequiresPermissions("business:goods:create")
+    public ApiResponse companyCreate(@RequestBody Goods goods) {
+        goodsService.companyCreate(goods);
+        cateParamSelectService.dealGroupVals(goods.getCompanyId());
+        return ApiResponse.success("鎿嶄綔鎴愬姛");
+    }
+
     @PreventRepeat
     @ApiOperation("浠庡钩鍙伴�夋嫨鍟嗗搧")
     @PostMapping("/createPlat")
@@ -78,10 +97,20 @@
         return ApiResponse.success(null);
     }
 
+    @ApiOperation("浼佷笟鏍规嵁ID淇敼")
+    @PostMapping("/companyUpdateById")
+    @RequiresPermissions("business:goods:update")
+    public ApiResponse companyUpdateById(@RequestBody Goods goods) {
+        goodsService.companyUpdateById(goods);
+        return ApiResponse.success(null);
+    }
+
     @ApiOperation("鍒嗛〉鏌ヨ")
     @PostMapping("/page")
     @RequiresPermissions("business:goods:query")
     public ApiResponse<PageData<Goods>> findPage (@RequestBody PageWrap<Goods> pageWrap) {
+        LoginUserInfo loginUserInfo = this.getLoginUser();
+        pageWrap.getModel().setCompanyId(loginUserInfo.getCompanyId());
         return ApiResponse.success(goodsService.findPage(pageWrap));
     }
 
@@ -112,16 +141,25 @@
 
     @ApiOperation("淇敼鐘舵��")
     @PostMapping("/updateDisableById")
-    @RequiresPermissions("business:category:update")
+    @RequiresPermissions("business:goods:update")
     public ApiResponse updateDisableById(@RequestBody Goods goods) {
         goodsService.updateDisableById(goods);
         return ApiResponse.success(null);
+    }
+
+    @ApiOperation("鎵归噺淇敼鐘舵��")
+    @PostMapping("/batchUpdateDisableById")
+    @RequiresPermissions("business:goods:update")
+    public ApiResponse<String> batchUpdateDisableById(@RequestBody BatchDisableDTO batchDisableDTO) {
+        return ApiResponse.success(goodsService.batchUpdateDisableById(batchDisableDTO));
     }
 
 
     @ApiOperation("鍒楄〃 - H5")
     @PostMapping("/list")
     public ApiResponse<List<Goods>> findList (@RequestBody Goods goods) {
+        LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal();
+        goods.setCompanyId(user.getCompanyId());
         return ApiResponse.success(goodsService.findList(goods));
     }
 

--
Gitblit v1.9.3