From 3eeeb27d70ad7d761b1e280d24d717a4ee775a3b Mon Sep 17 00:00:00 2001
From: sxq <812980466@qq.com>
Date: 星期三, 20 十月 2021 11:32:53 +0800
Subject: [PATCH] 集成xxl-job-admin控制台。
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java | 59 +++++++++++++++++++++++++++++------------------------------
1 files changed, 29 insertions(+), 30 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 93d4d46..d90cabe 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
@@ -9,6 +9,9 @@
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 lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -20,58 +23,57 @@
/**
* 宀椾綅淇℃伅鎿嶄綔澶勭悊
*
- * @author ruoyi
+ * @author Lion Li
*/
+@Validated
+@Api(value = "宀椾綅淇℃伅鎺у埗鍣�", tags = {"宀椾綅淇℃伅绠$悊"})
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/system/post")
-public class SysPostController extends BaseController
-{
- @Autowired
- private ISysPostService postService;
+public class SysPostController extends BaseController {
+
+ private final ISysPostService postService;
/**
* 鑾峰彇宀椾綅鍒楄〃
*/
+ @ApiOperation("鑾峰彇宀椾綅鍒楄〃")
@PreAuthorize("@ss.hasPermi('system:post:list')")
@GetMapping("/list")
- public TableDataInfo list(SysPost post)
- {
+ public TableDataInfo<SysPost> list(SysPost post) {
return postService.selectPagePostList(post);
}
+ @ApiOperation("瀵煎嚭宀椾綅鍒楄〃")
@Log(title = "宀椾綅绠$悊", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('system:post:export')")
@GetMapping("/export")
- public void export(SysPost post, HttpServletResponse response)
- {
+ public void export(SysPost post, HttpServletResponse response) {
List<SysPost> list = postService.selectPostList(post);
- ExcelUtil.exportExcel(list, "宀椾綅鏁版嵁", SysPost.class, response);
+ ExcelUtil.exportExcel(list, "宀椾綅鏁版嵁", SysPost.class, response);
}
/**
* 鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅
*/
+ @ApiOperation("鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅")
@PreAuthorize("@ss.hasPermi('system:post:query')")
@GetMapping(value = "/{postId}")
- public AjaxResult getInfo(@PathVariable Long postId)
- {
+ public AjaxResult<SysPost> getInfo(@PathVariable Long postId) {
return AjaxResult.success(postService.selectPostById(postId));
}
/**
* 鏂板宀椾綅
*/
+ @ApiOperation("鏂板宀椾綅")
@PreAuthorize("@ss.hasPermi('system:post:add')")
@Log(title = "宀椾綅绠$悊", businessType = BusinessType.INSERT)
@PostMapping
- public AjaxResult add(@Validated @RequestBody SysPost post)
- {
- if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
- {
+ public AjaxResult<Void> add(@Validated @RequestBody SysPost post) {
+ if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
- }
- else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
- {
+ } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
return AjaxResult.error("鏂板宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
}
post.setCreateBy(getUsername());
@@ -81,17 +83,14 @@
/**
* 淇敼宀椾綅
*/
+ @ApiOperation("淇敼宀椾綅")
@PreAuthorize("@ss.hasPermi('system:post:edit')")
@Log(title = "宀椾綅绠$悊", businessType = BusinessType.UPDATE)
@PutMapping
- public AjaxResult edit(@Validated @RequestBody SysPost post)
- {
- if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
- {
+ public AjaxResult<Void> edit(@Validated @RequestBody SysPost post) {
+ if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶅悕绉板凡瀛樺湪");
- }
- else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
- {
+ } else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
return AjaxResult.error("淇敼宀椾綅'" + post.getPostName() + "'澶辫触锛屽矖浣嶇紪鐮佸凡瀛樺湪");
}
post.setUpdateBy(getUsername());
@@ -101,20 +100,20 @@
/**
* 鍒犻櫎宀椾綅
*/
+ @ApiOperation("鍒犻櫎宀椾綅")
@PreAuthorize("@ss.hasPermi('system:post:remove')")
@Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
- public AjaxResult remove(@PathVariable Long[] postIds)
- {
+ public AjaxResult<Void> remove(@PathVariable Long[] postIds) {
return toAjax(postService.deletePostByIds(postIds));
}
/**
* 鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�
*/
+ @ApiOperation("鑾峰彇宀椾綅閫夋嫨妗嗗垪琛�")
@GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
+ public AjaxResult<List<SysPost>> optionselect() {
List<SysPost> posts = postService.selectPostAll();
return AjaxResult.success(posts);
}
--
Gitblit v1.9.3