mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-20 18:45:38 +08:00
优化checks
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user