最新一版3.0
parent
1864500899
commit
52ef1fa578
|
@ -0,0 +1,66 @@
|
||||||
|
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.convert.MetamodelPropertyConvert;
|
||||||
|
import net.srt.entity.MetamodelPropertyEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
|
import net.srt.query.MetamodelpropertyQuery;
|
||||||
|
import net.srt.service.MetamodelPropertyService;
|
||||||
|
import net.srt.vo.MetamodelPropertyVO;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("metamodel-property")
|
||||||
|
@Tag(name = "数据治理-元模型属性")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class MetamodelPropertyController {
|
||||||
|
private final MetamodelPropertyService metamodelPropertyService;
|
||||||
|
|
||||||
|
@GetMapping("/properties/{metaModelId}")
|
||||||
|
@Operation(summary = "根据id获取属性列表")
|
||||||
|
public Result<List<MetamodelPropertyVO>> properties(@PathVariable Long id){
|
||||||
|
List<MetamodelPropertyVO> properties = metamodelPropertyService.properties(id);
|
||||||
|
return Result.ok(properties);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("page")
|
||||||
|
@Operation(summary = "分页")
|
||||||
|
public Result<PageResult<MetamodelPropertyVO>> page(@Valid MetamodelpropertyQuery query){
|
||||||
|
PageResult<MetamodelPropertyVO> page = metamodelPropertyService.page(query);
|
||||||
|
return Result.ok(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
@Operation(summary = "信息")
|
||||||
|
public Result<MetamodelPropertyVO> get(@PathVariable("id") Long id){
|
||||||
|
MetamodelPropertyEntity entity = metamodelPropertyService.getById(id);
|
||||||
|
return Result.ok(MetamodelPropertyConvert.INSTANCE.convert(entity));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@Operation(summary = "保存")
|
||||||
|
public Result<String> save(@RequestBody MetamodelPropertyVO vo){
|
||||||
|
metamodelPropertyService.save(vo);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping
|
||||||
|
@Operation(summary = "修改")
|
||||||
|
public Result<String> update(@RequestBody MetamodelPropertyVO vo){
|
||||||
|
metamodelPropertyService.update(vo);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping
|
||||||
|
@Operation(summary = "删除")
|
||||||
|
public Result<String> delete(@RequestBody List<Long> idList){
|
||||||
|
metamodelPropertyService.delete(idList);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.entity.MetamodelPropertyEntity;
|
||||||
|
import net.srt.vo.MetamodelPropertyVO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MetamodelPropertyConvert {
|
||||||
|
MetamodelPropertyConvert INSTANCE = Mappers.getMapper(MetamodelPropertyConvert.class);
|
||||||
|
|
||||||
|
MetamodelPropertyEntity convert(MetamodelPropertyVO vo);
|
||||||
|
|
||||||
|
MetamodelPropertyVO convert(MetamodelPropertyEntity entity);
|
||||||
|
|
||||||
|
List<MetamodelPropertyVO> convertList(List<MetamodelPropertyEntity> list);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,9 @@
|
||||||
|
package net.srt.dao;
|
||||||
|
|
||||||
|
import net.srt.entity.MetamodelPropertyEntity;
|
||||||
|
import net.srt.framework.mybatis.dao.BaseDao;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MetamodelPropertyDao extends BaseDao<MetamodelPropertyEntity> {
|
||||||
|
}
|
|
@ -0,0 +1,70 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Data
|
||||||
|
@TableName("data_governance_metamodel_property")
|
||||||
|
public class MetamodelPropertyEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 元模型id
|
||||||
|
*/
|
||||||
|
private Integer metamodelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 属性代码
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型 1-数字 2-字符串
|
||||||
|
*/
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据长度
|
||||||
|
*/
|
||||||
|
private Integer dataLength;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 输入控件,1-文本框
|
||||||
|
*/
|
||||||
|
private Integer inputType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 允许为空 0-否 1-是
|
||||||
|
*/
|
||||||
|
private Integer nullable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否内置 0-否 1-是
|
||||||
|
*/
|
||||||
|
private Integer builtin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id(租户id)
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注释
|
||||||
|
*/
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 序号
|
||||||
|
*/
|
||||||
|
private Integer orderNo;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package net.srt.query;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import net.srt.framework.common.query.Query;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Schema(description = "数据治理-元模型属性查询")
|
||||||
|
public class MetamodelpropertyQuery extends Query {
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
private Long metamodelId;
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package net.srt.service;
|
||||||
|
|
||||||
|
import net.srt.entity.MetamodelPropertyEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.query.MetamodelpropertyQuery;
|
||||||
|
import net.srt.vo.MetamodelPropertyVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface MetamodelPropertyService extends BaseService<MetamodelPropertyEntity> {
|
||||||
|
List<MetamodelPropertyVO> properties(Long id);
|
||||||
|
|
||||||
|
PageResult<MetamodelPropertyVO> page(MetamodelpropertyQuery query);
|
||||||
|
|
||||||
|
void save(MetamodelPropertyVO vo);
|
||||||
|
|
||||||
|
void delete(List<Long> idList);
|
||||||
|
|
||||||
|
void update(MetamodelPropertyVO vo);
|
||||||
|
}
|
|
@ -0,0 +1,64 @@
|
||||||
|
package net.srt.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import net.srt.convert.MetamodelPropertyConvert;
|
||||||
|
import net.srt.dao.MetamodelPropertyDao;
|
||||||
|
import net.srt.entity.MetamodelPropertyEntity;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
|
import net.srt.query.MetamodelpropertyQuery;
|
||||||
|
import net.srt.service.MetamodelPropertyService;
|
||||||
|
import net.srt.vo.MetamodelPropertyVO;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class MetamodelPropertyServiceImpl extends BaseServiceImpl<MetamodelPropertyDao, MetamodelPropertyEntity> implements MetamodelPropertyService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<MetamodelPropertyVO> properties(Long id) {
|
||||||
|
LambdaQueryWrapper<MetamodelPropertyEntity> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(MetamodelPropertyEntity::getMetamodelId, id).orderByAsc(MetamodelPropertyEntity::getOrderNo);
|
||||||
|
return MetamodelPropertyConvert.INSTANCE.convertList(baseMapper.selectList(wrapper));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<MetamodelPropertyVO> page(MetamodelpropertyQuery query) {
|
||||||
|
IPage<MetamodelPropertyEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||||
|
return new PageResult<>(MetamodelPropertyConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
private LambdaQueryWrapper<MetamodelPropertyEntity> getWrapper(MetamodelpropertyQuery query) {
|
||||||
|
LambdaQueryWrapper<MetamodelPropertyEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.eq(MetamodelPropertyEntity::getMetamodelId, query.getMetamodelId())
|
||||||
|
.like(StringUtil.isBlank(query.getName()),MetamodelPropertyEntity::getName,query.getName())
|
||||||
|
.like(StringUtil.isBlank(query.getCode()),MetamodelPropertyEntity::getCode,query.getCode())
|
||||||
|
.orderByAsc(MetamodelPropertyEntity::getOrderNo);
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void save(MetamodelPropertyVO vo) {
|
||||||
|
MetamodelPropertyEntity entity = MetamodelPropertyConvert.INSTANCE.convert(vo);
|
||||||
|
entity.setBuiltin(0);
|
||||||
|
entity.setProjectId(getProjectId());
|
||||||
|
baseMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(MetamodelPropertyVO vo) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(List<Long> idList) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "数据治理-元数据属性值")
|
||||||
|
public class MetadataPropertyVo implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "属性id")
|
||||||
|
private Long metamodelPropertyId;
|
||||||
|
|
||||||
|
@Schema(description = "元数据id")
|
||||||
|
private Long metadataId;
|
||||||
|
|
||||||
|
@Schema(description = "属性值")
|
||||||
|
private String property;
|
||||||
|
|
||||||
|
@Schema(description = "项目id(租户id)")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
@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;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "数据治理-元模型属性")
|
||||||
|
public class MetamodelPropertyVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Schema(description = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "元模型id")
|
||||||
|
private Integer metamodelId;
|
||||||
|
|
||||||
|
@Schema(description = "属性名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "属性代码")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "数据类型 1-数字 2-字符串")
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
@Schema(description = "数据长度")
|
||||||
|
private Integer dataLength;
|
||||||
|
|
||||||
|
@Schema(description = "输入控件,1-文本框")
|
||||||
|
private Integer inputType;
|
||||||
|
|
||||||
|
@Schema(description = "允许为空 0-否 1-是")
|
||||||
|
private Integer nullable;
|
||||||
|
|
||||||
|
@Schema(description = "是否内置 0-否 1-是")
|
||||||
|
private Integer builtin;
|
||||||
|
|
||||||
|
@Schema(description = "项目id(租户id)")
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
@Schema(description = "注释")
|
||||||
|
private String comment;
|
||||||
|
|
||||||
|
@Schema(description = "序号")
|
||||||
|
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 = "元模型属性id")
|
||||||
|
private Long metamodelPropertyId;
|
||||||
|
@Schema(description = "元数据的属性值")
|
||||||
|
private String value;
|
||||||
|
@Schema(description = "元数据属性的主键id")
|
||||||
|
private Long metadataPropertyId;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue