From af6a08398e2bc22f3c8a3a615cbd9e23190be906 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期四, 12 五月 2022 10:55:44 +0800 Subject: [PATCH] update 优化 文件与图片上传组件 使用id存储回显 --- ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysPostController.java | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 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 080ddd3..7e08698 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 @@ -4,7 +4,7 @@ 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.R; import com.ruoyi.common.core.domain.PageQuery; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; @@ -60,8 +60,8 @@ @ApiOperation("鏍规嵁宀椾綅缂栧彿鑾峰彇璇︾粏淇℃伅") @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(@ApiParam("宀椾綅ID") @PathVariable Long postId) { + return R.ok(postService.selectPostById(postId)); } /** @@ -71,11 +71,11 @@ @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)); } @@ -87,11 +87,11 @@ @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)); } @@ -103,7 +103,7 @@ @SaCheckPermission("system:post:remove") @Log(title = "宀椾綅绠$悊", businessType = BusinessType.DELETE) @DeleteMapping("/{postIds}") - public AjaxResult<Void> remove(@ApiParam("宀椾綅ID涓�") @PathVariable Long[] postIds) { + public R<Void> remove(@ApiParam("宀椾綅ID涓�") @PathVariable Long[] postIds) { return toAjax(postService.deletePostByIds(postIds)); } @@ -112,8 +112,8 @@ */ @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