91 lines
2.8 KiB
Java
91 lines
2.8 KiB
Java
package net.srt.controller;
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import lombok.AllArgsConstructor;
|
|
import net.srt.framework.common.cache.bean.Neo4jInfo;
|
|
import net.srt.framework.common.utils.Result;
|
|
import net.srt.framework.common.utils.TreeNodeVo;
|
|
import net.srt.service.MetadataService;
|
|
import net.srt.vo.MetadataVO;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.validation.Valid;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequestMapping("metadata")
|
|
@Tag(name = "数据治理-元数据")
|
|
@AllArgsConstructor
|
|
public class MetadataController {
|
|
private final MetadataService metadataService;
|
|
|
|
@GetMapping("/list-child")
|
|
@Operation(summary = "根据父级id获取信息")
|
|
public Result<List<TreeNodeVo>> listByParentId(@RequestParam Long parentId){
|
|
List<TreeNodeVo> treeNodeVos = metadataService.listByParentId(parentId);
|
|
return Result.ok(treeNodeVos);
|
|
}
|
|
|
|
@GetMapping("/list-floder")
|
|
@Operation(summary = "获取目录树")
|
|
public Result<List<TreeNodeVo>> listFloder(){
|
|
List<TreeNodeVo> treeNodeVos = metadataService.listFloder();
|
|
return Result.ok(treeNodeVos);
|
|
}
|
|
|
|
@GetMapping("/list-db")
|
|
@Operation(summary = "获取库表目录树")
|
|
public Result<List<TreeNodeVo>> listDb(){
|
|
List<TreeNodeVo> treeNodeVos = metadataService.listDb();
|
|
return Result.ok(treeNodeVos);
|
|
}
|
|
|
|
@GetMapping("/list-keyword")
|
|
@Operation(summary = "模糊查询")
|
|
public Result<List<TreeNodeVo>> listByKeyword(String keyword){
|
|
List<TreeNodeVo> treeNodeVos = metadataService.listByKeyword(keyword);
|
|
return Result.ok(treeNodeVos);
|
|
}
|
|
|
|
@GetMapping("{id}")
|
|
@Operation(summary = "信息")
|
|
public Result<MetadataVO> get(@PathVariable("id") Long id){
|
|
return Result.ok(metadataService.get(id));
|
|
}
|
|
|
|
@PostMapping
|
|
@Operation(summary = "保存")
|
|
public Result<String> save(@RequestBody MetadataVO vo){
|
|
metadataService.save(vo);
|
|
return Result.ok();
|
|
}
|
|
|
|
@PutMapping
|
|
@Operation(summary = "修改")
|
|
public Result<String> update(@RequestBody @Valid MetadataVO vo) {
|
|
metadataService.update(vo);
|
|
return Result.ok();
|
|
}
|
|
|
|
@DeleteMapping("{id}")
|
|
@Operation(summary = "删除")
|
|
public Result<String> delete(@PathVariable Long id) {
|
|
metadataService.delete(id);
|
|
return Result.ok();
|
|
}
|
|
|
|
@PostMapping("/neo4j")
|
|
@Operation(summary = "更新neo4j的url")
|
|
public Result<String> upNeo4jInfo(@RequestBody Neo4jInfo neo4jInfo){
|
|
metadataService.upNeo4jInfo(neo4jInfo);
|
|
return Result.ok();
|
|
}
|
|
|
|
@GetMapping("/neo4j")
|
|
@Operation(summary = "获取neo4j的url")
|
|
public Result<Neo4jInfo> getNeo4jInfo(){
|
|
return Result.ok(metadataService.getNeo4jInfo());
|
|
}
|
|
}
|