fjj6.0
parent
5b19404d0a
commit
efd3b81dc8
1
pom.xml
1
pom.xml
|
@ -24,6 +24,7 @@
|
|||
<module>srt-cloud-gateway</module>
|
||||
<module>srt-data-development</module>
|
||||
<module>srt-cloud-data-governance</module>
|
||||
<module>srt-cloud-data-service</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
|
@ -6,8 +6,9 @@ import net.srt.convert.DatastandardConvert;
|
|||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.service.DatastandardService;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.MetamodelPropertyVO;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -33,15 +34,15 @@ public class DatastandardController {
|
|||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<StandardManagementVo>> page(@Valid StandardManagementQuery query){
|
||||
PageResult<StandardManagementVo> page = datastandardService.page(query);
|
||||
public Result<PageResult<DatastandardVo>> page(@Valid DatastandrdQuery query){
|
||||
PageResult<DatastandardVo> page = datastandardService.page(query);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary ="信息")
|
||||
public Result<StandardManagementVo> get(@PathVariable("id") Integer categoryId) {
|
||||
public Result<DatastandardVo> get(@PathVariable("id") Integer categoryId) {
|
||||
DatastandardEntity entity = datastandardService.getById(categoryId);
|
||||
return Result.ok(DatastandardConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
|
@ -57,15 +58,15 @@ public class DatastandardController {
|
|||
|
||||
@PostMapping
|
||||
@Operation(summary = "保存")
|
||||
public Result<String> save(@RequestBody DatastandardEntity entity) {
|
||||
datastandardService.save(entity);
|
||||
public Result<String> save(@RequestBody DatastandardVo vo) {
|
||||
datastandardService.save(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PutMapping
|
||||
@Operation(summary = "修改")
|
||||
public Result<String> update(@RequestBody @Valid DatastandardEntity datastandardEntity){
|
||||
datastandardService.update1(datastandardEntity);
|
||||
public Result<String> update(@RequestBody @Valid DatastandardVo vo){
|
||||
datastandardService.update1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,11 +1,20 @@
|
|||
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.entity.MetadataCollectQuery;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
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.RestController;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("metadata-collect")
|
||||
@Tag(name = "数据治理-元数据采集")
|
||||
|
@ -13,4 +22,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
public class MetadataCollectController {
|
||||
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,40 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import cn.hutool.db.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.QualityTaskColumnQuery;
|
||||
import net.srt.service.QualityTaskColumnService;
|
||||
import net.srt.vo.QualityTaskColumnVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.controller
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:19
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/quality-task-column")
|
||||
@Tag(name = "数据治理-列检测模块")
|
||||
@AllArgsConstructor
|
||||
public class QualityTaskColumnController {
|
||||
private final QualityTaskColumnService qualityTaskColumnService;
|
||||
@GetMapping("/page")
|
||||
public Result<PageResult<QualityTaskColumnVo>> page(@Valid QualityTaskColumnQuery query){
|
||||
PageResult<QualityTaskColumnVo> page = qualityTaskColumnService.page(query);
|
||||
return Result.ok(page);
|
||||
}
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idlist){
|
||||
qualityTaskColumnService.delete(idlist);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -11,12 +11,10 @@ import net.srt.framework.common.utils.Result;
|
|||
import net.srt.query.QualityTaskQuery;
|
||||
import net.srt.service.QualityTaskService;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
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;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
|
@ -44,4 +42,12 @@ public class QualityTaskController {
|
|||
}
|
||||
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(@RequestBody List<Long> idList){
|
||||
qualityTaskService.delete(idList);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
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.QualityTaskTableConvert;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.QualityTableQuery;
|
||||
import net.srt.service.QualityTaskTableService;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.controller
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 19:34
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/quality-task-table")
|
||||
@Tag(name = "数据治理-表检测模块")
|
||||
@AllArgsConstructor
|
||||
public class QualityTaskTableController {
|
||||
private final QualityTaskTableService qualityTaskTableService;
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<QualityTaskTableVo>> page(@Valid QualityTableQuery query){
|
||||
PageResult<QualityTaskTableVo> pageResult =qualityTaskTableService.page(query);
|
||||
return Result.ok(pageResult);
|
||||
}
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<QualityTaskTableVo> get(@PathVariable("id") Long id){
|
||||
QualityTaskTableEntity entity=qualityTaskTableService.getById(id);
|
||||
return Result.ok(QualityTaskTableConvert.INSTANCE.convert(entity));
|
||||
}
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
private Result<String> delete(@RequestBody List<Long> idlist){
|
||||
qualityTaskTableService.delete(idlist);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ import net.srt.vo.StandardManagementVo;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -21,46 +23,39 @@ import java.util.List;
|
|||
* @Date: 2023-12-20 11:30
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/standard-category")
|
||||
@Tag(name = "标准管理列表")
|
||||
@RequestMapping("standard-category")
|
||||
@Tag(name = "数据开发-调度中心目录")
|
||||
public class StandardController {
|
||||
@Autowired
|
||||
private StandardService standardService;
|
||||
@GetMapping("list-tree")
|
||||
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);
|
||||
public Result<String> save(@RequestBody StandardManagementVo vo) {
|
||||
standardService.save1(vo);
|
||||
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);
|
||||
public Result<String> update(@RequestBody StandardManagementVo vo) {
|
||||
standardService.update1(vo);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
@Operation(summary = "删除")
|
||||
public Result<String> delete(Long id) {
|
||||
standardService.delete(id);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
@ -19,8 +20,10 @@ public interface DatastandardConvert {
|
|||
DatastandardConvert INSTANCE = Mappers.getMapper(DatastandardConvert.class);
|
||||
|
||||
|
||||
List<StandardManagementVo> convertList(List<DatastandardEntity> list);
|
||||
List<DatastandardVo> convertList(List<DatastandardEntity> list);
|
||||
|
||||
StandardManagementVo convert(DatastandardEntity entity);
|
||||
|
||||
DatastandardVo convert(DatastandardEntity entity);
|
||||
DatastandardEntity convert(DatastandardVo entity);
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.QualityQueryEntity;
|
||||
import net.srt.entity.QualityTaskColumnEntity;
|
||||
import net.srt.vo.QualityRuleVo;
|
||||
import net.srt.vo.QualityTaskColumnVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.convert
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityTaskColumnConvert {
|
||||
|
||||
|
||||
QualityTaskColumnConvert INSTANCE = Mappers.getMapper(QualityTaskColumnConvert.class);
|
||||
|
||||
|
||||
List<QualityTaskColumnVo> convertList(List<QualityTaskColumnEntity> list);
|
||||
|
||||
QualityTaskColumnEntity conver(QualityTaskColumnVo vo);
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.convert
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:49
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityTaskTableConvert {
|
||||
QualityTaskTableConvert INSTANCE = Mappers.getMapper(QualityTaskTableConvert.class);
|
||||
|
||||
List<QualityTaskTableVo> convertList(List<QualityTaskTableEntity> list);
|
||||
|
||||
QualityTaskTableVo convert(QualityTaskTableEntity entity);
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : StandardConvert
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:14
|
||||
*/
|
||||
@Mapper
|
||||
public interface StandardConvert {
|
||||
|
||||
StandardConvert INSTANCE = Mappers.getMapper(StandardConvert.class);
|
||||
|
||||
StandardEntity convert(StandardManagementVo vo);
|
||||
|
||||
StandardManagementVo convert(StandardEntity entity);
|
||||
|
||||
List<StandardManagementVo> convertList(List<StandardEntity> list);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.QualityTaskColumnEntity;
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.dao
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 21:37
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityTaskColumnDao extends BaseDao<QualityTaskColumnEntity> {
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.QualityTaskEntity;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.dao
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:18
|
||||
*/
|
||||
@Mapper
|
||||
public interface QualityTaskTableDao extends BaseDao<QualityTaskTableEntity> {
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* 文件分组表
|
||||
*
|
||||
* @author zrx 985134801@qq.com
|
||||
* @since 1.0.0 2022-11-12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_file_category")
|
||||
public class DatagovernanceEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 父级id(顶级为0)
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 分组序号
|
||||
*/
|
||||
private Integer orderNo;
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 分组路径
|
||||
*/
|
||||
private String path;
|
||||
|
||||
private Integer type;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
}
|
|
@ -17,8 +17,6 @@ import net.srt.framework.mybatis.entity.BaseEntity;
|
|||
@TableName("standard_management")
|
||||
public class DatastandardEntity extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
|
@ -30,10 +28,8 @@ public class DatastandardEntity extends BaseEntity {
|
|||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Integer projectId;
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private Integer ifStandardRel;
|
||||
|
||||
}
|
||||
|
|
|
@ -1,14 +1,76 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldStrategy;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_governance_metadata_collect")
|
||||
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;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.entity
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:32
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper=false)
|
||||
@Data
|
||||
@TableName("data_governance_quality_task_column")
|
||||
public class QualityTaskColumnEntity extends BaseEntity {
|
||||
/**
|
||||
* 质量任务id
|
||||
*/
|
||||
private Long qualityTaskId;
|
||||
|
||||
/**
|
||||
* 表检测记录id
|
||||
*/
|
||||
private Long qualityTaskTableId;
|
||||
|
||||
/**
|
||||
* 被检测的数据行
|
||||
*/
|
||||
private String checkRow;
|
||||
|
||||
/**
|
||||
* 未通过详情
|
||||
*/
|
||||
private String notPassInfo;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
private Date checkTime;
|
||||
|
||||
/**
|
||||
* 0-不通过 1-通过
|
||||
*/
|
||||
private Integer checkResult;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
private Integer deleted;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,88 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.entity
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:03
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName(value = "data_governance_quality_task_table", autoResultMap = true)
|
||||
public class QualityTaskTableEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
* 质量任务id
|
||||
*/
|
||||
private Long qualityTaskId;
|
||||
|
||||
/**
|
||||
* 被检测的表id
|
||||
*/
|
||||
private Long tableMetadataId;
|
||||
|
||||
/**
|
||||
* 被检测的表
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
private List<QulaityColumn> columnInfo;
|
||||
/**
|
||||
* 检测条数
|
||||
*/
|
||||
private Integer checkCount;
|
||||
|
||||
/**
|
||||
* 检测通过数
|
||||
*/
|
||||
private Integer passCount;
|
||||
|
||||
/**
|
||||
* 未通过数
|
||||
*/
|
||||
private Integer notPassCount;
|
||||
|
||||
/**
|
||||
* 检测时间
|
||||
*/
|
||||
private Date checkTime;
|
||||
|
||||
/**
|
||||
* 开始时间
|
||||
*/
|
||||
private Date startTime;
|
||||
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
|
||||
|
||||
private String errorLog;
|
||||
|
||||
|
||||
/**
|
||||
* 运行状态( 1-等待中 2-运行中 3-正常结束 4-异常结束)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
private Integer deleted;
|
||||
}
|
|
@ -15,11 +15,11 @@ import net.srt.framework.mybatis.entity.BaseEntity;
|
|||
* @since 1.0.0 2022-11-12
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@SuperBuilder
|
||||
@Data
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("data_file_category")
|
||||
@TableName(value = "data_dispatch_catalogue", autoResultMap = true)
|
||||
public class StandardEntity extends BaseEntity {
|
||||
|
||||
/**
|
||||
|
@ -53,5 +53,4 @@ public class StandardEntity extends BaseEntity {
|
|||
* 项目id
|
||||
*/
|
||||
private Long projectId;
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ import net.srt.framework.common.query.Query;
|
|||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema (description = "标准管理列表")
|
||||
public class StandardManagementQuery extends Query {
|
||||
public class DatastandrdQuery extends Query {
|
||||
private Integer categoryId;
|
||||
private String t;
|
||||
private String cnName;
|
|
@ -0,0 +1,33 @@
|
|||
package net.srt.query;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.common.query.Query;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.query
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 19:57
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(description = "数据治理-表检测记录查询")
|
||||
public class QualityTableQuery extends Query {
|
||||
private Long qualityTaskId;
|
||||
private String tableName;
|
||||
private Integer status;
|
||||
@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
|
||||
@DateTimeFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.query
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:28
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper =false)
|
||||
@Schema(description = "数据治理-字段检测记录查询")
|
||||
public class QualityTaskColumnQuery extends Query {
|
||||
private Long qualityTaskTableId;
|
||||
private Integer checkResult;
|
||||
}
|
|
@ -3,7 +3,8 @@ package net.srt.service;
|
|||
import net.srt.entity.DatastandardEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
|
||||
|
@ -17,11 +18,13 @@ import java.util.List;
|
|||
*/
|
||||
@MapperScan("net.srt.service.DatastandardService")
|
||||
public interface DatastandardService extends BaseService<DatastandardEntity> {
|
||||
PageResult<StandardManagementVo> page(StandardManagementQuery query);
|
||||
PageResult<DatastandardVo> page(DatastandrdQuery query);
|
||||
|
||||
List<DatastandardEntity> getTableCode();
|
||||
|
||||
void update1(DatastandardEntity datastandardEntity);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
|
||||
void update1(DatastandardVo entity);
|
||||
|
||||
void save(DatastandardVo vo);
|
||||
}
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
package net.srt.service;
|
||||
|
||||
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.vo.MetadataCollectVO;
|
||||
|
||||
public interface MetadataCollectService extends BaseService<MetadataCollectEntity> {
|
||||
|
||||
PageResult<MetadataCollectVO> page(MetadataCollectQuery query);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.QualityTaskColumnEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.QualityTaskColumnQuery;
|
||||
import net.srt.vo.QualityTaskColumnVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:23
|
||||
*/
|
||||
public interface QualityTaskColumnService extends BaseService<QualityTaskColumnEntity> {
|
||||
PageResult<QualityTaskColumnVo> page(QualityTaskColumnQuery query);
|
||||
|
||||
void delete(List<Long> idlist);
|
||||
}
|
|
@ -6,6 +6,8 @@ import net.srt.framework.mybatis.service.BaseService;
|
|||
import net.srt.query.QualityTaskQuery;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service
|
||||
|
@ -14,4 +16,6 @@ import net.srt.vo.QualityTaskVo;
|
|||
*/
|
||||
public interface QualityTaskService extends BaseService<QualityTaskEntity> {
|
||||
PageResult<QualityTaskVo> pagea(QualityTaskQuery query);
|
||||
|
||||
void delete(List<Long> idList);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.QualityTableQuery;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:00
|
||||
*/
|
||||
public interface QualityTaskTableService extends BaseService<QualityTaskTableEntity> {
|
||||
PageResult<QualityTaskTableVo> page(QualityTableQuery query);
|
||||
|
||||
void delete(List<Long> idlist);
|
||||
}
|
|
@ -3,6 +3,7 @@ package net.srt.service;
|
|||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -14,12 +15,12 @@ import java.util.List;
|
|||
*/
|
||||
public interface StandardService extends BaseService<StandardEntity> {
|
||||
|
||||
|
||||
List<TreeNodeVo> listTree();
|
||||
|
||||
void save1(StandardEntity standardEntity);
|
||||
void save1(StandardManagementVo vo);
|
||||
|
||||
void update1(StandardEntity standardEntity);
|
||||
|
||||
void del(Long id);
|
||||
void update1(StandardManagementVo vo);
|
||||
|
||||
void delete(Long id);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,9 @@ import net.srt.entity.DatastandardEntity;
|
|||
import net.srt.entity.MetamodelEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.StandardManagementQuery;
|
||||
import net.srt.query.DatastandrdQuery;
|
||||
import net.srt.service.DatastandardService;
|
||||
import net.srt.vo.DatastandardVo;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
@ -30,7 +31,7 @@ import java.util.List;
|
|||
public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, DatastandardEntity> implements DatastandardService {
|
||||
private final DatastandardDao datastandardDao;
|
||||
@Override
|
||||
public PageResult<StandardManagementVo> page(StandardManagementQuery query) {
|
||||
public PageResult<DatastandardVo> page(DatastandrdQuery query) {
|
||||
IPage<DatastandardEntity> page = baseMapper.selectPage(getPage(query), getWrapper(query));
|
||||
return new PageResult<>(DatastandardConvert.INSTANCE.convertList(page.getRecords()), page.getTotal());
|
||||
}
|
||||
|
@ -41,12 +42,7 @@ public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, Da
|
|||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(DatastandardEntity datastandardEntity) {
|
||||
StandardManagementVo standardManagementVo=DatastandardConvert.INSTANCE.convert(datastandardEntity);
|
||||
standardManagementVo.setProjectId(getProjectId());
|
||||
updateById(datastandardEntity);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idList) {
|
||||
|
@ -60,8 +56,22 @@ public class DatastandardServiceImpl extends BaseServiceImpl<DatastandardDao, Da
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(DatastandardVo vo) {
|
||||
DatastandardEntity entity = DatastandardConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<DatastandardEntity> getWrapper(StandardManagementQuery query) {
|
||||
@Override
|
||||
public void save(DatastandardVo vo) {
|
||||
DatastandardEntity entity = DatastandardConvert.INSTANCE.convert(vo);
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<DatastandardEntity> getWrapper(DatastandrdQuery query) {
|
||||
LambdaQueryWrapper<DatastandardEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getCnName()), DatastandardEntity::getCnName, query.getCnName());
|
||||
wrapper.like(StringUtil.isNotBlank(query.getEngName()), DatastandardEntity::getEngName, query.getEngName());
|
||||
|
|
|
@ -1,13 +1,37 @@
|
|||
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 net.srt.convert.MetadataCollectConvert;
|
||||
import net.srt.dao.MetadataCollectDao;
|
||||
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.service.MetadataCollectService;
|
||||
import net.srt.vo.MetadataCollectVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
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,59 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
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 net.srt.convert.QualityTaskColumnConvert;
|
||||
import net.srt.dao.QualityTaskColumnDao;
|
||||
import net.srt.entity.QualityTaskColumnEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.QualityTaskColumnQuery;
|
||||
import net.srt.service.QualityTaskColumnService;
|
||||
import net.srt.vo.QualityTaskColumnVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service.impl
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:37
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QualityTaskColumnServiceimpl extends BaseServiceImpl<QualityTaskColumnDao, QualityTaskColumnEntity> implements QualityTaskColumnService {
|
||||
|
||||
private final QualityTaskColumnDao taskColumnDao;
|
||||
@Override
|
||||
public PageResult<QualityTaskColumnVo> page(QualityTaskColumnQuery query) {
|
||||
IPage<QualityTaskColumnEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
//return new PageResult<>(QualityTaskColumnConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||
List<QualityTaskColumnVo> qualityTaskColumnVos = QualityTaskColumnConvert.INSTANCE.convertList(page.getRecords());
|
||||
return new PageResult<>(qualityTaskColumnVos,page.getTotal());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> idlist) {
|
||||
for (Long id : idlist) {
|
||||
removeById(id);
|
||||
LambdaQueryWrapper<QualityTaskColumnEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.eq(QualityTaskColumnEntity::getQualityTaskId,id);
|
||||
taskColumnDao.delete(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<QualityTaskColumnEntity> getWrapper(QualityTaskColumnQuery query) {
|
||||
LambdaQueryWrapper<QualityTaskColumnEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.like(query.getQualityTaskTableId()!=null ,QualityTaskColumnEntity::getQualityTaskTableId,query.getQualityTaskTableId())
|
||||
.eq(query.getCheckResult()!=null,QualityTaskColumnEntity::getCheckResult,query.getCheckResult())
|
||||
.orderByDesc(QualityTaskColumnEntity::getId);
|
||||
|
||||
return wrapper;
|
||||
}
|
||||
}
|
|
@ -17,8 +17,11 @@ import net.srt.query.QualityTaskQuery;
|
|||
import net.srt.service.QualityTaskService;
|
||||
import net.srt.vo.QualityTaskVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service.impl
|
||||
|
@ -35,6 +38,12 @@ public class QualityTaskServiceimpl extends BaseServiceImpl<QualityTaskDao, Qual
|
|||
return new PageResult<>(QualityTaskConvert.INSTANCE.covertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void delete(List<Long> idList) {
|
||||
removeByIds(idList);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<QualityTaskEntity> getWrapper(QualityTaskQuery query) {
|
||||
LambdaQueryWrapper<QualityTaskEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()),QualityTaskEntity::getName,query.getName())
|
||||
|
|
|
@ -0,0 +1,74 @@
|
|||
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 com.fasterxml.jackson.core.type.TypeReference;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.SneakyThrows;
|
||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||
import net.srt.convert.QualityTaskTableConvert;
|
||||
import net.srt.dao.QualityTaskColumnDao;
|
||||
import net.srt.dao.QualityTaskDao;
|
||||
import net.srt.dao.QualityTaskTableDao;
|
||||
import net.srt.entity.QualityTaskTableEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.query.QualityTableQuery;
|
||||
import net.srt.service.QualityTaskTableService;
|
||||
import net.srt.vo.QualityTaskTableVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.SingletonObject;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.service.impl
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 20:09
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class QualityTaskTableServiceimpl extends BaseServiceImpl<QualityTaskTableDao,QualityTaskTableEntity> implements QualityTaskTableService {
|
||||
private final QualityTaskColumnDao taskColumnDao;
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public PageResult<QualityTaskTableVo> page(QualityTableQuery query) {
|
||||
IPage<QualityTaskTableEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
List<QualityTaskTableVo> taskTableVos= QualityTaskTableConvert.INSTANCE.convertList(page.getRecords());
|
||||
for (QualityTaskTableVo taskTableVo : taskTableVos) { taskTableVo.setColumnInfo(SingletonObject.OBJECT_MAPPER.readValue(SingletonObject.OBJECT_MAPPER.writeValueAsString(taskTableVo.getColumnInfo()), new TypeReference<List<QulaityColumn>>() {
|
||||
}));
|
||||
|
||||
taskTableVo.setCheckColumns(taskTableVo.getColumnInfo().stream().map(QulaityColumn::getColumnName).collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
return new PageResult<>(taskTableVos,page.getTotal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(List<Long> idlist) {
|
||||
for (Long id : idlist) {
|
||||
removeById(id);
|
||||
LambdaQueryWrapper<QualityTaskTableEntity> task=Wrappers.lambdaQuery();
|
||||
task.eq(QualityTaskTableEntity::getQualityTaskId,id);
|
||||
baseMapper.delete(task);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<QualityTaskTableEntity> getWrapper(QualityTableQuery query) {
|
||||
LambdaQueryWrapper<QualityTaskTableEntity> wrapper= Wrappers.lambdaQuery();
|
||||
wrapper.like(query.getQualityTaskId()!=null,QualityTaskTableEntity::getQualityTaskId,query.getQualityTaskId())
|
||||
.like(StringUtil.isNotBlank(query.getTableName()),QualityTaskTableEntity::getTableName,query.getTableName())
|
||||
.eq(query.getStatus()!=null,QualityTaskTableEntity::getStatus,query.getStatus())
|
||||
.ge(query.getStartTime()!=null,QualityTaskTableEntity::getStartTime,query.getStartTime())
|
||||
.le(query.getEndTime()!=null,QualityTaskTableEntity::getEndTime,query.getEndTime())
|
||||
.orderByDesc(QualityTaskTableEntity::getId);
|
||||
return wrapper;
|
||||
|
||||
}
|
||||
}
|
|
@ -2,14 +2,22 @@ package net.srt.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.controller.StandardController;
|
||||
import net.srt.convert.StandardConvert;
|
||||
import net.srt.dao.StandardDao;
|
||||
import net.srt.entity.StandardEntity;
|
||||
import net.srt.framework.common.exception.ServerException;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.service.StandardService;
|
||||
import net.srt.utils.CatalogueBuildTreeUtils;
|
||||
import net.srt.vo.StandardManagementVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -24,6 +32,9 @@ import static net.srt.framework.security.user.SecurityUser.getUserId;
|
|||
@Service
|
||||
@AllArgsConstructor
|
||||
public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEntity> implements StandardService {
|
||||
@Autowired
|
||||
StandardDao standardDao;
|
||||
|
||||
|
||||
@Override
|
||||
public List<TreeNodeVo> listTree() {
|
||||
|
@ -39,48 +50,48 @@ public class StandardServiceImpl extends BaseServiceImpl<StandardDao, StandardEn
|
|||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
});
|
||||
return BuildTreeUtils.buildTree(treeNodeVos);
|
||||
return CatalogueBuildTreeUtils.buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void save1(StandardEntity standardEntity) {
|
||||
if (standardEntity.getId() == null) {
|
||||
standardEntity.setCreateTime(new java.util.Date());
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
standardEntity.setDeleted(0);
|
||||
standardEntity.setVersion(0);
|
||||
standardEntity.setCreator(getUserId());
|
||||
standardEntity.setUpdater(getUserId());
|
||||
baseMapper.insert(standardEntity);
|
||||
} else {
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
}
|
||||
public void save1(StandardManagementVo vo) {
|
||||
StandardEntity entity = StandardConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update1(StandardEntity standardEntity) {
|
||||
if (standardEntity.getId()!= null) {
|
||||
standardEntity.setUpdateTime(new java.util.Date());
|
||||
standardEntity.setUpdater(getUserId());
|
||||
baseMapper.updateById(standardEntity);
|
||||
public void update1(StandardManagementVo vo) {
|
||||
StandardEntity entity = StandardConvert.INSTANCE.convert(vo);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
updateById(entity);
|
||||
}
|
||||
|
||||
|
||||
private String recursionPath(StandardEntity categoryEntity, String path) {
|
||||
if (StringUtil.isBlank(path)) {
|
||||
path = categoryEntity.getName();
|
||||
}
|
||||
if (categoryEntity.getParentId() != 0) {
|
||||
StandardEntity parent = getById(categoryEntity.getParentId());
|
||||
path = parent.getName() + "/" + path;
|
||||
return recursionPath(parent, path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(Long id) {
|
||||
//判断是否有子节点
|
||||
public void delete(Long id) {
|
||||
//查询有没有子节点
|
||||
LambdaQueryWrapper<StandardEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(StandardEntity::getParentId,id).last("limit 1");
|
||||
if(baseMapper.selectCount(wrapper)!=null){
|
||||
throw new RuntimeException("请先删除子节点");
|
||||
wrapper.eq(StandardEntity::getParentId, id).last(" limit 1");
|
||||
StandardEntity one = baseMapper.selectOne(wrapper);
|
||||
if (one != null) {
|
||||
throw new ServerException("存在子节点,不允许删除!");
|
||||
}
|
||||
removeById(id);
|
||||
//删除属性
|
||||
LambdaQueryWrapper<StandardEntity> wrapper1 = new LambdaQueryWrapper<>();
|
||||
wrapper1.eq(StandardEntity::getParentId,id);
|
||||
baseMapper.delete(wrapper1);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
package net.srt.utils;
|
||||
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : CatalogueBuildTreeUtils
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:40
|
||||
*/
|
||||
public class CatalogueBuildTreeUtils {
|
||||
/**
|
||||
* 构建结构树
|
||||
*
|
||||
* @param nodeVos
|
||||
* @return
|
||||
*/
|
||||
public static List<TreeNodeVo> buildTree(List<TreeNodeVo> nodeVos) {
|
||||
List<TreeNodeVo> resultVos = new ArrayList<>(10);
|
||||
for (TreeNodeVo node : nodeVos) {
|
||||
// 一级菜单parentId为0
|
||||
if (node.getParentId() == 0) {
|
||||
resultVos.add(node);
|
||||
}
|
||||
}
|
||||
// 为一级菜单设置子菜单,getChild是递归调用的
|
||||
for (TreeNodeVo node : resultVos) {
|
||||
node.setChildren(getChild(node.getId(), nodeVos));
|
||||
}
|
||||
return resultVos;
|
||||
}
|
||||
|
||||
|
||||
private static List<TreeNodeVo> getChild(Long id, List<TreeNodeVo> nodeVos) {
|
||||
// 子菜单
|
||||
List<TreeNodeVo> childList = new ArrayList<>(10);
|
||||
for (TreeNodeVo node : nodeVos) {
|
||||
// 遍历所有节点,将父菜单id与传过来的id比较
|
||||
if (node.getParentId() != 0) {
|
||||
if (node.getParentId().equals(id)) {
|
||||
childList.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 把子菜单的子菜单再循环一遍
|
||||
for (TreeNodeVo node : childList) {
|
||||
node.setChildren(getChild(node.getId(), nodeVos));
|
||||
}
|
||||
return childList;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @ClassName : DatastandardVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 12:05
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "标准管理查询")
|
||||
public class DatastandardVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
private Integer codeNum;
|
||||
private String dataType;
|
||||
private Integer dataLength;
|
||||
private Integer dataPrecision;
|
||||
private Integer nullable;
|
||||
private Integer standardCodeId;
|
||||
private Integer type;
|
||||
private String note;
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
private Integer version;
|
||||
private Integer deleted;
|
||||
private String creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
private String updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Date updateTime;
|
||||
private Integer ifStandardRel;
|
||||
private String group;
|
||||
}
|
|
@ -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;
|
||||
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.vo
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/23 11:22
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-字段检测记录")
|
||||
public class QualityTaskColumnVo implements Serializable {
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "质量任务id")
|
||||
private Long qualityTaskId;
|
||||
|
||||
@Schema(description = "表检测记录id")
|
||||
private Long qualityTaskTableId;
|
||||
|
||||
@Schema(description = "被检测的数据行")
|
||||
private String checkRow;
|
||||
|
||||
@Schema(description = "未通过详情")
|
||||
private String notPassInfo;
|
||||
|
||||
@Schema(description = "检测时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date checkTime;
|
||||
|
||||
@Schema(description = "0-不通过 1-通过")
|
||||
private Integer checkResult;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
|
@ -0,0 +1,90 @@
|
|||
package net.srt.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import net.srt.api.module.data.governance.dto.quality.QulaityColumn;
|
||||
import net.srt.framework.common.utils.DateUtils;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @BelongsProject: srt_cloud
|
||||
* @BelongsPackage: net.srt.vo
|
||||
* @Author: jpz
|
||||
* @CreateTime: 2023/12/22 19:39
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "数据治理-表检测记录表")
|
||||
public class QualityTaskTableVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "质量任务id")
|
||||
private Long qualityTaskId;
|
||||
|
||||
@Schema(description = "被检测id")
|
||||
private Long tableMetadataId;
|
||||
|
||||
|
||||
@Schema(description = "被检测的表")
|
||||
private String tableName;
|
||||
|
||||
@Schema(description = "被检测字段的id")
|
||||
private List<QulaityColumn> columnInfo;
|
||||
|
||||
@Schema(description = "检测条数")
|
||||
private Integer checkCount;
|
||||
|
||||
@Schema(description = "检测通过条数")
|
||||
private Integer passCount;
|
||||
|
||||
@Schema(description = "未通过条数")
|
||||
private Integer notPassCount;
|
||||
|
||||
@Schema(description = "检测时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date checkTime;
|
||||
|
||||
@Schema(description = "开始时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date startTime;
|
||||
|
||||
@Schema(description = "结束时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date endTime;
|
||||
|
||||
@Schema(description = "错误日志")
|
||||
private String errrorLog;
|
||||
|
||||
@Schema(description = "运行状态( 1-等待中 2-运行中 3-正常结束 4-异常结束)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "项目id")
|
||||
private Integer projectId;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Integer creator;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Integer updater;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
|
||||
@Schema(description = "删除标识(0:正常 1:已删除)")
|
||||
private Integer deleted;
|
||||
|
||||
private String checkColumns;
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
|||
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 org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -16,34 +17,49 @@ import java.util.Date;
|
|||
* @Date: 2023-12-20 11:24
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "标准管理查询")
|
||||
@Schema(description = "目录表")
|
||||
public class StandardManagementVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@TableId("id")
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
private Integer categoryId;
|
||||
private String engName;
|
||||
private String cnName;
|
||||
private Integer codeNum;
|
||||
private String dataType;
|
||||
private Integer dataLength;
|
||||
private Integer dataPrecision;
|
||||
private Integer nullable;
|
||||
private Integer standardCodeId;
|
||||
|
||||
@Schema(description = "父级id(顶级为0)")
|
||||
private Long parentId;
|
||||
@Schema(description = "0-文件夹 1-文件目录")
|
||||
private Integer type;
|
||||
private String note;
|
||||
@Schema(description = "分组名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "分组序号")
|
||||
private Integer orderNo;
|
||||
|
||||
@Schema(description = "描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "分组路径")
|
||||
private String path;
|
||||
|
||||
@Schema(description = "项目id")
|
||||
private Long projectId;
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@Schema(description = "删除标识 0:正常 1:已删除")
|
||||
private Integer deleted;
|
||||
private String creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
|
||||
@Schema(description = "创建者")
|
||||
private Long creator;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date createTime;
|
||||
private String updater;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
|
||||
@Schema(description = "更新者")
|
||||
private Long updater;
|
||||
|
||||
@Schema(description = "更新时间")
|
||||
@JsonFormat(pattern = DateUtils.DATE_TIME_PATTERN)
|
||||
private Date updateTime;
|
||||
private Integer ifStandardRel;
|
||||
private String group;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
package net.srt.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.convert.DataServiceAppConvert;
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.service.DataServiceAppService;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
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;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppController
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app")
|
||||
@AllArgsConstructor
|
||||
public class DataServiceAppController {
|
||||
private final DataServiceAppService dataServiceAppService;
|
||||
|
||||
@GetMapping("page")
|
||||
@Operation(summary = "分页")
|
||||
public Result<PageResult<DataServiceAppVo> > page(@Valid DataServiceAppQuery query) {
|
||||
PageResult<DataServiceAppVo> pageResult = dataServiceAppService.page(query);
|
||||
return Result.ok(pageResult);
|
||||
}
|
||||
@GetMapping("{id}")
|
||||
@Operation(summary = "信息")
|
||||
public Result<DataServiceAppVo> get(@PathVariable("id") Long id){
|
||||
DataServiceApppEntity dataServiceApppEntity = dataServiceAppService.getById(id);
|
||||
return Result.ok(DataServiceAppConvert.INSTANCE.convert(dataServiceApppEntity));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package net.srt.convert;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppConvert
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 09:06
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataServiceAppConvert {
|
||||
DataServiceAppConvert INSTANCE = Mappers.getMapper(DataServiceAppConvert.class);
|
||||
|
||||
DataServiceApppEntity convert(DataServiceAppVo vo);
|
||||
|
||||
DataServiceAppVo convert(DataServiceApppEntity entity);
|
||||
|
||||
List<DataServiceAppVo> convertList(List<DataServiceApppEntity> list);
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.dao;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.mybatis.dao.BaseDao;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppDao
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:59
|
||||
*/
|
||||
@Mapper
|
||||
public interface DataServiceAppDao extends BaseDao<DataServiceApppEntity> {
|
||||
DataServiceApppEntity selectByApplyId(@Param("applyId") Long applyId);
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package net.srt.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceApppEntity
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:46
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@TableName("data_service_app")
|
||||
public class DataServiceApppEntity extends BaseEntity {
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String note;
|
||||
|
||||
@Schema(description = "app_key")
|
||||
private String appKey;
|
||||
|
||||
@Schema(description = "app_secret")
|
||||
private String appSecret;
|
||||
|
||||
@Schema(description = "过期描述")
|
||||
private String expireDesc;
|
||||
|
||||
/**
|
||||
* 过期时间 -1永久;0 单次失效;> 0 失效时间
|
||||
*/
|
||||
private Long expireDuration;
|
||||
|
||||
private Integer ifMarket;
|
||||
|
||||
@Schema(description = "所属项目id")
|
||||
private Long projectId;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppQuery
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:51
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Schema(defaultValue = "app权限")
|
||||
public class DataServiceAppQuery extends Query {
|
||||
private String name;
|
||||
private String appKey;
|
||||
private Integer ifMarket;
|
||||
private Boolean ifInfo;
|
||||
private Long applyId;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package net.srt.service;
|
||||
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.BaseService;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppService
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
public interface DataServiceAppService extends BaseService<DataServiceApppEntity> {
|
||||
PageResult<DataServiceAppVo> page(DataServiceAppQuery query);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
package net.srt.service.impl;
|
||||
|
||||
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 net.srt.convert.DataServiceAppConvert;
|
||||
import net.srt.dao.DataServiceAppDao;
|
||||
import net.srt.entity.DataServiceApppEntity;
|
||||
import net.srt.framework.common.page.PageResult;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import net.srt.framework.security.user.SecurityUser;
|
||||
import net.srt.query.DataServiceAppQuery;
|
||||
import net.srt.service.DataServiceAppService;
|
||||
import net.srt.vo.DataServiceAppVo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppServiceImpl
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-23 08:53
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DataServiceAppServiceImpl extends BaseServiceImpl<DataServiceAppDao, DataServiceApppEntity> implements DataServiceAppService {
|
||||
@Override
|
||||
public PageResult<DataServiceAppVo> page(DataServiceAppQuery query) {
|
||||
if (query.getApplyId()!=null){
|
||||
DataServiceApppEntity dataServiceApppEntity=baseMapper.selectByApplyId(query.getApplyId());
|
||||
List<DataServiceApppEntity> list=new ArrayList<>(1);
|
||||
if (dataServiceApppEntity!=null){
|
||||
list.add(dataServiceApppEntity);
|
||||
return new PageResult<>(DataServiceAppConvert.INSTANCE.convertList(list),1);
|
||||
}
|
||||
return new PageResult<>(new ArrayList<>(),0);
|
||||
|
||||
}
|
||||
IPage<DataServiceApppEntity> page=baseMapper.selectPage(getPage(query),getWrapper(query));
|
||||
return new PageResult<>(DataServiceAppConvert.INSTANCE.convertList(page.getRecords()),page.getTotal());
|
||||
}
|
||||
|
||||
|
||||
private LambdaQueryWrapper<DataServiceApppEntity> getWrapper(DataServiceAppQuery query) {
|
||||
LambdaQueryWrapper<DataServiceApppEntity> wrapper = Wrappers.lambdaQuery();
|
||||
wrapper.like(StringUtil.isNotBlank(query.getName()), DataServiceApppEntity::getName, query.getName())
|
||||
.eq(DataServiceApppEntity::getIfMarket, query.getIfMarket() != null ? query.getIfMarket() : 0)
|
||||
.eq(query.getIfMarket() != null, DataServiceApppEntity::getCreator, SecurityUser.getUserId())
|
||||
.eq(StringUtil.isNotBlank(query.getAppKey()), DataServiceApppEntity::getAppKey, query.getAppKey())
|
||||
.orderByDesc(DataServiceApppEntity::getCreateTime).orderByDesc(DataServiceApppEntity::getId);
|
||||
dataScopeWithoutOrgId(wrapper);
|
||||
return wrapper;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
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;
|
||||
|
||||
/**
|
||||
* @ClassName : DataServiceAppVo
|
||||
* @Description :
|
||||
* @Author : FJJ
|
||||
* @Date: 2023-12-22 21:21
|
||||
*/
|
||||
@Data
|
||||
@Schema(defaultValue = "app权限")
|
||||
public class DataServiceAppVo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "主键id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "备注")
|
||||
private String note;
|
||||
|
||||
@Schema(description = "app_key")
|
||||
private String appKey;
|
||||
|
||||
@Schema(description = "app_secret")
|
||||
private String appSecret;
|
||||
|
||||
@Schema(description = "过期描述")
|
||||
private String expireDesc;
|
||||
|
||||
/**
|
||||
* 过期时间 -1永久;0 单次失效;> 0 失效时间
|
||||
*/
|
||||
private Long expireDuration;
|
||||
|
||||
private Integer ifMarket;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?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.DataServiceAppDao">
|
||||
|
||||
|
||||
<select id="selectByApplyId" resultType="net.srt.entity.DataServiceApppEntity">
|
||||
SELECT dsa.* FROM data_service_app dsa INNER JOIN data_market_resource_apply dmra ON dsa.id=dmra.app_id WHERE dmra.id=#{applyId}
|
||||
</select>
|
||||
</mapper>
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -42,7 +42,7 @@ public class HadoopController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* 修改
|
||||
* @param HadoopAddDto
|
||||
* @return
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package net.srt.disposition.controller;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.api.module.data.integrate.dto.DataDatabaseDto;
|
||||
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||
import net.srt.disposition.dto.DispositionDto;
|
||||
import net.srt.disposition.service.DataProductionService;
|
||||
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||
import net.srt.disposition.vo.DispositionVo;
|
||||
import net.srt.framework.common.utils.Result;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -23,4 +24,10 @@ public class DataProductionTreeController {
|
|||
List<DataProductionTreeVo> dispositionVos=dataProductionService.dataTreeList();
|
||||
return Result.ok(dispositionVos);
|
||||
}
|
||||
|
||||
@PostMapping
|
||||
public Result add(@RequestBody DataProductionTreeDto dataProductionTreeDto){
|
||||
dataProductionService.add(dataProductionTreeDto);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
package net.srt.disposition.convert;
|
||||
|
||||
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||
import net.srt.disposition.dto.DispositionDto;
|
||||
import net.srt.disposition.entity.DataProductionTreeEntity;
|
||||
import net.srt.disposition.entity.DispositionEntity;
|
||||
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||
import net.srt.disposition.vo.DispositionVo;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DataProductionTreeConvert {
|
||||
DataProductionTreeConvert INSTANCE = Mappers.getMapper(DataProductionTreeConvert.class);
|
||||
DispositionVo convert(DispositionEntity entity);
|
||||
DataProductionTreeVo convert(DataProductionTreeEntity entity);
|
||||
|
||||
DispositionEntity convert(DispositionDto vo);
|
||||
List<DataProductionTreeVo> convert(List<DataProductionTreeEntity> dataProductionTreeEntities);
|
||||
|
||||
DataProductionTreeEntity convert(DataProductionTreeDto dataProductionTreeDto);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package net.srt.disposition.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class DataProductionTreeDto {
|
||||
private Integer id;
|
||||
private Integer parentId;
|
||||
private Integer ifLeaf;
|
||||
private Long taskId;
|
||||
private String taskType;
|
||||
private String parentPath;
|
||||
private String path;
|
||||
private Integer orderNo;
|
||||
private String label;
|
||||
private Long metamodelId;
|
||||
private String name;
|
||||
private String icon;
|
||||
private String code;
|
||||
private Boolean builtin;
|
||||
private String description;
|
||||
private Long projectId;
|
||||
private Integer creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date creatTime;
|
||||
}
|
|
@ -1,13 +1,20 @@
|
|||
package net.srt.disposition.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import net.srt.framework.mybatis.entity.BaseEntity;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("data_production_tree")
|
||||
public class DataProductionTreeEntity extends BaseEntity {
|
||||
private Long parentId;
|
||||
public class DataProductionTreeEntity {
|
||||
@TableId("id")
|
||||
private Integer id;
|
||||
private Integer parentId;
|
||||
private Integer ifLeaf;
|
||||
private Long taskId;
|
||||
private String taskType;
|
||||
|
@ -22,4 +29,8 @@ public class DataProductionTreeEntity extends BaseEntity {
|
|||
private Boolean builtin;
|
||||
private String description;
|
||||
private Long projectId;
|
||||
private Integer creator;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package net.srt.disposition.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import net.srt.api.module.data.integrate.dto.DataDatabaseDto;
|
||||
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||
import net.srt.disposition.dto.DispositionDto;
|
||||
import net.srt.disposition.entity.DataProductionTreeEntity;
|
||||
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||
|
||||
|
@ -9,4 +12,6 @@ import java.util.List;
|
|||
public interface DataProductionService extends IService<DataProductionTreeEntity> {
|
||||
List<DataProductionTreeVo> dataTreeList();
|
||||
|
||||
void add(DataProductionTreeDto dataProductionTreeDto);
|
||||
|
||||
}
|
||||
|
|
|
@ -6,12 +6,20 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import net.srt.Fink.entity.FinkEntity;
|
||||
import net.srt.api.module.data.integrate.dto.DataDatabaseDto;
|
||||
import net.srt.disposition.convert.DataProductionTreeConvert;
|
||||
import net.srt.disposition.dto.DataProductionTreeDto;
|
||||
import net.srt.disposition.dto.DispositionDto;
|
||||
import net.srt.disposition.entity.DataProductionTreeEntity;
|
||||
import net.srt.disposition.mapper.DataProductionMapper;
|
||||
import net.srt.disposition.service.DataProductionService;
|
||||
import net.srt.disposition.vo.DataProductionTreeVo;
|
||||
import net.srt.framework.common.utils.BeanUtil;
|
||||
import net.srt.framework.common.utils.BuildTreeUtils;
|
||||
import net.srt.framework.common.utils.TreeNodeVo;
|
||||
import net.srt.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import org.springframework.stereotype.Service;
|
||||
import srt.cloud.framework.dbswitch.common.util.StringUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -20,19 +28,70 @@ import java.util.List;
|
|||
public class DataProductionServiceImpl extends BaseServiceImpl<DataProductionMapper, DataProductionTreeEntity> implements DataProductionService {
|
||||
@Override
|
||||
public List<DataProductionTreeVo> dataTreeList() {
|
||||
List<DataProductionTreeEntity> dataProductionTreeEntities = baseMapper.selectList(null);
|
||||
for (DataProductionTreeEntity dataProductionTreeEntity : dataProductionTreeEntities) {
|
||||
List<DataProductionTreeVo> dataProductionTreeVos=findDataProductTreeVoList(dataProductionTreeEntity);
|
||||
LambdaQueryWrapper<DataProductionTreeEntity> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.orderByAsc(DataProductionTreeEntity::getOrderNo);
|
||||
List<DataProductionTreeEntity> dataFileCategoryEntities = baseMapper.selectList(wrapper);
|
||||
List<DataProductionTreeVo> treeNodeVos = BeanUtil.copyListProperties(dataFileCategoryEntities, DataProductionTreeVo::new, (oldItem, newItem) -> {
|
||||
newItem.setLabel(oldItem.getName());
|
||||
if (newItem.getPath().contains("/")) {
|
||||
newItem.setParentPath(newItem.getPath().substring(0, newItem.getPath().lastIndexOf("/")));
|
||||
}
|
||||
return null;
|
||||
});
|
||||
return buildTree(treeNodeVos);
|
||||
}
|
||||
|
||||
private List<DataProductionTreeVo> findDataProductTreeVoList(DataProductionTreeEntity dataProductionTreeEntity) {
|
||||
List<DataProductionTreeVo> dataProductionTreeVos=new ArrayList<>();
|
||||
QueryWrapper<DataProductionTreeEntity> dataProductionTreeEntityQueryWrapper = new QueryWrapper<>();
|
||||
dataProductionTreeEntityQueryWrapper.eq("parent_id",dataProductionTreeEntity.getId());
|
||||
List<DataProductionTreeEntity> dataProductionTreeEntities = baseMapper.selectList(dataProductionTreeEntityQueryWrapper);
|
||||
|
||||
return null;
|
||||
public static List<DataProductionTreeVo> buildTree(List<DataProductionTreeVo> nodeVos) {
|
||||
List<DataProductionTreeVo> resultVos = new ArrayList<>(10);
|
||||
for (DataProductionTreeVo node : nodeVos) {
|
||||
// 一级菜单parentId为0
|
||||
if (node.getParentId() == 0) {
|
||||
resultVos.add(node);
|
||||
}
|
||||
}
|
||||
// 为一级菜单设置子菜单,getChild是递归调用的
|
||||
for (DataProductionTreeVo node : resultVos) {
|
||||
node.setDataProductionTreeVos(getChild(node.getId(), nodeVos));
|
||||
}
|
||||
return resultVos;
|
||||
}
|
||||
|
||||
|
||||
private static List<DataProductionTreeVo> getChild(Long id, List<DataProductionTreeVo> nodeVos) {
|
||||
// 子菜单
|
||||
List<DataProductionTreeVo> childList = new ArrayList<>(10);
|
||||
for (DataProductionTreeVo node : nodeVos) {
|
||||
// 遍历所有节点,将父菜单id与传过来的id比较
|
||||
if (node.getParentId() != 0) {
|
||||
if (node.getParentId().equals(id)) {
|
||||
childList.add(node);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 把子菜单的子菜单再循环一遍
|
||||
for (DataProductionTreeVo node : childList) {
|
||||
node.setDataProductionTreeVos(getChild(node.getId(), nodeVos));
|
||||
}
|
||||
return childList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void add(DataProductionTreeDto dataProductionTreeDto) {
|
||||
DataProductionTreeEntity entity = DataProductionTreeConvert.INSTANCE.convert(dataProductionTreeDto);
|
||||
entity.setPath(recursionPath(entity, null));
|
||||
entity.setProjectId(getProjectId());
|
||||
baseMapper.insert(entity);
|
||||
}
|
||||
|
||||
private String recursionPath(DataProductionTreeEntity categoryEntity, String path) {
|
||||
if (StringUtil.isBlank(path)) {
|
||||
path = categoryEntity.getName();
|
||||
}
|
||||
if (categoryEntity.getParentId() != 0) {
|
||||
DataProductionTreeEntity parent = getById(categoryEntity.getParentId());
|
||||
path = parent.getName() + "/" + path;
|
||||
return recursionPath(parent, path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue