From 8a2f988be665d1b7379859d846d42e8ee8a5a55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90li?= <15040126243@163.com> Date: Fri, 11 Feb 2022 17:46:36 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E8=BF=94=E5=9B=9E=E4=BD=93=20?= =?UTF-8?q?=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/SysConfigController.java | 2 +- .../system/SysDictDataController.java | 2 +- .../system/SysDictTypeController.java | 2 +- .../system/SysRegisterController.java | 4 +-- .../controller/system/SysUserController.java | 4 +-- .../core/controller/BaseController.java | 32 ++----------------- 6 files changed, 9 insertions(+), 37 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java index 8cbea8eb..2dcb8437 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysConfigController.java @@ -121,7 +121,7 @@ public class SysConfigController extends BaseController { @DeleteMapping("/{configIds}") public R remove(@ApiParam("参数ID串") @PathVariable Long[] configIds) { configService.deleteConfigByIds(configIds); - return success(); + return R.ok(); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java index cf23f861..060e980e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictDataController.java @@ -108,6 +108,6 @@ public class SysDictDataController extends BaseController { @DeleteMapping("/{dictCodes}") public R remove(@ApiParam("字典code串") @PathVariable Long[] dictCodes) { dictDataService.deleteDictDataByIds(dictCodes); - return success(); + return R.ok(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java index 54e31e47..c8ebd49b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java @@ -98,7 +98,7 @@ public class SysDictTypeController extends BaseController { @DeleteMapping("/{dictIds}") public R remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) { dictTypeService.deleteDictTypeByIds(dictIds); - return success(); + return R.ok(); } /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java index c1c79503..6595f06d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysRegisterController.java @@ -31,9 +31,9 @@ public class SysRegisterController extends BaseController { @PostMapping("/register") public R register(@Validated @RequestBody RegisterBody user) { if (!("true".equals(configService.selectConfigByKey("sys.account.registerUser")))) { - return error("当前系统没有开启注册功能!"); + return R.fail("当前系统没有开启注册功能!"); } registerService.register(user); - return success(); + return R.ok(); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java index 18ba4a3b..0c2e9e02 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysUserController.java @@ -170,7 +170,7 @@ public class SysUserController extends BaseController { @DeleteMapping("/{userIds}") public R remove(@ApiParam("角色ID串") @PathVariable Long[] userIds) { if (ArrayUtil.contains(userIds, getUserId())) { - return error("当前用户不能删除"); + return R.fail("当前用户不能删除"); } return toAjax(userService.deleteUserByIds(userIds)); } @@ -231,6 +231,6 @@ public class SysUserController extends BaseController { public R insertAuthRole(Long userId, Long[] roleIds) { userService.checkUserDataScope(userId); userService.insertUserAuth(userId, roleIds); - return success(); + return R.ok(); } } diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java index 611cb156..1e0a5d52 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/core/controller/BaseController.java @@ -8,38 +8,10 @@ import com.ruoyi.common.utils.StringUtils; /** * web层通用数据处理 * - * @author ruoyi + * @author Lion Li */ public class BaseController { - /** - * 返回成功 - */ - public R success() { - return R.ok(); - } - - /** - * 返回失败消息 - */ - public R error() { - return R.fail(); - } - - /** - * 返回成功消息 - */ - public R success(String message) { - return R.ok(message); - } - - /** - * 返回失败消息 - */ - public R error(String message) { - return R.fail(message); - } - /** * 响应返回结果 * @@ -57,7 +29,7 @@ public class BaseController { * @return 操作结果 */ protected R toAjax(boolean result) { - return result ? success() : error(); + return result ? R.ok() : R.fail(); } /**