增加系统配置

This commit is contained in:
none
2023-03-09 16:19:43 +08:00
parent ddc4693b10
commit c85467f62f
6 changed files with 86 additions and 6 deletions

View File

@@ -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);
}

View File

@@ -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() {

View File

@@ -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));