最新一版7.0
parent
78264f9ace
commit
5b31d7a006
|
@ -1,10 +1,15 @@
|
||||||
package net.srt.controller;
|
package net.srt.controller;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.service.MetadataService;
|
import net.srt.service.MetadataService;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import net.srt.vo.MetadataVO;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("metadata")
|
@RequestMapping("metadata")
|
||||||
|
@ -12,4 +17,45 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MetadataController {
|
public class MetadataController {
|
||||||
private final MetadataService metadataService;
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
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.utils.Result;
|
||||||
|
import net.srt.service.MetadataPropertyService;
|
||||||
|
import net.srt.vo.MetadataPropertyVo;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("metadata-property")
|
||||||
|
@Tag(name = "数据治理-元数据属性值")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetadataPropertyController {
|
||||||
|
private final MetadataPropertyService metadataPropertyService;
|
||||||
|
|
||||||
|
@GetMapping("{id}")
|
||||||
|
@Operation(summary = "信息")
|
||||||
|
public Result<MetadataPropertyVo> get(@PathVariable("id") Long id) {
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataDto;
|
||||||
|
import net.srt.entity.MetadataEntity;
|
||||||
|
import net.srt.vo.MetadataVO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MetadataConvert {
|
||||||
|
MetadataConvert INSTANCE = Mappers.getMapper(MetadataConvert.class);
|
||||||
|
|
||||||
|
MetadataEntity convert(MetadataVO vo);
|
||||||
|
|
||||||
|
MetadataEntity convert(DataGovernanceMetadataDto dto);
|
||||||
|
|
||||||
|
MetadataVO convert(MetadataEntity entity);
|
||||||
|
|
||||||
|
DataGovernanceMetadataDto convertDto(MetadataEntity entity);
|
||||||
|
|
||||||
|
List<MetadataVO> convertList(List<MetadataEntity> list);
|
||||||
|
|
||||||
|
List<DataGovernanceMetadataDto> convertDtoList(List<MetadataEntity> list);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package net.srt.dao;
|
||||||
|
|
||||||
|
import net.srt.entity.MetadataPropertyEntity;
|
||||||
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
|
import net.srt.vo.MetamodelPropertyVO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MetadataPropertyDao extends BaseDao<MetadataPropertyEntity> {
|
||||||
|
List<MetamodelPropertyVO> listPropertyById(@Param("id") Long id, @Param("metamodelId") Long metamodelId);
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Data
|
||||||
|
@TableName("data_governance_metadata_property")
|
||||||
|
public class MetadataPropertyEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性id
|
||||||
|
*/
|
||||||
|
private Long metamodelPropertyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 元数据id
|
||||||
|
*/
|
||||||
|
private Long metadataId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性值
|
||||||
|
*/
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id(租户id)
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,7 @@
|
||||||
|
package net.srt.service;
|
||||||
|
|
||||||
|
import net.srt.entity.MetadataPropertyEntity;
|
||||||
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
|
||||||
|
public interface MetadataPropertyService extends BaseService<MetadataPropertyEntity> {
|
||||||
|
}
|
|
@ -1,7 +1,24 @@
|
||||||
package net.srt.service;
|
package net.srt.service;
|
||||||
|
|
||||||
import net.srt.entity.MetadataEntity;
|
import net.srt.entity.MetadataEntity;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.framework.mybatis.service.BaseService;
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.vo.MetadataVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public interface MetadataService extends BaseService<MetadataEntity> {
|
public interface MetadataService extends BaseService<MetadataEntity> {
|
||||||
|
List<TreeNodeVo> listByParentId(Long parentId);
|
||||||
|
|
||||||
|
List<TreeNodeVo> listFloder();
|
||||||
|
|
||||||
|
List<TreeNodeVo> listDb();
|
||||||
|
|
||||||
|
List<TreeNodeVo> listByKeyword(String keyword);
|
||||||
|
|
||||||
|
MetadataVO get(Long id);
|
||||||
|
|
||||||
|
void save(MetadataVO vo);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.dao.MetadataPropertyDao;
|
||||||
|
import net.srt.entity.MetadataPropertyEntity;
|
||||||
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
|
import net.srt.service.MetadataPropertyService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetadataPropertyServiceImpl extends BaseServiceImpl<MetadataPropertyDao, MetadataPropertyEntity> implements MetadataPropertyService {
|
||||||
|
}
|
|
@ -1,12 +1,197 @@
|
||||||
package net.srt.service.impl;
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.servers.Server;
|
import io.swagger.v3.oas.annotations.servers.Server;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.api.module.data.governance.constant.BuiltInMetamodel;
|
||||||
|
import net.srt.convert.MetadataConvert;
|
||||||
import net.srt.dao.MetadataDao;
|
import net.srt.dao.MetadataDao;
|
||||||
|
import net.srt.dao.MetadataPropertyDao;
|
||||||
import net.srt.entity.MetadataEntity;
|
import net.srt.entity.MetadataEntity;
|
||||||
|
import net.srt.entity.MetadataPropertyEntity;
|
||||||
|
import net.srt.framework.common.utils.BeanUtil;
|
||||||
|
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.framework.common.utils.TreeNodeVo;
|
||||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
import net.srt.service.MetadataService;
|
import net.srt.service.MetadataService;
|
||||||
|
import net.srt.vo.MetadataVO;
|
||||||
|
import net.srt.vo.MetamodelPropertyVO;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Server
|
@Server
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEntity> implements MetadataService {
|
public class MetadataServiceImpl extends BaseServiceImpl<MetadataDao, MetadataEntity> implements MetadataService {
|
||||||
|
|
||||||
|
private final MetadataDao metadataDao;
|
||||||
|
private final MetadataPropertyDao metadataPropertyDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeNodeVo> listByParentId(Long parentId) {
|
||||||
|
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(MetadataEntity::getParentId,parentId)
|
||||||
|
.orderByAsc(MetadataEntity::getOrderNo);
|
||||||
|
dataScopeWithOrgId(wrapper);
|
||||||
|
List<MetadataEntity> metadataEntities = baseMapper.selectList(wrapper);
|
||||||
|
return BeanUtil.copyListProperties(metadataEntities,TreeNodeVo::new, (oldItem, newItem) ->{
|
||||||
|
newItem.setLabel(oldItem.getName());
|
||||||
|
newItem.setValue(oldItem.getId());
|
||||||
|
newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
||||||
|
if(newItem.getPath().contains("/")){
|
||||||
|
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeNodeVo> listFloder() {
|
||||||
|
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(MetadataEntity::getIfLeaf,1)
|
||||||
|
.orderByAsc(MetadataEntity::getOrderNo)
|
||||||
|
.orderByAsc(MetadataEntity::getId);
|
||||||
|
dataScopeWithOrgId(wrapper);
|
||||||
|
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||||
|
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas, TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
|
newItem.setLabel(oldItem.getName());
|
||||||
|
newItem.setValue(oldItem.getId());
|
||||||
|
if (newItem.getPath().contains("/")) {
|
||||||
|
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeNodeVo> listDb() {
|
||||||
|
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.in(MetadataEntity::getMetamodelId,BuiltInMetamodel.SCHEMA.getId(),BuiltInMetamodel.TABLE.getId())
|
||||||
|
.or()
|
||||||
|
.isNull(MetadataEntity::getMetamodelId)
|
||||||
|
.orderByAsc(MetadataEntity::getOrderNo);
|
||||||
|
dataScopeWithOrgId(wrapper);
|
||||||
|
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||||
|
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(metadatas,TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
|
newItem.setLabel(oldItem.getName());
|
||||||
|
newItem.setValue(oldItem.getId());
|
||||||
|
newItem.setDisabled(!BuiltInMetamodel.TABLE.getId().equals(oldItem.getMetamodelId()));
|
||||||
|
if(newItem.getPath().contains("/")) {
|
||||||
|
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TreeNodeVo> listByKeyword(String keyword) {
|
||||||
|
if(StringUtil.isBlank(keyword)){
|
||||||
|
return listByParentId(0L);
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<MetadataEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.like(MetadataEntity::getName,keyword)
|
||||||
|
.or()
|
||||||
|
.like(MetadataEntity::getCode,keyword)
|
||||||
|
.orderByAsc(MetadataEntity::getOrderNo)
|
||||||
|
.orderByAsc(MetadataEntity::getId);
|
||||||
|
dataScopeWithOrgId(wrapper);
|
||||||
|
List<MetadataEntity> metadatas = baseMapper.selectList(wrapper);
|
||||||
|
List<MetadataEntity> resultList = new ArrayList<>();
|
||||||
|
//递归获取父级
|
||||||
|
for (MetadataEntity metadata : metadatas) {
|
||||||
|
recursionAddParent(metadata,resultList);
|
||||||
|
}
|
||||||
|
List<MetadataEntity> result = resultList.stream().sorted(Comparator.comparing(MetadataEntity::getOrderNo)).collect(Collectors.toList());
|
||||||
|
List<TreeNodeVo> treeNodeVos = BeanUtil.copyListProperties(result ,TreeNodeVo::new, (oldItem, newItem) -> {
|
||||||
|
newItem.setLabel(oldItem.getName());
|
||||||
|
newItem.setValue(oldItem.getId());
|
||||||
|
newItem.setLeaf(BuiltInMetamodel.COLUMN.getId().equals(oldItem.getMetamodelId()));
|
||||||
|
if(newItem.getPath().contains("/")) {
|
||||||
|
newItem.setParentPath(newItem.getPath().substring(0,newItem.getPath().lastIndexOf("/")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public MetadataVO get(Long id) {
|
||||||
|
MetadataEntity metadataEntity = getById(id);
|
||||||
|
MetadataVO metadataVO = MetadataConvert.INSTANCE.convert(metadataEntity);
|
||||||
|
metadataVO.setProperties(metadataPropertyDao.listPropertyById(id,metadataEntity.getMetamodelId()));
|
||||||
|
return metadataVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(MetadataVO vo) {
|
||||||
|
MetadataEntity entity = MetadataConvert.INSTANCE.convert(vo);
|
||||||
|
entity.setProjectId(getProjectId());
|
||||||
|
entity.setPath(recursionPath(entity,null));
|
||||||
|
buildField(entity);
|
||||||
|
MetadataEntity parentMetadata = baseMapper.selectById(vo.getParentId());
|
||||||
|
if(parentMetadata != null) {
|
||||||
|
entity.setDbType(parentMetadata.getDbType());
|
||||||
|
entity.setDatasourceId(parentMetadata.getDatasourceId());
|
||||||
|
entity.setCollectTaskId(parentMetadata.getCollectTaskId());
|
||||||
|
}
|
||||||
|
baseMapper.insert(entity);
|
||||||
|
buildProperties(entity,vo.getProperties());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void recursionAddParent(MetadataEntity metadataEntity, List<MetadataEntity> resultList){
|
||||||
|
if(resultList.stream().noneMatch(item -> metadataEntity.getId().equals(item.getId()))) {
|
||||||
|
resultList.add(metadataEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(metadataEntity.getParentId()!=0){
|
||||||
|
MetadataEntity parent = getById(metadataEntity.getParentId());
|
||||||
|
recursionAddParent(parent,resultList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildField(MetadataEntity entity){
|
||||||
|
if(entity.getMetamodelId()!=null){
|
||||||
|
entity.setIcon(metadataDao.selectById(entity.getMetamodelId()).getIcon());
|
||||||
|
}
|
||||||
|
if(entity.getIfLeaf() == 1 && entity.getMetamodelId() == null) {
|
||||||
|
entity.setIcon("/src/assets/folder.png");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String recursionPath(MetadataEntity metadataEntity, String path) {
|
||||||
|
if(StringUtil.isBlank(path)){
|
||||||
|
path = metadataEntity.getName();
|
||||||
|
}
|
||||||
|
if(metadataEntity.getParentId()!=0){
|
||||||
|
MetadataEntity parent = getById(metadataEntity.getParentId());
|
||||||
|
path = parent.getName() + "/" +path;
|
||||||
|
return recursionPath(parent,path);
|
||||||
|
}
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void buildProperties(MetadataEntity entity, List<MetamodelPropertyVO> properties){
|
||||||
|
if(!CollectionUtils.isEmpty(properties)){
|
||||||
|
LambdaQueryWrapper<MetadataPropertyEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(MetadataPropertyEntity::getMetadataId,entity.getId());
|
||||||
|
for (MetamodelPropertyVO property : properties) {
|
||||||
|
MetadataPropertyEntity metadataPropertyEntity = new MetadataPropertyEntity();
|
||||||
|
metadataPropertyEntity.setMetamodelPropertyId(property.getId());
|
||||||
|
metadataPropertyEntity.setMetadataId(entity.getId());
|
||||||
|
metadataPropertyEntity.setProperty(property.getValue());
|
||||||
|
metadataPropertyEntity.setProjectId(entity.getProjectId());
|
||||||
|
if(property.getMetadataPropertyId()!=null){
|
||||||
|
metadataPropertyEntity.setId(property.getMetadataPropertyId());
|
||||||
|
metadataPropertyDao.updateById(metadataPropertyEntity);
|
||||||
|
}else {
|
||||||
|
metadataPropertyDao.insert(metadataPropertyEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,80 @@
|
||||||
|
package net.srt.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import net.srt.framework.common.utils.DateUtils;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "数据治理-元数据")
|
||||||
|
public class MetadataVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "父级id(默认0为顶级)")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "树状节点的路径")
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
@Schema(description = "节点名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "节点英文名称")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String icon;
|
||||||
|
|
||||||
|
private Integer ifLeaf;
|
||||||
|
|
||||||
|
@Schema(description = "对应的元模型id")
|
||||||
|
private Long metamodelId;
|
||||||
|
|
||||||
|
@Schema(description = "详情")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "数据库类型(1-数据库 2-中台库)")
|
||||||
|
private Integer dbType;
|
||||||
|
|
||||||
|
@Schema(description = "如果是外部系统接入的库表,需要此字段")
|
||||||
|
private Long datasourceId;
|
||||||
|
|
||||||
|
@Schema(description = "采集任务id")
|
||||||
|
private Long collectTaskId;
|
||||||
|
|
||||||
|
@Schema(description = "项目id(租户id)")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
private Integer orderNo;
|
||||||
|
|
||||||
|
@Schema(description = "版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||||
|
private Integer deleted;
|
||||||
|
|
||||||
|
@Schema(description = "创建者")
|
||||||
|
private Long creator;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@Schema(description = "更新者")
|
||||||
|
private Long updater;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
@Schema(description = "元数据属性列表")
|
||||||
|
private List<MetamodelPropertyVO> properties;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper
|
||||||
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="net.srt.dao.MetadataPropertyDao">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="listPropertyById" resultType="net.srt.vo.MetamodelPropertyVO">
|
||||||
|
SELECT
|
||||||
|
mo.id,
|
||||||
|
mo.metamodel_id,
|
||||||
|
mo.id AS metamodel_property_id,
|
||||||
|
mo.NAME,
|
||||||
|
mo.CODE,
|
||||||
|
mo.data_type,
|
||||||
|
mo.data_length,
|
||||||
|
mo.input_type,
|
||||||
|
mo.nullable,
|
||||||
|
mo.builtin,
|
||||||
|
md.id AS metadata_property_id,
|
||||||
|
md.property AS `value`
|
||||||
|
FROM
|
||||||
|
data_governance_metamodel_property mo
|
||||||
|
LEFT JOIN data_governance_metadata_property md ON mo.id = md.metamodel_property_id
|
||||||
|
AND md.metadata_id = #{id}
|
||||||
|
|
||||||
|
WHERE
|
||||||
|
mo.metamodel_id = #{metamodelId} AND mo.deleted=0 AND md.deleted=0 order by mo.order_no
|
||||||
|
</select>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue