From 0fc796b90d3f44b81ef30285edb897223df439f7 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期五, 13 一月 2023 23:04:09 +0800
Subject: [PATCH] update 适配 javax.servlet 替换为 jakarta.servlet 更新所有代码 update 适配 ServletUtils 更换继承 JakartaServletUtil

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java |   61 ++++++++++++++----------------
 1 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
index 4f119e4..9a173fe 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java
@@ -1,25 +1,21 @@
 package com.ruoyi.web.controller.system;
 
+import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.constant.UserConstants;
 import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
 import com.ruoyi.common.core.domain.PageQuery;
+import com.ruoyi.common.core.domain.R;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.system.domain.SysPost;
 import com.ruoyi.system.service.ISysPostService;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
 import lombok.RequiredArgsConstructor;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import javax.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -28,8 +24,7 @@
  * @author Lion Li
  */
 @Validated
-@Api(value = "宀椾綅淇℃伅鎺у埗鍣�", tags = {"宀椾綅淇℃伅绠$悊"})
-@RequiredArgsConstructor(onConstructor_ = @Autowired)
+@RequiredArgsConstructor
 @RestController
 @RequestMapping("/system/post")
 public class SysPostController extends BaseController {
@@ -39,16 +34,17 @@
     /**
      * 鑾峰彇宀椾綅鍒楄〃
      */
-    @ApiOperation("鑾峰彇宀椾綅鍒楄〃")
-    @PreAuthorize("@ss.hasPermi('system:post:list')")
+    @SaCheckPermission("system:post:list")
     @GetMapping("/list")
     public TableDataInfo<SysPost> list(SysPost post, PageQuery pageQuery) {
         return postService.selectPagePostList(post, pageQuery);
     }
 
-    @ApiOperation("瀵煎嚭宀椾綅鍒楄〃")
+    /**
+     * 瀵煎嚭宀椾綅鍒楄〃
+     */
     @Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT)
-    @PreAuthorize("@ss.hasPermi('system:post:export')")
+    @SaCheckPermission("system:post:export")
     @PostMapping("/export")
     public void export(SysPost post, HttpServletResponse response) {
         List<SysPost> list = postService.selectPostList(post);
@@ -57,26 +53,26 @@
 
     /**
      * 鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅
+     *
+     * @param postId 宀椾綅ID
      */
-    @ApiOperation("鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅")
-    @PreAuthorize("@ss.hasPermi('system:post:query')")
+    @SaCheckPermission("system:post:query")
     @GetMapping(value = "/{postId}")
-    public AjaxResult<SysPost> getInfo(@ApiParam("宀椾綅ID") @PathVariable Long postId) {
-        return AjaxResult.success(postService.selectPostById(postId));
+    public R<SysPost> getInfo(@PathVariable Long postId) {
+        return R.ok(postService.selectPostById(postId));
     }
 
     /**
      * 鏂板宀椾綅
      */
-    @ApiOperation("鏂板宀椾綅")
-    @PreAuthorize("@ss.hasPermi('system:post:add')")
+    @SaCheckPermission("system:post:add")
     @Log(title = "宀椾綅绠$悊", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult<Void> add(@Validated @RequestBody SysPost post) {
+    public R<Void> add(@Validated @RequestBody SysPost post) {
         if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
-            return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
+            return R.fail("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
         } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
-            return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
+            return R.fail("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
         }
         return toAjax(postService.insertPost(post));
     }
@@ -84,37 +80,36 @@
     /**
      * 淇敼宀椾綅
      */
-    @ApiOperation("淇敼宀椾綅")
-    @PreAuthorize("@ss.hasPermi('system:post:edit')")
+    @SaCheckPermission("system:post:edit")
     @Log(title = "宀椾綅绠$悊", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult<Void> edit(@Validated @RequestBody SysPost post) {
+    public R<Void> edit(@Validated @RequestBody SysPost post) {
         if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
-            return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
+            return R.fail("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
         } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
-            return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
+            return R.fail("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
         }
         return toAjax(postService.updatePost(post));
     }
 
     /**
      * 鍒犻櫎宀椾綅
+     *
+     * @param postIds 宀椾綅ID涓�
      */
-    @ApiOperation("鍒犻櫎宀椾綅")
-    @PreAuthorize("@ss.hasPermi('system:post:remove')")
+    @SaCheckPermission("system:post:remove")
     @Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE)
     @DeleteMapping("/{postIds}")
-    public AjaxResult<Void> remove(@ApiParam("宀椾綅ID涓�") @PathVariable Long[] postIds) {
+    public R<Void> remove(@PathVariable Long[] postIds) {
         return toAjax(postService.deletePostByIds(postIds));
     }
 
     /**
      * 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�
      */
-    @ApiOperation("鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�")
     @GetMapping("/optionselect")
-    public AjaxResult<List<SysPost>> optionselect() {
+    public R<List<SysPost>> optionselect() {
         List<SysPost> posts = postService.selectPostAll();
-        return AjaxResult.success(posts);
+        return R.ok(posts);
     }
 }

--
Gitblit v1.9.3