|
8 | 8 | import io.github.talelin.merak.model.UserDO; |
9 | 9 | import io.github.talelin.merak.service.AdminService; |
10 | 10 | import io.github.talelin.merak.service.GroupService; |
11 | | -import io.github.talelin.merak.vo.UnifyResponseVO; |
12 | | -import io.github.talelin.merak.vo.PageResponseVO; |
| 11 | +import io.github.talelin.merak.vo.*; |
13 | 12 | import io.github.talelin.merak.model.GroupDO; |
14 | 13 | import io.github.talelin.merak.dto.admin.*; |
15 | | -import io.github.talelin.merak.vo.UserInfoVO; |
16 | 14 | import org.springframework.beans.factory.annotation.Autowired; |
17 | 15 | import org.springframework.validation.annotation.Validated; |
18 | 16 | import org.springframework.web.bind.annotation.*; |
@@ -65,23 +63,23 @@ public PageResponseVO getUsers( |
65 | 63 |
|
66 | 64 | @PutMapping("/user/{id}/password") |
67 | 65 | @AdminMeta(permission = "修改用户密码", module = "管理员") |
68 | | - public UnifyResponseVO changeUserPassword(@PathVariable @Positive(message = "{id}") Long id, @RequestBody @Validated ResetPasswordDTO validator) { |
| 66 | + public UpdatedVO changeUserPassword(@PathVariable @Positive(message = "{id}") Long id, @RequestBody @Validated ResetPasswordDTO validator) { |
69 | 67 | adminService.changeUserPassword(id, validator); |
70 | | - return ResponseUtil.generateUnifyResponse(4); |
| 68 | + return new UpdatedVO(4); |
71 | 69 | } |
72 | 70 |
|
73 | 71 | @DeleteMapping("/user/{id}") |
74 | 72 | @AdminMeta(permission = "删除用户", module = "管理员") |
75 | | - public UnifyResponseVO deleteUser(@PathVariable @Positive(message = "{id}") Long id) { |
| 73 | + public DeletedVO deleteUser(@PathVariable @Positive(message = "{id}") Long id) { |
76 | 74 | adminService.deleteUser(id); |
77 | | - return ResponseUtil.generateUnifyResponse(5); |
| 75 | + return new DeletedVO(5); |
78 | 76 | } |
79 | 77 |
|
80 | 78 | @PutMapping("/user/{id}") |
81 | 79 | @AdminMeta(permission = "管理员更新用户信息", module = "管理员") |
82 | | - public UnifyResponseVO updateUser(@PathVariable @Positive(message = "{id}") Long id, @RequestBody @Validated UpdateUserInfoDTO validator) { |
| 80 | + public UpdatedVO updateUser(@PathVariable @Positive(message = "{id}") Long id, @RequestBody @Validated UpdateUserInfoDTO validator) { |
83 | 81 | adminService.updateUserInfo(id, validator); |
84 | | - return ResponseUtil.generateUnifyResponse(6); |
| 82 | + return new UpdatedVO(6); |
85 | 83 | } |
86 | 84 |
|
87 | 85 | @GetMapping("/group") |
@@ -111,45 +109,45 @@ public GroupPermissionBO getGroup(@PathVariable @Positive(message = "{id}") Long |
111 | 109 |
|
112 | 110 | @PostMapping("/group") |
113 | 111 | @AdminMeta(permission = "新建权限组", module = "管理员") |
114 | | - public UnifyResponseVO createGroup(@RequestBody @Validated NewGroupDTO validator) { |
| 112 | + public CreatedVO createGroup(@RequestBody @Validated NewGroupDTO validator) { |
115 | 113 | adminService.createGroup(validator); |
116 | | - return ResponseUtil.generateUnifyResponse(15); |
| 114 | + return new CreatedVO(15); |
117 | 115 | } |
118 | 116 |
|
119 | 117 | @PutMapping("/group/{id}") |
120 | 118 | @AdminMeta(permission = "更新一个权限组", module = "管理员") |
121 | | - public UnifyResponseVO updateGroup(@PathVariable @Positive(message = "{id}") Long id, |
| 119 | + public UpdatedVO updateGroup(@PathVariable @Positive(message = "{id}") Long id, |
122 | 120 | @RequestBody @Validated UpdateGroupDTO validator) { |
123 | 121 | adminService.updateGroup(id, validator); |
124 | | - return ResponseUtil.generateUnifyResponse(7); |
| 122 | + return new UpdatedVO(7); |
125 | 123 | } |
126 | 124 |
|
127 | 125 | @DeleteMapping("/group/{id}") |
128 | 126 | @AdminMeta(permission = "删除一个权限组", module = "管理员") |
129 | | - public UnifyResponseVO deleteGroup(@PathVariable @Positive(message = "{id}") Long id) { |
| 127 | + public DeletedVO deleteGroup(@PathVariable @Positive(message = "{id}") Long id) { |
130 | 128 | adminService.deleteGroup(id); |
131 | | - return ResponseUtil.generateUnifyResponse(8); |
| 129 | + return new DeletedVO(8); |
132 | 130 | } |
133 | 131 |
|
134 | 132 | @PostMapping("/permission/dispatch") |
135 | 133 | @AdminMeta(permission = "分配单个权限", module = "管理员") |
136 | | - public UnifyResponseVO dispatchPermission(@RequestBody @Validated DispatchPermissionDTO validator) { |
| 134 | + public CreatedVO dispatchPermission(@RequestBody @Validated DispatchPermissionDTO validator) { |
137 | 135 | adminService.dispatchPermission(validator); |
138 | | - return ResponseUtil.generateUnifyResponse(9); |
| 136 | + return new CreatedVO(9); |
139 | 137 | } |
140 | 138 |
|
141 | 139 | @PostMapping("/permission/dispatch/batch") |
142 | 140 | @AdminMeta(permission = "分配多个权限", module = "管理员") |
143 | | - public UnifyResponseVO dispatchPermissions(@RequestBody @Validated DispatchPermissionsDTO validator) { |
| 141 | + public CreatedVO dispatchPermissions(@RequestBody @Validated DispatchPermissionsDTO validator) { |
144 | 142 | adminService.dispatchPermissions(validator); |
145 | | - return ResponseUtil.generateUnifyResponse(9); |
| 143 | + return new CreatedVO(9); |
146 | 144 | } |
147 | 145 |
|
148 | 146 | @PostMapping("/permission/remove") |
149 | 147 | @AdminMeta(permission = "删除多个权限", module = "管理员") |
150 | | - public UnifyResponseVO removePermissions(@RequestBody @Validated RemovePermissionsDTO validator) { |
| 148 | + public CreatedVO removePermissions(@RequestBody @Validated RemovePermissionsDTO validator) { |
151 | 149 | adminService.removePermissions(validator); |
152 | | - return ResponseUtil.generateUnifyResponse(10); |
| 150 | + return new CreatedVO(10); |
153 | 151 | } |
154 | 152 |
|
155 | 153 | } |
0 commit comments