From 656d84011dfae275cb8209dad601fcb61a22ee17 Mon Sep 17 00:00:00 2001
From: cy <1664593601@qq.com>
Date: 星期五, 01 十二月 2023 09:34:35 +0800
Subject: [PATCH] feat: 退回单增加机构字段

---
 consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java |   55 +++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 41 insertions(+), 14 deletions(-)

diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java b/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java
index d03b55d..4b6bed5 100644
--- a/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java
+++ b/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java
@@ -1,6 +1,7 @@
 package com.consum.base.controller;
 
 import com.consum.base.BaseController;
+import com.consum.base.core.utils.CommonUtil;
 import com.consum.base.core.utils.MapUtils;
 import com.consum.base.core.utils.MapperUtil;
 import com.consum.base.pojo.BaseGoodsTemplateParam;
@@ -29,7 +30,6 @@
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -57,7 +57,12 @@
      * @Date 2023/10/24
      */
     @PostMapping("/add")
-    public ResponseValue add(@RequestBody BaseGoodsTemplateParam param) {
+    public ResponseValue add() {
+        BaseGoodsTemplateParam param = CommonUtil.getObjFromReqBody(BaseGoodsTemplateParam.class);
+        BaseGoodsTemplateParam param2 = new BaseGoodsTemplateParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
+
         FinSysTenantUser sysInfo = this.getSysInfo();
         if (param.getCategoryId() == null) {
             return ResponseValue.error("鐧诲綍鐢ㄦ埛淇℃伅涓嶅瓨鍦�");
@@ -87,7 +92,12 @@
      * @Date 2023/10/24
      */
     @GetMapping("/list")
-    public ResponseValue queryList(BaseGoodsTemplateParam param) {
+    public ResponseValue queryList() {
+        BaseGoodsTemplateParam param = CommonUtil.getObjFromReq(BaseGoodsTemplateParam.class);
+        BaseGoodsTemplateParam param2 = new BaseGoodsTemplateParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
+
         FinSysTenantUser sysInfo = this.getSysInfo();
         if (sysInfo == null) {
             return ResponseValue.error("鐧诲綍鐢ㄦ埛淇℃伅涓嶅瓨鍦�");
@@ -121,7 +131,12 @@
      * @Date 2023/10/24
      */
     @PostMapping("/edit")
-    public ResponseValue edit(@RequestBody BaseGoodsTemplateParam param) {
+    public ResponseValue edit() {
+        BaseGoodsTemplateParam param = CommonUtil.getObjFromReqBody(BaseGoodsTemplateParam.class);
+        BaseGoodsTemplateParam param2 = new BaseGoodsTemplateParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
+
         if (StringUtils.isEmpty(param.getGoodsName())) {
             return ResponseValue.error("鐗╁搧鍚嶇О涓虹┖");
         }
@@ -142,7 +157,12 @@
      */
     //TODO 鐗╁搧鐨勭鐢ㄦ垨鍒犻櫎锛屼笉褰卞搷宸茬粡閲囪喘鍏ヨ繃搴撶殑鐗╁搧淇℃伅銆�
     @PostMapping("/updStatus")
-    public ResponseValue updateStatus(@RequestBody BaseGoodsTemplate goodsTemplate) {
+    public ResponseValue updateStatus() {
+        BaseGoodsTemplate goodsTemplate = CommonUtil.getObjFromReqBody(BaseGoodsTemplate.class);
+        BaseGoodsTemplate param2 = new BaseGoodsTemplate();
+        CommonUtil.copyProperties(goodsTemplate, param2);
+        goodsTemplate = param2;
+
         if (goodsTemplate == null || goodsTemplate.getId() == null || goodsTemplate.getStates() == null) {
             return ResponseValue.error("鍙傛暟閿欒");
         }
@@ -158,7 +178,12 @@
      */
     //TODO 鐗╁搧鐨勭鐢ㄦ垨鍒犻櫎锛屼笉褰卞搷宸茬粡閲囪喘鍏ヨ繃搴撶殑鐗╁搧淇℃伅銆�
     @DeleteMapping("/del")
-    public ResponseValue updateById(@RequestBody BaseGoodsTemplate goodsTemplate) {
+    public ResponseValue updateById() {
+        BaseGoodsTemplate goodsTemplate = CommonUtil.getObjFromReqBody(BaseGoodsTemplate.class);
+        BaseGoodsTemplate param2 = new BaseGoodsTemplate();
+        CommonUtil.copyProperties(goodsTemplate, param2);
+        goodsTemplate = param2;
+
         if (goodsTemplate.getId() == null) {
             return ResponseValue.error("鐗╁搧id涓虹┖");
         }
@@ -191,7 +216,7 @@
 
     @GetMapping("/query/goodsTemplate")
     public ResponseValue queryGoodsTemplateByCategoryId(Long agencyId, Long categoryId) {
-        List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.queryGoodsTemplateByCategoryId(agencyId, categoryId);
+        List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.queryGoodsTemplateByCategoryId(agencyId, categoryId, null, null);
         if (list == null) {
             return ResponseValue.error("鏌ヨ澶辫触锛�");
         }
@@ -201,12 +226,13 @@
 
     @ApiOperation(value = "鏌ヨ鏈烘瀯涓嬮粯璁や粨搴撲笅鐨勫垎绫绘ā鏉夸俊鎭�", notes = "鏌ヨ鏈烘瀯涓嬮粯璁や粨搴撲笅鐨勫垎绫绘ā鏉夸俊鎭�")
     @ApiImplicitParams({
-        @ApiImplicitParam(name = "agencyId", value = "鐖剁骇鏈烘瀯id", required = true, dataType = "Long", paramType = "query"),
+        @ApiImplicitParam(name = "agencyId", value = "鐖剁骇鏈烘瀯id", required = true, dataType = "java.lang.Long", paramType = "query"),
         @ApiImplicitParam(name = "categoryId", value = "鍒嗙被id", required = true, dataType = "Long", paramType = "query")
     })
     @GetMapping("/query/warehouse/goods")
     public ResponseValue queryWarehouseGoods(Long agencyId, Long categoryId) {
 
+        // TODO 璋冩嫧鏌ヨ浠撳簱鐗╁搧
         Map<String, Object> map = new HashMap<>();
         map.put("categoryId", categoryId);
 
@@ -217,12 +243,13 @@
         }
         map.put("warehouseId", baseWarehouseList.get(0).getId());
 
-        String sql = "SELECT DISTINCT bgt.id,bgt.GOODS_NAME FROM l_wh_goods g LEFT JOIN base_goods_template bgt ON g.BASE_GOODS_TEMPLATE_ID = bgt.id "
-            + "WHERE WAREHOUSE_TYPE = 0 "
-            + "AND WAREHOUSE_ID = :warehouseId "
-            + "AND CATEGORY_ID = :categoryId "
-            // 1:闆嗛噰,2:鑷��璐�
-            + "AND BUY_TYPE =1";
+        String sql =
+            "SELECT DISTINCT bgt.id,bgt.GOODS_NAME, CLASSIFICATION type FROM l_wh_goods g LEFT JOIN base_goods_template bgt ON g.BASE_GOODS_TEMPLATE_ID = bgt.id "
+                + "WHERE WAREHOUSE_TYPE = 0 "
+                + "AND WAREHOUSE_ID = :warehouseId "
+                + "AND CATEGORY_ID = :categoryId "
+                // 1:闆嗛噰,2:鑷噰
+                + "AND BUY_TYPE =1";
 
         List<GoodsTemplateVO> resultList = Lists.newArrayList();
         List<Map<String, Object>> goodsTemplateList = lWhGoodsService.select(sql, map, new MapperUtil());

--
Gitblit v1.9.1