From 32eb942e25aa366563b7f40b05a382c0c462213c Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 22 七月 2025 10:29:38 +0800
Subject: [PATCH] 修改切面日志功能

---
 se-system/src/main/java/com/terra/system/controller/sys/RoleResController.java |  119 +++++++++++++++++++++--------------------------------------
 1 files changed, 43 insertions(+), 76 deletions(-)

diff --git a/se-system/src/main/java/com/terra/system/controller/sys/RoleResController.java b/se-system/src/main/java/com/terra/system/controller/sys/RoleResController.java
index 28cfc94..40705f9 100644
--- a/se-system/src/main/java/com/terra/system/controller/sys/RoleResController.java
+++ b/se-system/src/main/java/com/terra/system/controller/sys/RoleResController.java
@@ -1,19 +1,20 @@
 package com.terra.system.controller.sys;
 
-import com.terra.system.annotation.SysLog;
-import com.terra.system.controller.all.BaseController;
-import com.terra.system.entity.all.ResponseMsg;
+import com.terra.common.annotation.SysLog;
+import com.terra.common.controller.all.BaseController;
+import com.terra.common.entity.all.ResponseMsg;
 import com.terra.system.entity.sys.RoleResEntity;
 import com.terra.system.entity.sys.UserEntity;
 import com.terra.system.service.all.PermsService;
 import com.terra.system.service.sys.RoleResService;
 import com.terra.system.service.sys.TokenService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Parameters;
 import javax.annotation.Resource;
 
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
@@ -22,7 +23,7 @@
  * 瑙掕壊-璧勬簮
  * @author WWW
  */
-@Api(tags = "杩愮淮绠$悊\\瑙掕壊璧勬簮")
+@Tag(name = "杩愮淮绠$悊\\瑙掕壊璧勬簮")
 @RestController
 @RequestMapping("/roleRes")
 public class RoleResController extends BaseController {
@@ -36,49 +37,27 @@
     PermsService permsService;
 
     @SysLog()
-    @ApiOperation(value = "鏌ヨ璁板綍鏁�")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", required = false, example = "")
+    @Operation(summary = "鏍规嵁瑙掕壊ID鏌ヨ璧勬簮")
+    @Parameters({
+            @Parameter(name = "roleid", description = "瑙掕壊ID", in = ParameterIn.QUERY, example = "1")
     })
-    @GetMapping({"/selectCount"})
-    public ResponseMsg<Integer> selectCount(Integer roleid) {
+    @GetMapping(value = "/selectResByRole")
+    public ResponseMsg<List<RoleResEntity>> selectResByRole(Integer roleid) {
         try {
-            int count = roleResService.selectCount(roleid);
+            List<RoleResEntity> rs = roleResService.selectResByRole(roleid);
 
-            return success(count);
-        } catch (Exception ex) {
-            return fail(ex, -1);
-        }
-    }
-
-    @SysLog()
-    @ApiOperation(value = "鍒嗛〉鏌ヨ")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""),
-            @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"),
-            @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1")
-    })
-    @GetMapping(value = "/selectByPage")
-    public ResponseMsg<List<RoleResEntity>> selectByPage(Integer roleid, Integer pageSize, Integer pageIndex) {
-        try {
-            if (pageSize < 1 || pageIndex < 1) {
-                return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null);
-            }
-
-            List<RoleResEntity> rs = roleResService.selectByPage(roleid, pageSize, pageSize * (pageIndex - 1));
-
-            return success(rs);
+            return success(null == rs ? 0 : rs.size(), rs);
         } catch (Exception ex) {
             return fail(ex, null);
         }
     }
 
     @SysLog()
-    @ApiOperation(value = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "roleid", value = "瑙掕壊ID", dataType = "Integer", paramType = "query", example = ""),
-            @ApiImplicitParam(name = "pageSize", value = "姣忛〉鏉℃暟", dataType = "Integer", paramType = "query", example = "10"),
-            @ApiImplicitParam(name = "pageIndex", value = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", dataType = "Integer", paramType = "query", example = "1")
+    @Operation(summary = "鍒嗛〉鏌ヨ骞惰繑鍥炶褰曟暟")
+    @Parameters({
+            @Parameter(name = "roleid", description = "瑙掕壊ID", in = ParameterIn.QUERY, example = "1"),
+            @Parameter(name = "pageSize", description = "姣忛〉鏉℃暟", in = ParameterIn.QUERY, example = "10"),
+            @Parameter(name = "pageIndex", description = "鍒嗛〉鏁帮紙浠�1寮�濮嬶級", in = ParameterIn.QUERY, example = "1")
     })
     @GetMapping(value = "/selectByPageAndCount")
     public ResponseMsg<List<RoleResEntity>> selectByPageAndCount(Integer roleid, Integer pageSize, Integer pageIndex) {
@@ -86,6 +65,7 @@
             if (pageSize < 1 || pageIndex < 1) {
                 return fail("姣忛〉椤垫暟鎴栧垎椤垫暟灏忎簬1", null);
             }
+
             int count = roleResService.selectCount(roleid);
             if (count == 0) {
                 return success(0, null);
@@ -99,22 +79,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鏌ヨ鎵�鏈�")
-    @GetMapping(value = "/selectAll")
-    public ResponseMsg<List<RoleResEntity>> selectAll() {
-        try {
-            List<RoleResEntity> list = roleResService.selectAll();
-
-            return success(list);
-        } catch (Exception ex) {
-            return fail(ex, null);
-        }
-    }
-
-    @SysLog()
-    @ApiOperation(value = "鏍规嵁ID鏌ヨ")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "ID", dataType = "int", paramType = "query", example = "1")
+    @Operation(summary = "鏍规嵁ID鏌ヨ")
+    @Parameters({
+            @Parameter(name = "id", description = "ID", in = ParameterIn.QUERY, example = "1")
     })
     @GetMapping(value = "/selectById")
     public ResponseMsg<RoleResEntity> selectById(int id) {
@@ -128,9 +95,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鎻掑叆涓�鏉�")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleResEntity", paramType = "body")
+    @Operation(summary = "鎻掑叆涓�鏉�")
+    @Parameters({
+            @Parameter(name = "entity", description = "瀹炰綋绫�")
     })
     @PostMapping(value = "/insert", produces = "application/json; charset=UTF-8")
     public ResponseMsg<Integer> insert(@RequestBody RoleResEntity entity, HttpServletRequest req) {
@@ -150,9 +117,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鎻掑叆澶氭潯")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleResEntity", paramType = "body")
+    @Operation(summary = "鎻掑叆澶氭潯")
+    @Parameters({
+            @Parameter(name = "list", description = "瀹炰綋绫婚泦鍚�")
     })
     @PostMapping(value = "/inserts", produces = "application/json; charset=UTF-8")
     public ResponseMsg<Integer> inserts(@RequestBody List<RoleResEntity> list, HttpServletRequest req) {
@@ -174,9 +141,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鍒犻櫎涓�鏉�")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "ID", dataType = "Integer", paramType = "query", example = "1")
+    @Operation(summary = "鍒犻櫎涓�鏉�")
+    @Parameters({
+            @Parameter(name = "id", description = "ID", in = ParameterIn.QUERY, example = "1")
     })
     @GetMapping(value = "/delete")
     public ResponseMsg<Integer> delete(int id) {
@@ -191,9 +158,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鍒犻櫎澶氭潯")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "ids", value = "ID鏁扮粍", dataType = "Integer", paramType = "query", example = "1,2")
+    @Operation(summary = "鍒犻櫎澶氭潯")
+    @Parameters({
+            @Parameter(name = "ids", description = "ID鏁扮粍", in = ParameterIn.QUERY, example = "1,2")
     })
     @GetMapping(value = "/deletes")
     public ResponseMsg<Integer> deletes(@RequestParam List<Integer> ids) {
@@ -212,9 +179,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鏇存柊涓�鏉�")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "RoleResEntity", paramType = "body")
+    @Operation(summary = "鏇存柊涓�鏉�")
+    @Parameters({
+            @Parameter(name = "entity", description = "瀹炰綋绫�")
     })
     @ResponseBody
     @PostMapping(value = "/update", produces = "application/json; charset=UTF-8")
@@ -235,9 +202,9 @@
     }
 
     @SysLog()
-    @ApiOperation(value = "鏇存柊澶氭潯")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "list", value = "瀹炰綋绫婚泦鍚�", dataType = "RoleResEntity", paramType = "body")
+    @Operation(summary = "鏇存柊澶氭潯")
+    @Parameters({
+            @Parameter(name = "list", description = "瀹炰綋绫婚泦鍚�")
     })
     @ResponseBody
     @PostMapping(value = "/updates", produces = "application/json; charset=UTF-8")

--
Gitblit v1.9.3