You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
913 B
32 lines
913 B
package com.crm.auth.controller;
|
|
|
|
import com.crm.auth.domain.dto.ResourceNode;
|
|
import com.crm.auth.service.IResourceService;
|
|
import com.crm.base.domain.result.Result;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 统一权限资源树管理端接口(ADR-0011)
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/api/resources")
|
|
@RequiredArgsConstructor
|
|
public class ResourceController {
|
|
|
|
private final IResourceService resourceService;
|
|
|
|
/** 全量资源树(扁平数组,前端按 parentId 组树) */
|
|
@GetMapping
|
|
public Result<List<ResourceNode>> listAll() {
|
|
return Result.success(resourceService.listAll());
|
|
}
|
|
|
|
/** 新增或编辑节点(含校验) */
|
|
@PostMapping
|
|
public Result<ResourceNode> save(@RequestBody ResourceNode node) {
|
|
return Result.success(resourceService.save(node));
|
|
}
|
|
}
|
|
|