From b23c0332c287158ff2e6cf97479969d15744a992 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期一, 18 九月 2023 18:01:22 +0800
Subject: [PATCH] 基础字段

---
 server/company/src/main/java/com/doumee/api/business/GoodsController.java |   43 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 42 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 b6fdd44..81803f2 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,12 +3,16 @@
 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.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.*;
@@ -41,6 +45,24 @@
         return ApiResponse.success(goodsService.create(goods));
     }
 
+
+
+    @PreventRepeat
+    @ApiOperation("浼佷笟鏂板缓鍟嗗搧")
+    @PostMapping("/companyCreate")
+//    @RequiresPermissions("business:goods:create")
+    public ApiResponse companyCreate(@RequestBody Goods goods) {
+        return ApiResponse.success(goodsService.companyCreate(goods));
+    }
+
+    @PreventRepeat
+    @ApiOperation("浠庡钩鍙伴�夋嫨鍟嗗搧")
+    @PostMapping("/createPlat")
+    @RequiresPermissions("business:goods:create")
+    public ApiResponse createPlat(@RequestBody GoodCreatePlatRequest param) {
+        return ApiResponse.success(goodsService.createPlat(param));
+    }
+
     @ApiOperation("鏍规嵁ID鍒犻櫎")
     @GetMapping("/delete/{id}")
     @RequiresPermissions("business:goods:delete")
@@ -70,10 +92,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));
     }
 
@@ -104,16 +136,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