From c1ac6d13630b04b4e11d6f383858e4f8fa64f924 Mon Sep 17 00:00:00 2001
From: futian.liu <liufutianyoo@163.com>
Date: 星期六, 02 十二月 2023 17:24:34 +0800
Subject: [PATCH] 盘点查询返回结果修改

---
 consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++--------------
 1 files changed, 46 insertions(+), 14 deletions(-)

diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java b/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
index bfb806f..055a230 100644
--- a/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
+++ b/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java
@@ -1,9 +1,10 @@
 package com.consum.base.controller;
 
 import com.consum.base.BaseController;
+import com.consum.base.core.utils.CommonUtil;
 import com.consum.base.pojo.BaseCategoryParam;
 import com.consum.base.pojo.ProjectTreeResult;
-import com.consum.base.service.BaseCategoryServiceImpl;
+import com.consum.base.service.BaseCategoryService;
 import com.consum.base.service.BaseGoodsTemplateServiceImpl;
 import com.consum.model.po.BaseCategory;
 import com.iplatform.model.po.S_user_core;
@@ -11,6 +12,7 @@
 import com.walker.infrastructure.tree.TreeNode;
 import com.walker.infrastructure.utils.StringUtils;
 import com.walker.web.ResponseValue;
+import io.swagger.annotations.Api;
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
@@ -19,7 +21,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;
 
@@ -28,12 +29,13 @@
  * @Author 鍗㈠簡闃�
  * @Date 2023/10/23
  */
+@Api(value = "鐗╁搧鍒嗙被", tags = "鐗╁搧鍒嗙被")
 @RestController
 @RequestMapping("/pc/base/category")
 public class BaseCategoryController extends BaseController {
 
     @Autowired
-    private BaseCategoryServiceImpl baseCategoryService;
+    private BaseCategoryService baseCategoryService;
 
     @Autowired
     private BaseGoodsTemplateServiceImpl baseGoodsTemplateService;
@@ -45,13 +47,13 @@
     private long defaultParentId = 0L;
 
     /**
-     * @Description  鑾峰彇鍒嗙被鏍�
+     * @Description 鑾峰彇鍒嗙被鏍�
      * @Author 鍗㈠簡闃�
      * @Date 2023/10/30
      */
     @GetMapping("/select/tree")
-    public ResponseValue tree(String categoryName) {
-        List<ProjectTreeResult> tree = this.baseCategoryService.tree(categoryName);
+    public ResponseValue trees() {
+        List<ProjectTreeResult> tree = this.baseCategoryService.tree();
         return ResponseValue.success(tree);
     }
 
@@ -61,7 +63,11 @@
      * @Date 2023/10/23
      */
     @PostMapping("/add")
-    public ResponseValue add(@RequestBody BaseCategoryParam param) {
+    public ResponseValue add() {
+        BaseCategoryParam param = CommonUtil.getObjFromReqBody(BaseCategoryParam.class);
+        BaseCategoryParam param2 = new BaseCategoryParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
         if (StringUtils.isEmpty(param.getCategoryName())) {
             return ResponseValue.error("鍒嗙被鍚嶇О涓虹┖");
         }
@@ -75,7 +81,9 @@
         }
 
         int result = this.baseCategoryService.add(param, this.getCurrentUser());
-        if (result > 0) return ResponseValue.success(1);
+        if (result > 0) {
+            return ResponseValue.success(1);
+        }
         return ResponseValue.error("鏂板澶辫触锛�");
     }
 
@@ -85,7 +93,12 @@
      * @Date 2023/10/23
      */
     @GetMapping("/list")
-    public ResponseValue queryBaseCategoryList(BaseCategoryParam param) {
+    public ResponseValue queryBaseCategoryList() {
+        BaseCategoryParam param = CommonUtil.getObjFromReq(BaseCategoryParam.class);
+        BaseCategoryParam param2 = new BaseCategoryParam();
+        CommonUtil.copyProperties(param, param2);
+        param = param2;
+
         S_user_core currentUser = this.getCurrentUser();
         if (currentUser == null) {
             return ResponseValue.error("鐧诲綍鐢ㄦ埛淇℃伅涓嶅瓨鍦�");
@@ -101,7 +114,12 @@
      * @Date 2023/10/23
      */
     @PostMapping("/edit")
-    public ResponseValue edit(@RequestBody BaseCategory baseCategory) {
+    public ResponseValue edit() {
+        BaseCategory baseCategory = CommonUtil.getObjFromReqBody(BaseCategory.class);
+        BaseCategory param2 = new BaseCategory();
+        CommonUtil.copyProperties(baseCategory, param2);
+        baseCategory = param2;
+
         Long id = baseCategory.getId();
         if (id == null || id.longValue() <= 0) {
             return ResponseValue.error("缂栬緫鐨勭墿鍝佸垎绫讳笉瀛樺湪");
@@ -123,12 +141,18 @@
 
     /**
      * 淇敼鐘舵��
+     *
      * @author 鍗㈠簡闃�
      * @date 2023/10/23
      */
     //鍒嗙被涓嬫湁姝e父鐘舵�佺殑鐗╁搧鏃讹紝涓嶅厑璁哥鐢�
     @PostMapping("/updStatus")
-    public ResponseValue updateStatus(@RequestBody BaseCategory baseCategory) {
+    public ResponseValue updateStatus() {
+        BaseCategory baseCategory = CommonUtil.getObjFromReqBody(BaseCategory.class);
+        BaseCategory param2 = new BaseCategory();
+        CommonUtil.copyProperties(baseCategory, param2);
+        baseCategory = param2;
+
         if (baseCategory == null || baseCategory.getId() == null || baseCategory.getStates() == null) {
             return ResponseValue.error("鍙傛暟閿欒");
         }
@@ -148,17 +172,23 @@
      * @Date 2023/10/23
      */
     @DeleteMapping("/del")
-    public ResponseValue updateById(@RequestBody BaseCategory baseCategory) {
+    public ResponseValue updateById() {
+        BaseCategory baseCategory = CommonUtil.getObjFromReqBody(BaseCategory.class);
+        BaseCategory param2 = new BaseCategory();
+        CommonUtil.copyProperties(baseCategory, param2);
+        baseCategory = param2;
+
         if (baseCategory.getId() == null) {
             return ResponseValue.error("鍒嗙被id涓虹┖");
         }
-        int num = this.baseCategoryService.updateById(baseCategory,this.getCurrentUser());
+        int num = this.baseCategoryService.updateById(baseCategory, this.getCurrentUser());
 
         return num > 0 ? ResponseValue.success(1) : ResponseValue.error("鍒犻櫎澶辫触锛�");
     }
 
     /**
      * 鏍规嵁鐗╁搧id鏌ヨ鑺傜偣璇︽儏
+     *
      * @author 鍗㈠簡闃�
      * @Date 2023/10/23
      */
@@ -168,7 +198,9 @@
             return ResponseValue.error("鍒嗙被id涓虹┖");
         }
         BaseCategory baseCategory = this.baseCategoryService.getById(id);
-        if (baseCategory == null) return ResponseValue.error("鏌ヨ澶辫触锛�");
+        if (baseCategory == null) {
+            return ResponseValue.error("鏌ヨ澶辫触锛�");
+        }
         return ResponseValue.success("鏌ヨ鎴愬姛!", baseCategory);
     }
 

--
Gitblit v1.9.1