67 lines
2.1 KiB
Java
67 lines
2.1 KiB
Java
package net.srt.controller;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import net.srt.entity.DatastandardEntity;
|
|
import net.srt.entity.StandardEntity;
|
|
import net.srt.framework.common.utils.BeanUtil;
|
|
import net.srt.framework.common.utils.Result;
|
|
import net.srt.framework.common.utils.TreeNodeVo;
|
|
import net.srt.service.StandardService;
|
|
import net.srt.vo.StandardManagementVo;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @ClassName : StandardController
|
|
* @Description :
|
|
* @Author : FJJ
|
|
* @Date: 2023-12-20 11:30
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/standard-category")
|
|
@Tag(name = "标准管理列表")
|
|
public class StandardController {
|
|
@Autowired
|
|
private StandardService standardService;
|
|
@GetMapping("list-tree")
|
|
@Operation(summary = "查询文件分组树")
|
|
public Result<List<TreeNodeVo>> listTree() {
|
|
return Result.ok(standardService.listTree());
|
|
}
|
|
|
|
|
|
@GetMapping("/{id}")
|
|
@Operation(summary = "根据id获取")
|
|
public Result<TreeNodeVo> getById(@PathVariable Integer id) {
|
|
StandardEntity entity = standardService.getById(id);
|
|
TreeNodeVo nodeVo = BeanUtil.copyProperties(entity, TreeNodeVo::new);
|
|
nodeVo.setLabel(entity.getName());
|
|
nodeVo.setParentPath(entity.getPath().contains("/") ? entity.getPath().substring(0, entity.getPath().lastIndexOf("/")) : null);
|
|
return Result.ok(nodeVo);
|
|
}
|
|
|
|
@PostMapping
|
|
@Operation(summary = "保存")
|
|
public Result<String > save(@RequestBody StandardEntity standardEntity){
|
|
standardService.save1(standardEntity);
|
|
return Result.ok();
|
|
}
|
|
|
|
@PutMapping
|
|
@Operation(summary = "修改")
|
|
public Result<String > update(@RequestBody StandardEntity standardEntity){
|
|
standardService.update1(standardEntity);
|
|
return Result.ok();
|
|
}
|
|
@DeleteMapping("/id")
|
|
@Operation(summary = "删除")
|
|
public Result<String > del(@PathVariable Long id){
|
|
standardService.del(id);
|
|
return Result.ok();
|
|
}
|
|
|
|
}
|