update 返回体 统一

feature/model
疯狂的狮子li 3 years ago
parent 83c0b70a2d
commit 8a2f988be6

@ -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();
}
/**

Loading…
Cancel
Save