1
0
mirror of https://github.com/FatttSnake/Pinnacle-OA.git synced 2026-04-04 22:41:24 +08:00

Optimized GroupController

This commit is contained in:
2023-05-17 15:28:44 +08:00
parent 69d6c03420
commit 11c76b25a4

View File

@@ -32,7 +32,7 @@ public class GroupController {
@GetMapping @GetMapping
public ResponseResult getAllGroup() { public ResponseResult getAllGroup() {
List<Group> groups = groupService.getAllGroup(); List<Group> groups = groupService.getAllGroup();
return ResponseResult.build(ResponseCode.DATABASE_SELECT_OK, "success", groups); return ResponseResult.databaseSelectSuccess(groups);
} }
@PostMapping @PostMapping
@@ -41,7 +41,7 @@ public class GroupController {
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 (groupService.addGroup(group)) { if (groupService.addGroup(group)) {
return ResponseResult.build(ResponseCode.DATABASE_SAVE_OK, "success", null); return ResponseResult.databaseSaveSuccess(group);
} else { } else {
return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null); return ResponseResult.build(ResponseCode.DATABASE_SAVE_ERROR, "error", null);
} }
@@ -52,7 +52,7 @@ public class GroupController {
LambdaQueryWrapper<Group> wrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<Group> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Group::getId, id); wrapper.eq(Group::getId, id);
if (groupService.remove(wrapper)) { if (groupService.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);
} }
@@ -64,7 +64,7 @@ public class GroupController {
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 (groupService.modifyGroup(group)) { if (groupService.modifyGroup(group)) {
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_OK, "success", null); return ResponseResult.databaseUpdateSuccess(group);
} else { } else {
return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null); return ResponseResult.build(ResponseCode.DATABASE_UPDATE_ERROR, "error", null);
} }