From 20c30d26f8bab22a4cb6b6459962fa92d6da490f Mon Sep 17 00:00:00 2001
From: cy <1664593601@qq.com>
Date: 星期一, 27 十一月 2023 14:20:29 +0800
Subject: [PATCH] feat: 漏洞修改

---
 consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java |   49 +++++++++++++++++++++++++++++++++++--------------
 1 files changed, 35 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 343c47b..4cea9f8 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,6 +1,7 @@
 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;
@@ -11,17 +12,13 @@
 import com.walker.infrastructure.tree.TreeNode;
 import com.walker.infrastructure.utils.StringUtils;
 import com.walker.web.ResponseValue;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.bind.annotation.*;
+
 import java.util.List;
 import java.util.Map;
 import java.util.TreeMap;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
-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;
 
 /**
  * @Description 鐗╁搧鍒嗙被
@@ -50,7 +47,7 @@
      * @Date 2023/10/30
      */
     @GetMapping("/select/tree")
-    public ResponseValue tree(String categoryName) {
+    public ResponseValue trees() {
         List<ProjectTreeResult> tree = this.baseCategoryService.tree();
         return ResponseValue.success(tree);
     }
@@ -61,7 +58,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("鍒嗙被鍚嶇О涓虹┖");
         }
@@ -87,7 +88,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("鐧诲綍鐢ㄦ埛淇℃伅涓嶅瓨鍦�");
@@ -103,7 +109,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("缂栬緫鐨勭墿鍝佸垎绫讳笉瀛樺湪");
@@ -131,7 +142,12 @@
      */
     //鍒嗙被涓嬫湁姝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("鍙傛暟閿欒");
         }
@@ -151,7 +167,12 @@
      * @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涓虹┖");
         }

--
Gitblit v1.9.1