优化checks

This commit is contained in:
none
2023-03-09 12:00:24 +08:00
parent b0d43447c6
commit 82f0783cb8
11 changed files with 413 additions and 95 deletions

View File

@@ -49,7 +49,7 @@ public class AdminUserController {
return JsonResponse.data(result);
}
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_STORE)
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_CUD)
@GetMapping("/create")
public JsonResponse create() {
List<AdminRole> roles = roleService.list();
@@ -60,7 +60,7 @@ public class AdminUserController {
return JsonResponse.data(data);
}
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_STORE)
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_CUD)
@PostMapping("/create")
public JsonResponse store(@RequestBody @Validated AdminUserRequest req) throws ServiceException {
if (req.getPassword() == null || req.getPassword().length() == 0) {
@@ -72,7 +72,7 @@ public class AdminUserController {
return JsonResponse.success();
}
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_UPDATE)
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_CUD)
@GetMapping("/{id}")
public JsonResponse edit(@PathVariable Integer id) throws NotFoundException {
AdminUser adminUser = adminUserService.findOrFail(id);
@@ -85,7 +85,7 @@ public class AdminUserController {
return JsonResponse.data(data);
}
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_UPDATE)
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_CUD)
@PutMapping("/{id}")
public JsonResponse update(@PathVariable Integer id, @RequestBody @Validated AdminUserRequest req) throws NotFoundException, ServiceException {
AdminUser adminUser = adminUserService.findOrFail(id);
@@ -93,7 +93,7 @@ public class AdminUserController {
return JsonResponse.success();
}
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_DESTROY)
@BackendPermissionMiddleware(slug = BPermissionConstant.ADMIN_USER_CUD)
@DeleteMapping("/{id}")
public JsonResponse destroy(@PathVariable Integer id) {
adminUserService.removeWithRoleIds(id);

View File

@@ -0,0 +1,24 @@
package xyz.playedu.api.controller.backend;
import org.springframework.web.bind.annotation.*;
import xyz.playedu.api.types.JsonResponse;
/**
* @Author 杭州白书科技有限公司
* @create 2023/3/9 11:14
*/
@RestController
@RequestMapping("/backend/v1/app-config")
public class AppConfigController {
@GetMapping("/index")
public JsonResponse index() {
return JsonResponse.data(null);
}
@PutMapping("/index")
public JsonResponse save() {
return JsonResponse.data(null);
}
}

View File

@@ -43,7 +43,7 @@ public class DepartmentController {
return JsonResponse.data(data);
}
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_STORE)
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
@GetMapping("/create")
public JsonResponse create() {
Map<Integer, List<Department>> departments = departmentService.all().stream().collect(Collectors.groupingBy(Department::getParentId));
@@ -54,21 +54,21 @@ public class DepartmentController {
return JsonResponse.data(data);
}
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_STORE)
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
@PostMapping("/create")
public JsonResponse store(@RequestBody @Validated DepartmentRequest req) throws NotFoundException {
departmentService.create(req.getName(), req.getParentId(), req.getSort());
return JsonResponse.success();
}
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_UPDATE)
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
@GetMapping("/{id}")
public JsonResponse edit(@PathVariable Integer id) throws NotFoundException {
Department department = departmentService.findOrFail(id);
return JsonResponse.data(department);
}
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_UPDATE)
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
@PutMapping("/{id}")
public JsonResponse update(@PathVariable Integer id, @RequestBody DepartmentRequest req) throws NotFoundException {
Department department = departmentService.findOrFail(id);
@@ -76,7 +76,7 @@ public class DepartmentController {
return JsonResponse.success();
}
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_DESTROY)
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
@DeleteMapping("/{id}")
public JsonResponse destroy(@PathVariable Integer id) throws NotFoundException {
Department department = departmentService.findOrFail(id);