mirror of
https://github.com/FatttSnake/Pinnacle-OA.git
synced 2026-04-04 22:41:24 +08:00
Optimized RoleController
This commit is contained in:
@@ -33,7 +33,7 @@ public class RoleController {
|
|||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseResult getAllRole() {
|
public ResponseResult getAllRole() {
|
||||||
List<Role> roles = roleService.getAllRole();
|
List<Role> roles = roleService.getAllRole();
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", roles);
|
return ResponseResult.databaseSelectSuccess(roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
@@ -42,7 +42,7 @@ public class RoleController {
|
|||||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "Name cannot be empty", null);
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "Name cannot be empty", null);
|
||||||
}
|
}
|
||||||
if (roleService.addRole(role)) {
|
if (roleService.addRole(role)) {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", null);
|
return ResponseResult.databaseSaveSuccess(role);
|
||||||
} else {
|
} else {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null);
|
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null);
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ public class RoleController {
|
|||||||
LambdaQueryWrapper<Role> wrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<Role> wrapper = new LambdaQueryWrapper<>();
|
||||||
wrapper.eq(Role::getId, id);
|
wrapper.eq(Role::getId, id);
|
||||||
if (roleService.remove(wrapper)) {
|
if (roleService.remove(wrapper)) {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_OK, "success", null);
|
return ResponseResult.databaseDeleteSuccess();
|
||||||
} else {
|
} else {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
return ResponseResult.build(ResponseCode.DATABASE_DELETE_ERROR, "error", null);
|
||||||
}
|
}
|
||||||
@@ -65,7 +65,7 @@ public class RoleController {
|
|||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Name cannot be empty", null);
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "Name cannot be empty", null);
|
||||||
}
|
}
|
||||||
if (roleService.modifyRole(role)) {
|
if (roleService.modifyRole(role)) {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", null);
|
return ResponseResult.databaseUpdateSuccess(role);
|
||||||
} else {
|
} else {
|
||||||
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
|
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user