mirror of
https://github.com/PlayEdu/PlayEdu
synced 2025-12-21 02:55:38 +08:00
增加系统配置
This commit is contained in:
@@ -1,8 +1,14 @@
|
||||
package xyz.playedu.api.controller.backend;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import xyz.playedu.api.domain.AppConfig;
|
||||
import xyz.playedu.api.request.backend.AppConfigRequest;
|
||||
import xyz.playedu.api.service.AppConfigService;
|
||||
import xyz.playedu.api.types.JsonResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author 杭州白书科技有限公司
|
||||
* @create 2023/3/9 11:14
|
||||
@@ -11,13 +17,18 @@ import xyz.playedu.api.types.JsonResponse;
|
||||
@RequestMapping("/backend/v1/app-config")
|
||||
public class AppConfigController {
|
||||
|
||||
@Autowired
|
||||
private AppConfigService configService;
|
||||
|
||||
@GetMapping("/index")
|
||||
public JsonResponse index() {
|
||||
return JsonResponse.data(null);
|
||||
List<AppConfig> configs = configService.allShow();
|
||||
return JsonResponse.data(configs);
|
||||
}
|
||||
|
||||
@PutMapping("/index")
|
||||
public JsonResponse save() {
|
||||
public JsonResponse save(@RequestBody AppConfigRequest req) {
|
||||
configService.saveFromMap(req.getData());
|
||||
return JsonResponse.data(null);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,6 +43,12 @@ public class DepartmentController {
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
@GetMapping("/departments")
|
||||
public JsonResponse index(@RequestParam(name = "parent_id", defaultValue = "0") Integer parentId) {
|
||||
List<Department> departments = departmentService.listByParentId(parentId);
|
||||
return JsonResponse.data(departments);
|
||||
}
|
||||
|
||||
@BackendPermissionMiddleware(slug = BPermissionConstant.DEPARTMENT_CUD)
|
||||
@GetMapping("/create")
|
||||
public JsonResponse create() {
|
||||
|
||||
@@ -41,6 +41,12 @@ public class ResourceCategoryController {
|
||||
return JsonResponse.data(data);
|
||||
}
|
||||
|
||||
@GetMapping("/categories")
|
||||
public JsonResponse index(@RequestParam(name = "parent_id", defaultValue = "0") Integer parentId) {
|
||||
List<ResourceCategory> categories = categoryService.listByParentId(parentId);
|
||||
return JsonResponse.data(categories);
|
||||
}
|
||||
|
||||
@GetMapping("/create")
|
||||
public JsonResponse create() {
|
||||
Map<Integer, List<ResourceCategory>> categories = categoryService.all().stream().collect(Collectors.groupingBy(ResourceCategory::getParentId));
|
||||
|
||||
Reference in New Issue
Block a user