最新一版6.0
parent
d52a5c29f3
commit
cdb318e230
|
@ -1,11 +1,20 @@
|
||||||
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.entity.MetadataCollectQuery;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
|
import net.srt.framework.common.utils.Result;
|
||||||
import net.srt.service.MetadataCollectService;
|
import net.srt.service.MetadataCollectService;
|
||||||
|
import net.srt.vo.MetadataCollectVO;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("metadata-collect")
|
@RequestMapping("metadata-collect")
|
||||||
@Tag(name = "数据治理-元数据采集")
|
@Tag(name = "数据治理-元数据采集")
|
||||||
|
@ -13,5 +22,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
public class MetadataCollectController {
|
public class MetadataCollectController {
|
||||||
private final MetadataCollectService metadataCollectService;
|
private final MetadataCollectService metadataCollectService;
|
||||||
|
|
||||||
|
@GetMapping("page")
|
||||||
|
@Operation(summary = "分页")
|
||||||
|
public Result<PageResult<MetadataCollectVO>> page(@Valid MetadataCollectQuery query){
|
||||||
|
PageResult<MetadataCollectVO> page = metadataCollectService.page(query);
|
||||||
|
return Result.ok(page);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
package net.srt.convert;
|
||||||
|
|
||||||
|
import net.srt.api.module.data.governance.dto.DataGovernanceMetadataCollectDto;
|
||||||
|
import net.srt.entity.MetadataCollectEntity;
|
||||||
|
import net.srt.vo.MetadataCollectVO;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface MetadataCollectConvert {
|
||||||
|
MetadataCollectConvert INSTANCE = Mappers.getMapper(MetadataCollectConvert.class);
|
||||||
|
|
||||||
|
MetadataCollectEntity convert(MetadataCollectVO vo);
|
||||||
|
|
||||||
|
MetadataCollectEntity convert(DataGovernanceMetadataCollectDto dto);
|
||||||
|
|
||||||
|
DataGovernanceMetadataCollectDto convertDto(MetadataCollectEntity entity);
|
||||||
|
|
||||||
|
MetadataCollectVO convert(MetadataCollectEntity entity);
|
||||||
|
|
||||||
|
List<MetadataCollectVO> convertList(List<MetadataCollectEntity> list);
|
||||||
|
|
||||||
|
}
|
|
@ -1,14 +1,76 @@
|
||||||
package net.srt.entity;
|
package net.srt.entity;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
@EqualsAndHashCode(callSuper = false)
|
@EqualsAndHashCode(callSuper = false)
|
||||||
@Data
|
@Data
|
||||||
@TableName("data_governance_metadata_collect")
|
@TableName("data_governance_metadata_collect")
|
||||||
public class MetadataCollectEntity extends BaseEntity {
|
public class MetadataCollectEntity extends BaseEntity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库类型(1-数据库 2-中台库)
|
||||||
|
*/
|
||||||
|
private Integer dbType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据库主键id
|
||||||
|
*/
|
||||||
|
private Long databaseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 入库策略,0-全量,1-增量
|
||||||
|
*/
|
||||||
|
private Integer strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型 1一次性 2.周期性
|
||||||
|
*/
|
||||||
|
private Integer taskType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* cron表达式(秒 分 时 日 月 星期 年,例如 0 0 3 * * ? 表示每天凌晨三点执行)
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private String cron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 归属元数据的目录
|
||||||
|
*/
|
||||||
|
private Long metadataId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已发布 0-否 1-是
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
@TableField(updateStrategy = FieldStrategy.IGNORED)
|
||||||
|
private Date releaseTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目id
|
||||||
|
*/
|
||||||
|
private Long projectId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package net.srt.entity;
|
||||||
|
|
||||||
|
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 MetadataCollectQuery extends Query {
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 入库策略,0-全量,1-增量
|
||||||
|
*/
|
||||||
|
private Integer strategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务类型 1一次性 2.周期性
|
||||||
|
*/
|
||||||
|
private Integer taskType;
|
||||||
|
}
|
|
@ -1,8 +1,12 @@
|
||||||
package net.srt.service;
|
package net.srt.service;
|
||||||
|
|
||||||
import net.srt.entity.MetadataCollectEntity;
|
import net.srt.entity.MetadataCollectEntity;
|
||||||
|
import net.srt.entity.MetadataCollectQuery;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.mybatis.service.BaseService;
|
import net.srt.framework.mybatis.service.BaseService;
|
||||||
|
import net.srt.vo.MetadataCollectVO;
|
||||||
|
|
||||||
public interface MetadataCollectService extends BaseService<MetadataCollectEntity> {
|
public interface MetadataCollectService extends BaseService<MetadataCollectEntity> {
|
||||||
|
|
||||||
|
PageResult<MetadataCollectVO> page(MetadataCollectQuery query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,37 @@
|
||||||
package net.srt.service.impl;
|
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 lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
import net.srt.convert.MetadataCollectConvert;
|
||||||
import net.srt.dao.MetadataCollectDao;
|
import net.srt.dao.MetadataCollectDao;
|
||||||
import net.srt.entity.MetadataCollectEntity;
|
import net.srt.entity.MetadataCollectEntity;
|
||||||
|
import net.srt.entity.MetadataCollectQuery;
|
||||||
|
import net.srt.framework.common.page.PageResult;
|
||||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||||
import net.srt.service.MetadataCollectService;
|
import net.srt.service.MetadataCollectService;
|
||||||
|
import net.srt.vo.MetadataCollectVO;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class MetadataCollectServiceImpl extends BaseServiceImpl<MetadataCollectDao, MetadataCollectEntity> implements MetadataCollectService {
|
public class MetadataCollectServiceImpl extends BaseServiceImpl<MetadataCollectDao, MetadataCollectEntity> implements MetadataCollectService {
|
||||||
|
@Override
|
||||||
|
public PageResult<MetadataCollectVO> page(MetadataCollectQuery query) {
|
||||||
|
IPage<MetadataCollectEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||||
|
return new PageResult<>(MetadataCollectConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
private Wrapper<MetadataCollectEntity> getWrapper(MetadataCollectQuery query) {
|
||||||
|
LambdaQueryWrapper<MetadataCollectEntity> wrapper = Wrappers.lambdaQuery();
|
||||||
|
wrapper.like(StringUtil.isNotBlank(query.getName()),MetadataCollectEntity::getName,query.getName())
|
||||||
|
.eq(query.getStrategy()!=null,MetadataCollectEntity::getStrategy,query.getStrategy())
|
||||||
|
.eq(query.getTaskType()!=null,MetadataCollectEntity::getTaskType,query.getTaskType())
|
||||||
|
.orderByDesc(MetadataCollectEntity::getId);
|
||||||
|
dataScopeWithOrgId(wrapper);
|
||||||
|
return wrapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
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 MetadataCollectVO implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "主键id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "任务名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "数据库类型(1-数据库 2-中台库)")
|
||||||
|
private Integer dbType;
|
||||||
|
|
||||||
|
@Schema(description = "数据库主键id")
|
||||||
|
private Long databaseId;
|
||||||
|
|
||||||
|
@Schema(description = "入库策略,0-全量,1-增量")
|
||||||
|
private Integer strategy;
|
||||||
|
|
||||||
|
@Schema(description = "任务类型 1一次性 2.周期性")
|
||||||
|
private Integer taskType;
|
||||||
|
|
||||||
|
@Schema(description = "cron表达式(秒 分 时 日 月 星期 年,例如 0 0 3 * * ? 表示每天凌晨三点执行)")
|
||||||
|
private String cron;
|
||||||
|
|
||||||
|
@Schema(description = "归属元数据的目录")
|
||||||
|
private Long metadataId;
|
||||||
|
|
||||||
|
@Schema(description = "描述")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "是否已发布 0-否 1-是")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "发布时间")
|
||||||
|
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||||
|
private Date releaseTime;
|
||||||
|
|
||||||
|
@Schema(description = "项目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;
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue