mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 16:23:42 +08:00 
			
		
		
		
	update 返回体 统一
This commit is contained in:
		@@ -121,7 +121,7 @@ public class SysConfigController extends BaseController {
 | 
			
		||||
    @DeleteMapping("/{configIds}")
 | 
			
		||||
    public R<Void> remove(@ApiParam("参数ID串") @PathVariable Long[] configIds) {
 | 
			
		||||
        configService.deleteConfigByIds(configIds);
 | 
			
		||||
        return success();
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -108,6 +108,6 @@ public class SysDictDataController extends BaseController {
 | 
			
		||||
    @DeleteMapping("/{dictCodes}")
 | 
			
		||||
    public R<Void> remove(@ApiParam("字典code串") @PathVariable Long[] dictCodes) {
 | 
			
		||||
        dictDataService.deleteDictDataByIds(dictCodes);
 | 
			
		||||
        return success();
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -98,7 +98,7 @@ public class SysDictTypeController extends BaseController {
 | 
			
		||||
    @DeleteMapping("/{dictIds}")
 | 
			
		||||
    public R<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) {
 | 
			
		||||
        dictTypeService.deleteDictTypeByIds(dictIds);
 | 
			
		||||
        return success();
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -31,9 +31,9 @@ public class SysRegisterController extends BaseController {
 | 
			
		||||
    @PostMapping("/register")
 | 
			
		||||
    public R<Void> 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();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -170,7 +170,7 @@ public class SysUserController extends BaseController {
 | 
			
		||||
    @DeleteMapping("/{userIds}")
 | 
			
		||||
    public R<Void> 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<Void> insertAuthRole(Long userId, Long[] roleIds) {
 | 
			
		||||
        userService.checkUserDataScope(userId);
 | 
			
		||||
        userService.insertUserAuth(userId, roleIds);
 | 
			
		||||
        return success();
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -8,38 +8,10 @@ import com.ruoyi.common.utils.StringUtils;
 | 
			
		||||
/**
 | 
			
		||||
 * web层通用数据处理
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
public class BaseController {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回成功
 | 
			
		||||
     */
 | 
			
		||||
    public R<Void> success() {
 | 
			
		||||
        return R.ok();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回失败消息
 | 
			
		||||
     */
 | 
			
		||||
    public R<Void> error() {
 | 
			
		||||
        return R.fail();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回成功消息
 | 
			
		||||
     */
 | 
			
		||||
    public R<Void> success(String message) {
 | 
			
		||||
        return R.ok(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 返回失败消息
 | 
			
		||||
     */
 | 
			
		||||
    public R<Void> error(String message) {
 | 
			
		||||
        return R.fail(message);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 响应返回结果
 | 
			
		||||
     *
 | 
			
		||||
@@ -57,7 +29,7 @@ public class BaseController {
 | 
			
		||||
     * @return 操作结果
 | 
			
		||||
     */
 | 
			
		||||
    protected R<Void> toAjax(boolean result) {
 | 
			
		||||
        return result ? success() : error();
 | 
			
		||||
        return result ? R.ok() : R.fail();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user