init
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>data-standard-service-parent</artifactId>
|
||||
<groupId>com.platform</groupId>
|
||||
<version>0.4.x</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>0.4.x</version>
|
||||
<artifactId>data-standard-service-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-micro-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
<!--feign 依赖-->
|
||||
<dependency>
|
||||
<groupId>io.github.openfeign</groupId>
|
||||
<artifactId>feign-okhttp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-core</artifactId>
|
||||
<version>0.4.x</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-web</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,40 @@
|
||||
package cn.datax.service.data.standard.api.dto;
|
||||
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 实体DTO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@ApiModel(value = "字典对照信息表Model")
|
||||
@Data
|
||||
public class ContrastDictDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
|
||||
private String id;
|
||||
@ApiModelProperty(value = "字典对照主键")
|
||||
private String contrastId;
|
||||
@ApiModelProperty(value = "字典编码")
|
||||
private String colCode;
|
||||
@ApiModelProperty(value = "字典名称")
|
||||
private String colName;
|
||||
@ApiModelProperty(value = "状态")
|
||||
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String status;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.datax.service.data.standard.api.dto;
|
||||
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 实体DTO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@ApiModel(value = "对照表信息表Model")
|
||||
@Data
|
||||
public class ContrastDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
|
||||
private String id;
|
||||
@ApiModelProperty(value = "数据源主键")
|
||||
private String sourceId;
|
||||
@ApiModelProperty(value = "数据源")
|
||||
private String sourceName;
|
||||
@ApiModelProperty(value = "数据表主键")
|
||||
private String tableId;
|
||||
@ApiModelProperty(value = "数据表")
|
||||
private String tableName;
|
||||
@ApiModelProperty(value = "数据表名称")
|
||||
private String tableComment;
|
||||
@ApiModelProperty(value = "对照字段主键")
|
||||
private String columnId;
|
||||
@ApiModelProperty(value = "对照字段")
|
||||
private String columnName;
|
||||
@ApiModelProperty(value = "对照字段名称")
|
||||
private String columnComment;
|
||||
@ApiModelProperty(value = "标准类别主键")
|
||||
private String gbTypeId;
|
||||
@ApiModelProperty(value = "绑定标准字段")
|
||||
private String bindGbColumn;
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.datax.service.data.standard.api.dto;
|
||||
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 实体DTO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@ApiModel(value = "数据标准字典表Model")
|
||||
@Data
|
||||
public class DictDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
|
||||
private String id;
|
||||
@ApiModelProperty(value = "所属类别")
|
||||
@NotBlank(message = "所属类别不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String typeId;
|
||||
@ApiModelProperty(value = "标准编码")
|
||||
@NotBlank(message = "标准编码不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String gbCode;
|
||||
@ApiModelProperty(value = "标准名称")
|
||||
@NotBlank(message = "标准名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String gbName;
|
||||
@ApiModelProperty(value = "状态")
|
||||
@NotNull(message = "状态不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String status;
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.data.standard.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class Endpoint implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@NotBlank(message = "源端点不能为空")
|
||||
private String sourceId;
|
||||
|
||||
@NotBlank(message = "目标端点不能为空")
|
||||
private String targetId;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.datax.service.data.standard.api.dto;
|
||||
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ManualMappingDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@Valid
|
||||
@NotEmpty(message = "对照关系不能为空")
|
||||
@Size(min = 1, message="对照关系长度不能少于{min}位")
|
||||
private List<Endpoint> endpoints;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.datax.service.data.standard.api.dto;
|
||||
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 实体DTO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@ApiModel(value = "数据标准类别表Model")
|
||||
@Data
|
||||
public class TypeDto implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@NotBlank(message = "主键ID不能为空", groups = {ValidationGroups.Update.class})
|
||||
private String id;
|
||||
@ApiModelProperty(value = "标准类别编码")
|
||||
@NotBlank(message = "标准类别编码不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String gbTypeCode;
|
||||
@ApiModelProperty(value = "标准类别名称")
|
||||
@NotBlank(message = "标准类别名称不能为空", groups = {ValidationGroups.Insert.class, ValidationGroups.Update.class})
|
||||
private String gbTypeName;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package cn.datax.service.data.standard.api.entity;
|
||||
|
||||
import cn.datax.common.base.DataScopeBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "standard_contrast_dict", autoResultMap = true)
|
||||
public class ContrastDictEntity extends DataScopeBaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 字典对照主键
|
||||
*/
|
||||
private String contrastId;
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String sourceName;
|
||||
|
||||
/**
|
||||
* 数据表
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 对照字段
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* 标准类别编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String gbTypeCode;
|
||||
|
||||
/**
|
||||
* 标准类别名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String gbTypeName;
|
||||
|
||||
/**
|
||||
* 字典编码
|
||||
*/
|
||||
private String colCode;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
private String colName;
|
||||
|
||||
/**
|
||||
* 对照的标准字典
|
||||
*/
|
||||
private String contrastGbId;
|
||||
|
||||
/**
|
||||
* 对照的标准编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String contrastGbCode;
|
||||
|
||||
/**
|
||||
* 对照的标准名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String contrastGbName;
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package cn.datax.service.data.standard.api.entity;
|
||||
|
||||
import cn.datax.common.base.DataScopeBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName(value = "standard_contrast", autoResultMap = true)
|
||||
public class ContrastEntity extends DataScopeBaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 数据源主键
|
||||
*/
|
||||
private String sourceId;
|
||||
|
||||
/**
|
||||
* 数据源
|
||||
*/
|
||||
private String sourceName;
|
||||
|
||||
/**
|
||||
* 数据表主键
|
||||
*/
|
||||
private String tableId;
|
||||
|
||||
/**
|
||||
* 数据表
|
||||
*/
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 数据表名称
|
||||
*/
|
||||
private String tableComment;
|
||||
|
||||
/**
|
||||
* 对照字段主键
|
||||
*/
|
||||
private String columnId;
|
||||
|
||||
/**
|
||||
* 对照字段
|
||||
*/
|
||||
private String columnName;
|
||||
|
||||
/**
|
||||
* 对照字段名称
|
||||
*/
|
||||
private String columnComment;
|
||||
|
||||
/**
|
||||
* 标准类别主键
|
||||
*/
|
||||
private String gbTypeId;
|
||||
|
||||
/**
|
||||
* 标准类别编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String gbTypeCode;
|
||||
|
||||
/**
|
||||
* 标准类别名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String gbTypeName;
|
||||
|
||||
/**
|
||||
* 绑定标准字段
|
||||
*/
|
||||
private String bindGbColumn;
|
||||
|
||||
/**
|
||||
* 对照数量
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer mappingCount;
|
||||
|
||||
/**
|
||||
* 未对照数量
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer unMappingCount;
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.datax.service.data.standard.api.entity;
|
||||
|
||||
import cn.datax.common.base.DataScopeBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("standard_dict")
|
||||
public class DictEntity extends DataScopeBaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 所属类别
|
||||
*/
|
||||
private String typeId;
|
||||
|
||||
/**
|
||||
* 标准类别编码
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String gbTypeCode;
|
||||
|
||||
/**
|
||||
* 标准类别名称
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String gbTypeName;
|
||||
|
||||
/**
|
||||
* 标准编码
|
||||
*/
|
||||
private String gbCode;
|
||||
|
||||
/**
|
||||
* 标准名称
|
||||
*/
|
||||
private String gbName;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.datax.service.data.standard.api.entity;
|
||||
|
||||
import cn.datax.common.base.DataScopeBaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import cn.datax.common.base.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
@TableName("standard_type")
|
||||
public class TypeEntity extends DataScopeBaseEntity {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
/**
|
||||
* 标准类别编码
|
||||
*/
|
||||
private String gbTypeCode;
|
||||
|
||||
/**
|
||||
* 标准类别名称
|
||||
*/
|
||||
private String gbTypeName;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package cn.datax.service.data.standard.api.feign;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.feign.factory.StandardServiceFeignFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
@FeignClient(contextId = "standardServiceFeign", value = "service-data-standard", fallbackFactory = StandardServiceFeignFallbackFactory.class)
|
||||
public interface StandardServiceFeign {
|
||||
|
||||
@GetMapping("/contrasts/source/{sourceId}")
|
||||
ContrastEntity getBySourceId(@PathVariable String sourceId);
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.datax.service.data.standard.api.feign.factory;
|
||||
|
||||
import cn.datax.service.data.standard.api.feign.StandardServiceFeign;
|
||||
import cn.datax.service.data.standard.api.feign.fallback.StandardServiceFeignFallbackImpl;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class StandardServiceFeignFallbackFactory implements FallbackFactory<StandardServiceFeign> {
|
||||
|
||||
@Override
|
||||
public StandardServiceFeign create(Throwable throwable) {
|
||||
StandardServiceFeignFallbackImpl feignFallback = new StandardServiceFeignFallbackImpl();
|
||||
feignFallback.setCause(throwable);
|
||||
return feignFallback;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.datax.service.data.standard.api.feign.fallback;
|
||||
|
||||
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.feign.StandardServiceFeign;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class StandardServiceFeignFallbackImpl implements StandardServiceFeign {
|
||||
|
||||
@Setter
|
||||
private Throwable cause;
|
||||
|
||||
@Override
|
||||
public ContrastEntity getBySourceId(String sourceId) {
|
||||
log.error("feign 调用对照表查询出错", cause);
|
||||
throw new RuntimeException("feign 调用对照表查询出错", cause);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.datax.service.data.standard.api.query;
|
||||
|
||||
import cn.datax.common.base.BaseQueryParams;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 查询实体
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ContrastDictQuery extends BaseQueryParams {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String contrastId;
|
||||
private String colCode;
|
||||
private String colName;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.datax.service.data.standard.api.query;
|
||||
|
||||
import cn.datax.common.base.BaseQueryParams;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 查询实体
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ContrastQuery extends BaseQueryParams {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String sourceName;
|
||||
private String tableName;
|
||||
private String columnName;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package cn.datax.service.data.standard.api.query;
|
||||
|
||||
import cn.datax.common.base.BaseQueryParams;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 查询实体
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DictQuery extends BaseQueryParams {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String typeId;
|
||||
private String gbCode;
|
||||
private String gbName;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package cn.datax.service.data.standard.api.query;
|
||||
|
||||
import cn.datax.common.base.BaseQueryParams;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 查询实体
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TypeQuery extends BaseQueryParams {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String gbTypeCode;
|
||||
private String gbTypeName;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.datax.service.data.standard.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 实体VO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
public class ContrastDictVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String id;
|
||||
private String status;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
private String remark;
|
||||
private String contrastId;
|
||||
private String colCode;
|
||||
private String colName;
|
||||
private String contrastGbId;
|
||||
private String contrastGbCode;
|
||||
private String contrastGbName;
|
||||
private String sourceName;
|
||||
private String tableName;
|
||||
private String columnName;
|
||||
private String gbTypeCode;
|
||||
private String gbTypeName;
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.datax.service.data.standard.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 实体VO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
public class ContrastStatisticVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String id;
|
||||
private String status;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
private String remark;
|
||||
private String sourceId;
|
||||
private String sourceName;
|
||||
private String tableId;
|
||||
private String tableName;
|
||||
private String tableComment;
|
||||
private String columnId;
|
||||
private String columnName;
|
||||
private String columnComment;
|
||||
private String gbTypeId;
|
||||
private String gbTypeCode;
|
||||
private String gbTypeName;
|
||||
private String bindGbColumn;
|
||||
|
||||
private Integer mappingCount;
|
||||
private Integer unMappingCount;
|
||||
/**
|
||||
* 对照比例 20%
|
||||
*/
|
||||
private String mappingPercent;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package cn.datax.service.data.standard.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ContrastTreeVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String id;
|
||||
private String label;
|
||||
private String name;
|
||||
/**
|
||||
* 数据
|
||||
*/
|
||||
private Object data;
|
||||
private List<ContrastTreeVo> children;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.datax.service.data.standard.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 实体VO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Data
|
||||
public class ContrastVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String id;
|
||||
private String status;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
private String remark;
|
||||
private String sourceId;
|
||||
private String sourceName;
|
||||
private String tableId;
|
||||
private String tableName;
|
||||
private String tableComment;
|
||||
private String columnId;
|
||||
private String columnName;
|
||||
private String columnComment;
|
||||
private String gbTypeId;
|
||||
private String gbTypeCode;
|
||||
private String gbTypeName;
|
||||
private String bindGbColumn;
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.datax.service.data.standard.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 实体VO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Data
|
||||
public class DictVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String id;
|
||||
private String status;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
private String remark;
|
||||
private String typeId;
|
||||
private String gbTypeCode;
|
||||
private String gbTypeName;
|
||||
private String gbCode;
|
||||
private String gbName;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.datax.service.data.standard.api.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 实体VO
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Data
|
||||
public class TypeVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
private String id;
|
||||
private String status;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
private String remark;
|
||||
private String gbTypeCode;
|
||||
private String gbTypeName;
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
cn.datax.service.data.standard.api.feign.factory.StandardServiceFeignFallbackFactory,\
|
||||
cn.datax.service.data.standard.api.feign.fallback.StandardServiceFeignFallbackImpl
|
||||
@@ -0,0 +1,82 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>data-standard-service-parent</artifactId>
|
||||
<groupId>com.platform</groupId>
|
||||
<version>0.4.x</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>0.4.x</version>
|
||||
<artifactId>data-standard-service</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!--配置中心客户端 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-config</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-mybatis</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-redis</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-security</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>common-log</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.platform</groupId>
|
||||
<artifactId>data-standard-service-api</artifactId>
|
||||
<version>0.4.x</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.datax.service.data.standard;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
@EnableFeignClients(basePackages = {"cn.datax.service.system.api.feign"})
|
||||
@SpringBootApplication
|
||||
public class DataxStandardApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(DataxStandardApplication.class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package cn.datax.service.data.standard.config;
|
||||
|
||||
import com.baomidou.dynamic.datasource.DynamicRoutingDataSource;
|
||||
import com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationAdvisor;
|
||||
import com.baomidou.dynamic.datasource.aop.DynamicDataSourceAnnotationInterceptor;
|
||||
import com.baomidou.dynamic.datasource.processor.DsProcessor;
|
||||
import com.baomidou.dynamic.datasource.provider.DynamicDataSourceProvider;
|
||||
import com.baomidou.dynamic.datasource.provider.YmlDynamicDataSourceProvider;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DataSourceProperty;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceCreatorAutoConfiguration;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.DynamicDataSourceProperties;
|
||||
import com.baomidou.dynamic.datasource.spring.boot.autoconfigure.druid.DruidDynamicDataSourceConfiguration;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.Role;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 动态数据源核心自动配置类
|
||||
* @author AllDataDC
|
||||
* @date 2023/03/17
|
||||
*/
|
||||
@Slf4j
|
||||
@Configuration
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties(DynamicDataSourceProperties.class)
|
||||
@AutoConfigureBefore(DataSourceAutoConfiguration.class)
|
||||
@Import(value = {DruidDynamicDataSourceConfiguration.class, DynamicDataSourceCreatorAutoConfiguration.class})
|
||||
@ConditionalOnProperty(prefix = DynamicDataSourceProperties.PREFIX, name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
public class DynamicDSConfiguration {
|
||||
|
||||
private final DynamicDataSourceProperties properties;
|
||||
|
||||
//读取多数据源配置,注入到spring容器中
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DynamicDataSourceProvider dynamicDataSourceProvider() {
|
||||
Map<String, DataSourceProperty> datasourceMap = properties.getDatasource();
|
||||
return new YmlDynamicDataSourceProvider(datasourceMap);
|
||||
}
|
||||
|
||||
//注册自己的动态多数据源DataSource
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DataSource dataSource(DynamicDataSourceProvider dynamicDataSourceProvider) {
|
||||
DynamicRoutingDataSource dataSource = new DynamicRoutingDataSource();
|
||||
dataSource.setPrimary(properties.getPrimary());
|
||||
dataSource.setStrict(properties.getStrict());
|
||||
dataSource.setStrategy(properties.getStrategy());
|
||||
dataSource.setProvider(dynamicDataSourceProvider);
|
||||
dataSource.setP6spy(properties.getP6spy());
|
||||
dataSource.setSeata(properties.getSeata());
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
//AOP切面,对DS注解过的方法进行增强,达到切换数据源的目的
|
||||
@Role(value = BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DynamicDataSourceAnnotationAdvisor dynamicDatasourceAnnotationAdvisor(DsProcessor dsProcessor) {
|
||||
DynamicDataSourceAnnotationInterceptor interceptor = new DynamicDataSourceAnnotationInterceptor(properties.isAllowedPublicOnly(), dsProcessor);
|
||||
DynamicDataSourceAnnotationAdvisor advisor = new DynamicDataSourceAnnotationAdvisor(interceptor);
|
||||
advisor.setOrder(properties.getOrder());
|
||||
return advisor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.datax.service.data.standard.config;
|
||||
|
||||
import cn.datax.common.core.RedisConstant;
|
||||
import cn.datax.common.redis.service.RedisService;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.dao.DictDao;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class StartedUpRunner implements ApplicationRunner {
|
||||
|
||||
private final ConfigurableApplicationContext context;
|
||||
private final Environment environment;
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args) {
|
||||
if (context.isActive()) {
|
||||
String banner = "-----------------------------------------\n" +
|
||||
"服务启动成功,时间:" + DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.now()) + "\n" +
|
||||
"服务名称:" + environment.getProperty("spring.application.name") + "\n" +
|
||||
"端口号:" + environment.getProperty("server.port") + "\n" +
|
||||
"-----------------------------------------";
|
||||
System.out.println(banner);
|
||||
|
||||
// 项目启动时,初始化缓存
|
||||
String dictKey = RedisConstant.STANDARD_DICT_KEY;
|
||||
Boolean hasDictKey = redisService.hasKey(dictKey);
|
||||
if (!hasDictKey) {
|
||||
List<DictEntity> dictEntityList = dictDao.selectList(Wrappers.emptyWrapper());
|
||||
Map<String, List<DictEntity>> dictListMap = dictEntityList.stream().collect(Collectors.groupingBy(DictEntity::getTypeId));
|
||||
redisTemplate.opsForHash().putAll(dictKey, dictListMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,117 @@
|
||||
package cn.datax.service.data.standard.config;
|
||||
|
||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||
import springfox.documentation.builders.*;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "swagger", name = "enable", havingValue = "true")
|
||||
@EnableConfigurationProperties(SwaggerProperties.class)
|
||||
@EnableSwagger2
|
||||
@EnableKnife4j
|
||||
@Import(BeanValidatorPluginsConfiguration.class)
|
||||
public class SwaggerConfig {
|
||||
|
||||
@Autowired
|
||||
private SwaggerProperties swaggerProperties;
|
||||
|
||||
/**
|
||||
* 创建API应用
|
||||
* apiInfo() 增加API相关信息
|
||||
* 通过select()函数返回一个ApiSelectorBuilder实例,用来控制哪些接口暴露给Swagger来展现,
|
||||
* 本例采用指定扫描的包路径来定义指定要建立API的目录。
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi(){
|
||||
//版本类型是swagger2
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
//通过调用自定义方法apiInfo,获得文档的主要信息
|
||||
.apiInfo(apiInfo())
|
||||
//设置全局参数
|
||||
.globalOperationParameters(globalParamBuilder())
|
||||
//设置全局响应参数
|
||||
.globalResponseMessage(RequestMethod.GET,responseBuilder())
|
||||
.globalResponseMessage(RequestMethod.POST,responseBuilder())
|
||||
.globalResponseMessage(RequestMethod.PUT,responseBuilder())
|
||||
.globalResponseMessage(RequestMethod.DELETE,responseBuilder())
|
||||
.select()
|
||||
//扫描该包下面的API注解
|
||||
.apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
//设置安全认证
|
||||
;
|
||||
}
|
||||
/**
|
||||
* 创建该API的基本信息(这些基本信息会展现在文档页面中)
|
||||
* 访问地址:http://项目实际地址/swagger-ui.html
|
||||
* @return
|
||||
*/
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title(swaggerProperties.getTitle())
|
||||
.description(swaggerProperties.getDescription())
|
||||
.termsOfServiceUrl(swaggerProperties.getTermsOfServiceUrl())
|
||||
.version(swaggerProperties.getVersion())
|
||||
.contact(new Contact(swaggerProperties.getContact().getName(), swaggerProperties.getContact().getUrl(), swaggerProperties.getContact().getEmail()))
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全认证参数
|
||||
* @return
|
||||
*/
|
||||
private List<ApiKey> security() {
|
||||
List<ApiKey> apiKeys = new ArrayList<>();
|
||||
apiKeys.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||
return apiKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建全局参数列表
|
||||
* @return
|
||||
*/
|
||||
private List<Parameter> globalParamBuilder(){
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
pars.add(parameterBuilder("Authorization","令牌","string","header",false).build());
|
||||
return pars;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建参数
|
||||
* @return
|
||||
*/
|
||||
private ParameterBuilder parameterBuilder(String name, String desc, String type, String parameterType, boolean required) {
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
tokenPar.name(name).description(desc).modelRef(new ModelRef(type)).parameterType(parameterType).required(required).build();
|
||||
return tokenPar;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建全局响应值
|
||||
* @return
|
||||
*/
|
||||
private List<ResponseMessage> responseBuilder() {
|
||||
List<ResponseMessage> responseMessageList = new ArrayList<>();
|
||||
responseMessageList.add(new ResponseMessageBuilder().code(200).message("响应成功").build());
|
||||
responseMessageList.add(new ResponseMessageBuilder().code(500).message("服务器内部错误").build());
|
||||
return responseMessageList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package cn.datax.service.data.standard.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@ConfigurationProperties(ignoreUnknownFields = false, prefix = "swagger")
|
||||
public class SwaggerProperties {
|
||||
|
||||
private Boolean enable;
|
||||
private String title;
|
||||
private String description;
|
||||
private String version;
|
||||
private String termsOfServiceUrl;
|
||||
private String basePackage;
|
||||
private Contact contact;
|
||||
|
||||
public Boolean getEnable() {
|
||||
return enable;
|
||||
}
|
||||
|
||||
public void setEnable(Boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getTermsOfServiceUrl() {
|
||||
return termsOfServiceUrl;
|
||||
}
|
||||
|
||||
public void setTermsOfServiceUrl(String termsOfServiceUrl) {
|
||||
this.termsOfServiceUrl = termsOfServiceUrl;
|
||||
}
|
||||
|
||||
public String getBasePackage() {
|
||||
return basePackage;
|
||||
}
|
||||
|
||||
public void setBasePackage(String basePackage) {
|
||||
this.basePackage = basePackage;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public static class Contact {
|
||||
private String name;
|
||||
private String url;
|
||||
private String email;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package cn.datax.service.data.standard.config;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
|
||||
|
||||
@Configuration
|
||||
@EnableWebSecurity(debug = false)
|
||||
public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
http.csrf().disable().authorizeRequests().anyRequest().permitAll().and().logout().permitAll();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package cn.datax.service.data.standard.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.security.annotation.DataInner;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastStatisticVo;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastTreeVo;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastVo;
|
||||
import cn.datax.service.data.standard.api.query.ContrastQuery;
|
||||
import cn.datax.service.data.standard.mapstruct.ContrastMapper;
|
||||
import cn.datax.service.data.standard.service.ContrastService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Api(tags = {"对照表信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/contrasts")
|
||||
public class ContrastController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ContrastService contrastService;
|
||||
|
||||
@Autowired
|
||||
private ContrastMapper contrastMapper;
|
||||
|
||||
/**
|
||||
* 根据数据源id查询
|
||||
* @param sourceId
|
||||
* @return
|
||||
*/
|
||||
@DataInner
|
||||
@GetMapping("/source/{sourceId}")
|
||||
public ContrastEntity getBySourceId(@PathVariable String sourceId) {
|
||||
return contrastService.getBySourceId(sourceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getContrastById(@PathVariable String id) {
|
||||
ContrastEntity contrastEntity = contrastService.getContrastById(id);
|
||||
return R.ok().setData(contrastMapper.toVO(contrastEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param contrastQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "contrastQuery", value = "查询实体contrastQuery", required = true, dataTypeClass = ContrastQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getContrastPage(ContrastQuery contrastQuery) {
|
||||
QueryWrapper<ContrastEntity> queryWrapper = new QueryWrapper<>();
|
||||
IPage<ContrastEntity> page = contrastService.page(new Page<>(contrastQuery.getPageNum(), contrastQuery.getPageSize()), queryWrapper);
|
||||
List<ContrastVo> collect = page.getRecords().stream().map(contrastMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<ContrastVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param contrast
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据contrast对象添加信息")
|
||||
@ApiImplicitParam(name = "contrast", value = "详细实体contrast", required = true, dataType = "ContrastDto")
|
||||
@PostMapping()
|
||||
public R saveContrast(@RequestBody @Validated({ValidationGroups.Insert.class}) ContrastDto contrast) {
|
||||
ContrastEntity contrastEntity = contrastService.saveContrast(contrast);
|
||||
return R.ok().setData(contrastMapper.toVO(contrastEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param contrast
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "contrast", value = "详细实体contrast", required = true, dataType = "ContrastDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateContrast(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ContrastDto contrast) {
|
||||
ContrastEntity contrastEntity = contrastService.updateContrast(contrast);
|
||||
return R.ok().setData(contrastMapper.toVO(contrastEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteContrastById(@PathVariable String id) {
|
||||
contrastService.deleteContrastById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteContrastBatch(@PathVariable List<String> ids) {
|
||||
contrastService.deleteContrastBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/tree")
|
||||
public R getContrastTree() {
|
||||
List<ContrastTreeVo> list = contrastService.getContrastTree();
|
||||
return R.ok().setData(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询统计信息
|
||||
*
|
||||
* @param contrastQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "contrastQuery", value = "查询实体contrastQuery", required = true, dataTypeClass = ContrastQuery.class)
|
||||
})
|
||||
@GetMapping("/stat")
|
||||
public R contrastStat(ContrastQuery contrastQuery) {
|
||||
QueryWrapper<ContrastEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(contrastQuery.getSourceName()), "c.source_name", contrastQuery.getSourceName());
|
||||
queryWrapper.like(StrUtil.isNotBlank(contrastQuery.getTableName()), "c.table_name", contrastQuery.getTableName());
|
||||
queryWrapper.like(StrUtil.isNotBlank(contrastQuery.getColumnName()), "c.column_name", contrastQuery.getColumnName());
|
||||
IPage<ContrastEntity> page = contrastService.statistic(new Page<>(contrastQuery.getPageNum(), contrastQuery.getPageSize()), queryWrapper);
|
||||
List<ContrastStatisticVo> collect = page.getRecords().stream().map(contrastMapper::toSVO).collect(Collectors.toList());
|
||||
JsonPage<ContrastStatisticVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package cn.datax.service.data.standard.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastDictVo;
|
||||
import cn.datax.service.data.standard.api.query.ContrastDictQuery;
|
||||
import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
|
||||
import cn.datax.service.data.standard.service.ContrastDictService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Api(tags = {"字典对照信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/contrastDicts")
|
||||
public class ContrastDictController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private ContrastDictService contrastDictService;
|
||||
|
||||
@Autowired
|
||||
private ContrastDictMapper contrastDictMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getContrastDictById(@PathVariable String id) {
|
||||
ContrastDictEntity contrastDictEntity = contrastDictService.getContrastDictById(id);
|
||||
return R.ok().setData(contrastDictMapper.toVO(contrastDictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param contrastDictQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "contrastDictQuery", value = "查询实体contrastDictQuery", required = true, dataTypeClass = ContrastDictQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getContrastDictPage(ContrastDictQuery contrastDictQuery) {
|
||||
QueryWrapper<ContrastDictEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(contrastDictQuery.getContrastId()), "d.contrast_id", contrastDictQuery.getContrastId());
|
||||
queryWrapper.like(StrUtil.isNotBlank(contrastDictQuery.getColCode()), "d.col_code", contrastDictQuery.getColCode());
|
||||
queryWrapper.like(StrUtil.isNotBlank(contrastDictQuery.getColName()), "d.col_name", contrastDictQuery.getColName());
|
||||
IPage<ContrastDictEntity> page = contrastDictService.page(new Page<>(contrastDictQuery.getPageNum(), contrastDictQuery.getPageSize()), queryWrapper);
|
||||
List<ContrastDictVo> collect = page.getRecords().stream().map(contrastDictMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<ContrastDictVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param contrastDict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据contrastDict对象添加信息")
|
||||
@ApiImplicitParam(name = "contrastDict", value = "详细实体contrastDict", required = true, dataType = "ContrastDictDto")
|
||||
@PostMapping()
|
||||
public R saveContrastDict(@RequestBody @Validated({ValidationGroups.Insert.class}) ContrastDictDto contrastDict) {
|
||||
ContrastDictEntity contrastDictEntity = contrastDictService.saveContrastDict(contrastDict);
|
||||
return R.ok().setData(contrastDictMapper.toVO(contrastDictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param contrastDict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "contrastDict", value = "详细实体contrastDict", required = true, dataType = "ContrastDictDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateContrastDict(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) ContrastDictDto contrastDict) {
|
||||
ContrastDictEntity contrastDictEntity = contrastDictService.updateContrastDict(contrastDict);
|
||||
return R.ok().setData(contrastDictMapper.toVO(contrastDictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteContrastDictById(@PathVariable String id) {
|
||||
contrastDictService.deleteContrastDictById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteContrastDictBatch(@PathVariable List<String> ids) {
|
||||
contrastDictService.deleteContrastDictBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,149 @@
|
||||
package cn.datax.service.data.standard.controller;
|
||||
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.data.standard.api.dto.DictDto;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.api.vo.DictVo;
|
||||
import cn.datax.service.data.standard.api.query.DictQuery;
|
||||
import cn.datax.service.data.standard.mapstruct.DictMapper;
|
||||
import cn.datax.service.data.standard.service.DictService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Api(tags = {"数据标准字典表"})
|
||||
@RestController
|
||||
@RequestMapping("/dicts")
|
||||
public class DictController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DictService dictService;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getDictById(@PathVariable String id) {
|
||||
DictEntity dictEntity = dictService.getDictById(id);
|
||||
return R.ok().setData(dictMapper.toVO(dictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param dictQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dictQuery", value = "查询实体dictQuery", required = true, dataTypeClass = DictQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getDictPage(DictQuery dictQuery) {
|
||||
QueryWrapper<DictEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(StrUtil.isNotBlank(dictQuery.getTypeId()), "d.type_id", dictQuery.getTypeId());
|
||||
queryWrapper.like(StrUtil.isNotBlank(dictQuery.getGbCode()), "d.gb_code", dictQuery.getGbCode());
|
||||
queryWrapper.like(StrUtil.isNotBlank(dictQuery.getGbName()), "d.gb_name", dictQuery.getGbName());
|
||||
IPage<DictEntity> page = dictService.page(new Page<>(dictQuery.getPageNum(), dictQuery.getPageSize()), queryWrapper);
|
||||
List<DictVo> collect = page.getRecords().stream().map(dictMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<DictVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param dict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据dict对象添加信息")
|
||||
@ApiImplicitParam(name = "dict", value = "详细实体dict", required = true, dataType = "DictDto")
|
||||
@PostMapping()
|
||||
public R saveDict(@RequestBody @Validated({ValidationGroups.Insert.class}) DictDto dict) {
|
||||
DictEntity dictEntity = dictService.saveDict(dict);
|
||||
return R.ok().setData(dictMapper.toVO(dictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param dict
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "dict", value = "详细实体dict", required = true, dataType = "DictDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateDict(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) DictDto dict) {
|
||||
DictEntity dictEntity = dictService.updateDict(dict);
|
||||
return R.ok().setData(dictMapper.toVO(dictEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteDictById(@PathVariable String id) {
|
||||
dictService.deleteDictById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteDictBatch(@PathVariable List<String> ids) {
|
||||
dictService.deleteDictBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新字典缓存
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/refresh")
|
||||
public R refreshDict() {
|
||||
dictService.refreshDict();
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package cn.datax.service.data.standard.controller;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.service.data.standard.api.dto.ManualMappingDto;
|
||||
import cn.datax.service.data.standard.service.DictMappingService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Api(tags = {"字典对照映射"})
|
||||
@RestController
|
||||
@RequestMapping("/mappings")
|
||||
public class DictMappingController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private DictMappingService dictMappingService;
|
||||
|
||||
@GetMapping("/{id}")
|
||||
public R getDictMapping(@PathVariable String id) {
|
||||
Map<String, Object> map = dictMappingService.getDictMapping(id);
|
||||
return R.ok().setData(map);
|
||||
}
|
||||
|
||||
@PostMapping("/auto/{id}")
|
||||
public R dictAutoMapping(@PathVariable String id) {
|
||||
dictMappingService.dictAutoMapping(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/manual")
|
||||
public R dictManualMapping(@RequestBody @Validated ManualMappingDto manualMappingDto) {
|
||||
dictMappingService.dictManualMapping(manualMappingDto);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/cancel/{id}")
|
||||
public R dictCancelMapping(@PathVariable String id) {
|
||||
dictMappingService.dictCancelMapping(id);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package cn.datax.service.data.standard.controller;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inner")
|
||||
public class InnerController extends BaseController {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package cn.datax.service.data.standard.controller;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.common.core.JsonPage;
|
||||
import cn.datax.common.core.R;
|
||||
import cn.datax.common.validate.ValidationGroups;
|
||||
import cn.datax.service.data.standard.api.dto.TypeDto;
|
||||
import cn.datax.service.data.standard.api.entity.TypeEntity;
|
||||
import cn.datax.service.data.standard.api.vo.TypeVo;
|
||||
import cn.datax.service.data.standard.api.query.TypeQuery;
|
||||
import cn.datax.service.data.standard.mapstruct.TypeMapper;
|
||||
import cn.datax.service.data.standard.service.TypeService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.datax.common.base.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Api(tags = {"标准类别信息表"})
|
||||
@RestController
|
||||
@RequestMapping("/types")
|
||||
public class TypeController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private TypeService typeService;
|
||||
|
||||
@Autowired
|
||||
private TypeMapper typeMapper;
|
||||
|
||||
/**
|
||||
* 通过ID查询信息
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@GetMapping("/{id}")
|
||||
public R getTypeById(@PathVariable String id) {
|
||||
TypeEntity typeEntity = typeService.getTypeById(id);
|
||||
return R.ok().setData(typeMapper.toVO(typeEntity));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取列表", notes = "")
|
||||
@GetMapping("/list")
|
||||
public R getTypeList() {
|
||||
QueryWrapper<TypeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status", DataConstant.EnableState.ENABLE.getKey());
|
||||
List<TypeEntity> list = typeService.list(queryWrapper);
|
||||
List<TypeVo> collect = list.stream().map(typeMapper::toVO).collect(Collectors.toList());
|
||||
return R.ok().setData(collect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询信息
|
||||
*
|
||||
* @param typeQuery
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页查询", notes = "")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "typeQuery", value = "查询实体typeQuery", required = true, dataTypeClass = TypeQuery.class)
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public R getTypePage(TypeQuery typeQuery) {
|
||||
QueryWrapper<TypeEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.like(StrUtil.isNotBlank(typeQuery.getGbTypeCode()), "gb_type_code", typeQuery.getGbTypeCode());
|
||||
queryWrapper.like(StrUtil.isNotBlank(typeQuery.getGbTypeName()), "gb_type_name", typeQuery.getGbTypeName());
|
||||
IPage<TypeEntity> page = typeService.page(new Page<>(typeQuery.getPageNum(), typeQuery.getPageSize()), queryWrapper);
|
||||
List<TypeVo> collect = page.getRecords().stream().map(typeMapper::toVO).collect(Collectors.toList());
|
||||
JsonPage<TypeVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
|
||||
return R.ok().setData(jsonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "添加信息", notes = "根据type对象添加信息")
|
||||
@ApiImplicitParam(name = "type", value = "详细实体type", required = true, dataType = "TypeDto")
|
||||
@PostMapping()
|
||||
public R saveType(@RequestBody @Validated({ValidationGroups.Insert.class}) TypeDto type) {
|
||||
TypeEntity typeEntity = typeService.saveType(type);
|
||||
return R.ok().setData(typeMapper.toVO(typeEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "修改信息", notes = "根据url的id来指定修改对象,并根据传过来的信息来修改详细信息")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path"),
|
||||
@ApiImplicitParam(name = "type", value = "详细实体type", required = true, dataType = "TypeDto")
|
||||
})
|
||||
@PutMapping("/{id}")
|
||||
public R updateType(@PathVariable String id, @RequestBody @Validated({ValidationGroups.Update.class}) TypeDto type) {
|
||||
TypeEntity typeEntity = typeService.updateType(type);
|
||||
return R.ok().setData(typeMapper.toVO(typeEntity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除", notes = "根据url的id来指定删除对象")
|
||||
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
|
||||
@DeleteMapping("/{id}")
|
||||
public R deleteTypeById(@PathVariable String id) {
|
||||
typeService.deleteTypeById(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "批量删除角色", notes = "根据url的ids来批量删除对象")
|
||||
@ApiImplicitParam(name = "ids", value = "ID集合", required = true, dataType = "List", paramType = "path")
|
||||
@DeleteMapping("/batch/{ids}")
|
||||
public R deleteTypeBatch(@PathVariable List<String> ids) {
|
||||
typeService.deleteTypeBatch(ids);
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.datax.service.data.standard.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface ContrastDao extends BaseDao<ContrastEntity> {
|
||||
|
||||
@Override
|
||||
ContrastEntity selectById(Serializable id);
|
||||
|
||||
IPage<ContrastEntity> statistic(IPage<ContrastEntity> page, @Param(Constants.WRAPPER) Wrapper<ContrastEntity> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.datax.service.data.standard.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Mapper
|
||||
public interface ContrastDictDao extends BaseDao<ContrastDictEntity> {
|
||||
|
||||
@Override
|
||||
List<ContrastDictEntity> selectList(@Param(Constants.WRAPPER) Wrapper<ContrastDictEntity> queryWrapper);
|
||||
|
||||
@Override
|
||||
<E extends IPage<ContrastDictEntity>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<ContrastDictEntity> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package cn.datax.service.data.standard.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Mapper
|
||||
public interface DictDao extends BaseDao<DictEntity> {
|
||||
|
||||
@Override
|
||||
DictEntity selectById(Serializable id);
|
||||
|
||||
@Override
|
||||
<E extends IPage<DictEntity>> E selectPage(E page, @Param(Constants.WRAPPER) Wrapper<DictEntity> queryWrapper);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package cn.datax.service.data.standard.dao;
|
||||
|
||||
import cn.datax.common.base.BaseDao;
|
||||
import cn.datax.service.data.standard.api.entity.TypeEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Mapper
|
||||
public interface TypeDao extends BaseDao<TypeEntity> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.data.standard.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastDictVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ContrastDictMapper extends EntityMapper<ContrastDictDto, ContrastDictEntity, ContrastDictVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.datax.service.data.standard.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastStatisticVo;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface ContrastMapper extends EntityMapper<ContrastDto, ContrastEntity, ContrastVo> {
|
||||
|
||||
/**
|
||||
* 将源对象转换为VO对象
|
||||
* @param e
|
||||
* @return D
|
||||
*/
|
||||
ContrastStatisticVo toSVO(ContrastEntity e);
|
||||
|
||||
/**
|
||||
* 将源对象集合转换为VO对象集合
|
||||
* @param es
|
||||
* @return List<D>
|
||||
*/
|
||||
List<ContrastStatisticVo> toSVO(List<ContrastEntity> es);
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.data.standard.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.data.standard.api.dto.DictDto;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.api.vo.DictVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface DictMapper extends EntityMapper<DictDto, DictEntity, DictVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package cn.datax.service.data.standard.mapstruct;
|
||||
|
||||
import cn.datax.common.mapstruct.EntityMapper;
|
||||
import cn.datax.service.data.standard.api.dto.TypeDto;
|
||||
import cn.datax.service.data.standard.api.entity.TypeEntity;
|
||||
import cn.datax.service.data.standard.api.vo.TypeVo;
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 Mapper 实体映射
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Mapper(componentModel = "spring")
|
||||
public interface TypeMapper extends EntityMapper<TypeDto, TypeEntity, TypeVo> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.datax.service.data.standard.service;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
public interface ContrastDictService extends BaseService<ContrastDictEntity> {
|
||||
|
||||
ContrastDictEntity saveContrastDict(ContrastDictDto contrastDict);
|
||||
|
||||
ContrastDictEntity updateContrastDict(ContrastDictDto contrastDict);
|
||||
|
||||
ContrastDictEntity getContrastDictById(String id);
|
||||
|
||||
void deleteContrastDictById(String id);
|
||||
|
||||
void deleteContrastDictBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.datax.service.data.standard.service;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDto;
|
||||
import cn.datax.common.base.BaseService;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastTreeVo;
|
||||
import cn.datax.service.system.api.entity.UserEntity;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
public interface ContrastService extends BaseService<ContrastEntity> {
|
||||
|
||||
ContrastEntity saveContrast(ContrastDto contrast);
|
||||
|
||||
ContrastEntity updateContrast(ContrastDto contrast);
|
||||
|
||||
ContrastEntity getContrastById(String id);
|
||||
|
||||
void deleteContrastById(String id);
|
||||
|
||||
void deleteContrastBatch(List<String> ids);
|
||||
|
||||
List<ContrastTreeVo> getContrastTree();
|
||||
|
||||
IPage<ContrastEntity> statistic(IPage<ContrastEntity> page, Wrapper<ContrastEntity> queryWrapper);
|
||||
|
||||
ContrastEntity getBySourceId(String sourceId);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package cn.datax.service.data.standard.service;
|
||||
|
||||
import cn.datax.service.data.standard.api.dto.ManualMappingDto;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface DictMappingService {
|
||||
|
||||
Map<String, Object> getDictMapping(String id);
|
||||
|
||||
void dictAutoMapping(String id);
|
||||
|
||||
void dictManualMapping(ManualMappingDto manualMappingDto);
|
||||
|
||||
void dictCancelMapping(String id);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package cn.datax.service.data.standard.service;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.api.dto.DictDto;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
public interface DictService extends BaseService<DictEntity> {
|
||||
|
||||
DictEntity saveDict(DictDto dict);
|
||||
|
||||
DictEntity updateDict(DictDto dict);
|
||||
|
||||
DictEntity getDictById(String id);
|
||||
|
||||
void deleteDictById(String id);
|
||||
|
||||
void deleteDictBatch(List<String> ids);
|
||||
|
||||
void refreshDict();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.datax.service.data.standard.service;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.TypeEntity;
|
||||
import cn.datax.service.data.standard.api.dto.TypeDto;
|
||||
import cn.datax.common.base.BaseService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
public interface TypeService extends BaseService<TypeEntity> {
|
||||
|
||||
TypeEntity saveType(TypeDto type);
|
||||
|
||||
TypeEntity updateType(TypeDto type);
|
||||
|
||||
TypeEntity getTypeById(String id);
|
||||
|
||||
void deleteTypeById(String id);
|
||||
|
||||
void deleteTypeBatch(List<String> ids);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.datax.service.data.standard.service.impl;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDictDto;
|
||||
import cn.datax.service.data.standard.service.ContrastDictService;
|
||||
import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
|
||||
import cn.datax.service.data.standard.dao.ContrastDictDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 字典对照信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class ContrastDictServiceImpl extends BaseServiceImpl<ContrastDictDao, ContrastDictEntity> implements ContrastDictService {
|
||||
|
||||
@Autowired
|
||||
private ContrastDictDao contrastDictDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastDictMapper contrastDictMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ContrastDictEntity saveContrastDict(ContrastDictDto contrastDictDto) {
|
||||
ContrastDictEntity contrastDict = contrastDictMapper.toEntity(contrastDictDto);
|
||||
contrastDictDao.insert(contrastDict);
|
||||
return contrastDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ContrastDictEntity updateContrastDict(ContrastDictDto contrastDictDto) {
|
||||
ContrastDictEntity contrastDict = contrastDictMapper.toEntity(contrastDictDto);
|
||||
contrastDictDao.updateById(contrastDict);
|
||||
return contrastDict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContrastDictEntity getContrastDictById(String id) {
|
||||
ContrastDictEntity contrastDictEntity = super.getById(id);
|
||||
return contrastDictEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteContrastDictById(String id) {
|
||||
contrastDictDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteContrastDictBatch(List<String> ids) {
|
||||
contrastDictDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package cn.datax.service.data.standard.service.impl;
|
||||
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import cn.datax.service.data.standard.api.dto.ContrastDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastTreeVo;
|
||||
import cn.datax.service.data.standard.dao.ContrastDao;
|
||||
import cn.datax.service.data.standard.dao.ContrastDictDao;
|
||||
import cn.datax.service.data.standard.mapstruct.ContrastMapper;
|
||||
import cn.datax.service.data.standard.service.ContrastService;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 对照表信息表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-27
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class ContrastServiceImpl extends BaseServiceImpl<ContrastDao, ContrastEntity> implements ContrastService {
|
||||
|
||||
@Autowired
|
||||
private ContrastDao contrastDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastDictDao contrastDictDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastMapper contrastMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ContrastEntity saveContrast(ContrastDto contrastDto) {
|
||||
ContrastEntity contrast = contrastMapper.toEntity(contrastDto);
|
||||
contrastDao.insert(contrast);
|
||||
return contrast;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ContrastEntity updateContrast(ContrastDto contrastDto) {
|
||||
ContrastEntity contrast = contrastMapper.toEntity(contrastDto);
|
||||
contrastDao.updateById(contrast);
|
||||
return contrast;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContrastEntity getContrastById(String id) {
|
||||
ContrastEntity contrastEntity = super.getById(id);
|
||||
return contrastEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteContrastById(String id) {
|
||||
ContrastDictEntity dictEntity = contrastDictDao.selectOne(new QueryWrapper<ContrastDictEntity>().eq("contrast_id", id).last("limit 1"));
|
||||
if (dictEntity != null) {
|
||||
throw new RuntimeException("存在对照字典数据与之关联,不允许删除!");
|
||||
}
|
||||
contrastDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteContrastBatch(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
deleteContrastById(id);
|
||||
}
|
||||
//contrastDao.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ContrastTreeVo> getContrastTree() {
|
||||
List<ContrastTreeVo> list = new ArrayList<>();
|
||||
List<ContrastEntity> contrastEntityList = contrastDao.selectList(Wrappers.emptyWrapper());
|
||||
Map<String, List<ContrastEntity>> sourceMap = contrastEntityList.stream().collect(Collectors.groupingBy(ContrastEntity::getSourceId));
|
||||
Iterator<Map.Entry<String, List<ContrastEntity>>> sourceIterator = sourceMap.entrySet().iterator();
|
||||
while (sourceIterator.hasNext()) {
|
||||
Map.Entry<String, List<ContrastEntity>> sourceEntry = sourceIterator.next();
|
||||
String sourceId = sourceEntry.getKey();
|
||||
List<ContrastEntity> sourceList = sourceEntry.getValue();
|
||||
String sourceName = sourceList.get(0).getSourceName();
|
||||
ContrastTreeVo sourceTree = new ContrastTreeVo();
|
||||
sourceTree.setId(sourceId);
|
||||
sourceTree.setLabel(sourceName);
|
||||
Map<String, List<ContrastEntity>> tableMap = sourceList.stream().collect(Collectors.groupingBy(ContrastEntity::getTableId));
|
||||
Iterator<Map.Entry<String, List<ContrastEntity>>> tableIterator = tableMap.entrySet().iterator();
|
||||
List<ContrastTreeVo> tableTreeList = new ArrayList<>();
|
||||
while (tableIterator.hasNext()) {
|
||||
Map.Entry<String, List<ContrastEntity>> tableEntry = tableIterator.next();
|
||||
String tableId = tableEntry.getKey();
|
||||
List<ContrastEntity> tableList = tableEntry.getValue();
|
||||
String tableName = tableList.get(0).getTableName();
|
||||
String tableComment = tableList.get(0).getTableComment();
|
||||
ContrastTreeVo tableTree = new ContrastTreeVo();
|
||||
tableTree.setId(tableId);
|
||||
tableTree.setLabel(tableName);
|
||||
tableTree.setName(tableComment);
|
||||
List<ContrastTreeVo> columnTreeList = tableList.stream().map(s -> {
|
||||
ContrastTreeVo columnTree = new ContrastTreeVo();
|
||||
columnTree.setId(s.getId());
|
||||
columnTree.setLabel(s.getColumnName());
|
||||
columnTree.setName(s.getColumnComment());
|
||||
columnTree.setData(s);
|
||||
return columnTree;
|
||||
}).collect(Collectors.toList());
|
||||
tableTree.setChildren(columnTreeList);
|
||||
tableTreeList.add(tableTree);
|
||||
}
|
||||
sourceTree.setChildren(tableTreeList);
|
||||
list.add(sourceTree);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<ContrastEntity> statistic(IPage<ContrastEntity> page, Wrapper<ContrastEntity> queryWrapper) {
|
||||
return contrastDao.statistic(page, queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContrastEntity getBySourceId(String sourceId) {
|
||||
return contrastDao.selectOne(new QueryWrapper<ContrastEntity>().eq("source_id", sourceId).last("limit 1"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package cn.datax.service.data.standard.service.impl;
|
||||
|
||||
import cn.datax.common.core.DataConstant;
|
||||
import cn.datax.service.data.standard.api.dto.Endpoint;
|
||||
import cn.datax.service.data.standard.api.dto.ManualMappingDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.api.vo.ContrastDictVo;
|
||||
import cn.datax.service.data.standard.api.vo.DictVo;
|
||||
import cn.datax.service.data.standard.dao.ContrastDao;
|
||||
import cn.datax.service.data.standard.dao.ContrastDictDao;
|
||||
import cn.datax.service.data.standard.dao.DictDao;
|
||||
import cn.datax.service.data.standard.mapstruct.ContrastDictMapper;
|
||||
import cn.datax.service.data.standard.mapstruct.DictMapper;
|
||||
import cn.datax.service.data.standard.service.DictMappingService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class DictMappingServiceImpl implements DictMappingService {
|
||||
|
||||
@Autowired
|
||||
private ContrastDao contrastDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastDictDao contrastDictDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastDictMapper contrastDictMapper;
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
private static String BIND_GB_CODE = "gb_code";
|
||||
private static String BIND_GB_NAME = "gb_name";
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getDictMapping(String id) {
|
||||
ContrastEntity contrastEntity = contrastDao.selectById(id);
|
||||
String contrastId = contrastEntity.getId();
|
||||
String gbTypeId = contrastEntity.getGbTypeId();
|
||||
QueryWrapper<ContrastDictEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("d.contrast_id", contrastId);
|
||||
List<ContrastDictEntity> contrastDictEntityList = contrastDictDao.selectList(queryWrapper);
|
||||
List<ContrastDictVo> contrastDictList = contrastDictEntityList.stream().map(contrastDictMapper::toVO).collect(Collectors.toList());
|
||||
List<DictEntity> dictEntityList = dictDao.selectList(Wrappers.<DictEntity>lambdaQuery().eq(DictEntity::getTypeId, gbTypeId).eq(DictEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
|
||||
List<DictVo> dictList = dictEntityList.stream().map(dictMapper::toVO).collect(Collectors.toList());
|
||||
Map<String, Object> map = new HashMap<>(4);
|
||||
String tableName = StrUtil.isBlank(contrastEntity.getTableComment()) ? contrastEntity.getTableName() : contrastEntity.getTableName() + "(" + contrastEntity.getTableComment() + ")";
|
||||
String columnName = StrUtil.isBlank(contrastEntity.getColumnComment()) ? contrastEntity.getTableName() : contrastEntity.getColumnName() + "(" + contrastEntity.getColumnComment() + ")";
|
||||
long contrastTotal = contrastDictList.stream().count();
|
||||
long unContrastTotal = contrastDictList.stream().filter(s -> DataConstant.TrueOrFalse.FALSE.getKey().equals(s.getStatus())).count();
|
||||
map.put("title", "数据源: " + contrastEntity.getSourceName() + " 数据表: " + tableName + " 对照字段: " + columnName + " 标准类别编码: " + contrastEntity.getGbTypeCode() + " 标准类别名称: " + contrastEntity.getGbTypeName());
|
||||
map.put("description", "总数: " + contrastTotal + " 未对照: " + unContrastTotal + " 已对照: " + (contrastTotal - unContrastTotal));
|
||||
map.put("left", contrastDictList);
|
||||
map.put("right", dictList);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dictAutoMapping(String id) {
|
||||
ContrastEntity contrastEntity = contrastDao.selectById(id);
|
||||
String contrastId = contrastEntity.getId();
|
||||
String gbTypeId = contrastEntity.getGbTypeId();
|
||||
String bindGbColumn = contrastEntity.getBindGbColumn();
|
||||
// 查询未对照数据
|
||||
QueryWrapper<ContrastDictEntity> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("d.contrast_id", contrastId);
|
||||
queryWrapper.eq("d.status", DataConstant.TrueOrFalse.FALSE.getKey());
|
||||
List<ContrastDictEntity> contrastDictEntityList = contrastDictDao.selectList(queryWrapper);
|
||||
// 查询标准字典数据
|
||||
List<DictEntity> dictEntityList = dictDao.selectList(Wrappers.<DictEntity>lambdaQuery().eq(DictEntity::getTypeId, gbTypeId).eq(DictEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
|
||||
contrastDictEntityList.stream().forEach(c -> {
|
||||
dictEntityList.stream().filter(d -> {
|
||||
if (BIND_GB_CODE.equals(bindGbColumn)) {
|
||||
return Objects.equals(c.getColCode(), d.getGbCode());
|
||||
} else {
|
||||
return Objects.equals(c.getColName(), d.getGbName());
|
||||
}
|
||||
}).forEach(s -> {
|
||||
// 更新对照结果
|
||||
String contrastGbId = s.getId();
|
||||
c.setStatus(DataConstant.TrueOrFalse.TRUE.getKey());
|
||||
c.setContrastGbId(contrastGbId);
|
||||
contrastDictDao.updateById(c);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dictManualMapping(ManualMappingDto manualMappingDto) {
|
||||
List<Endpoint> endpoints = manualMappingDto.getEndpoints();
|
||||
endpoints.stream().forEach(s -> {
|
||||
LambdaUpdateWrapper<ContrastDictEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(ContrastDictEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey());
|
||||
updateWrapper.set(ContrastDictEntity::getContrastGbId, s.getTargetId());
|
||||
updateWrapper.eq(ContrastDictEntity::getId, s.getSourceId());
|
||||
contrastDictDao.update(null, updateWrapper);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dictCancelMapping(String id) {
|
||||
LambdaUpdateWrapper<ContrastDictEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(ContrastDictEntity::getStatus, DataConstant.TrueOrFalse.FALSE.getKey());
|
||||
updateWrapper.set(ContrastDictEntity::getContrastGbId, null);
|
||||
updateWrapper.eq(ContrastDictEntity::getId, id);
|
||||
contrastDictDao.update(null, updateWrapper);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package cn.datax.service.data.standard.service.impl;
|
||||
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import cn.datax.common.core.RedisConstant;
|
||||
import cn.datax.common.redis.service.RedisService;
|
||||
import cn.datax.service.data.standard.api.dto.DictDto;
|
||||
import cn.datax.service.data.standard.api.entity.ContrastDictEntity;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.dao.ContrastDictDao;
|
||||
import cn.datax.service.data.standard.dao.DictDao;
|
||||
import cn.datax.service.data.standard.mapstruct.DictMapper;
|
||||
import cn.datax.service.data.standard.service.DictService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准字典表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class DictServiceImpl extends BaseServiceImpl<DictDao, DictEntity> implements DictService {
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastDictDao contrastDictDao;
|
||||
|
||||
@Autowired
|
||||
private DictMapper dictMapper;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
|
||||
@Autowired
|
||||
private RedisTemplate<String, Object> redisTemplate;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictEntity saveDict(DictDto dictDto) {
|
||||
DictEntity dict = dictMapper.toEntity(dictDto);
|
||||
dictDao.insert(dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public DictEntity updateDict(DictDto dictDto) {
|
||||
DictEntity dict = dictMapper.toEntity(dictDto);
|
||||
dictDao.updateById(dict);
|
||||
return dict;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictEntity getDictById(String id) {
|
||||
DictEntity dictEntity = super.getById(id);
|
||||
return dictEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictById(String id) {
|
||||
// zrx 查询是否有对照表
|
||||
ContrastDictEntity contrastDictEntity = contrastDictDao.selectOne(new QueryWrapper<ContrastDictEntity>().eq("contrast_gb_id", id).last("limit 1"));
|
||||
if (contrastDictEntity != null) {
|
||||
throw new RuntimeException("对照表中的对照字典与之存在关联关系,不允许删除!");
|
||||
}
|
||||
dictDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDictBatch(List<String> ids) {
|
||||
// zrx add
|
||||
for (String id : ids) {
|
||||
deleteDictById(id);
|
||||
}
|
||||
//dictDao.deleteBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshDict() {
|
||||
String dictKey = RedisConstant.STANDARD_DICT_KEY;
|
||||
Boolean hasDictKey = redisService.hasKey(dictKey);
|
||||
if (hasDictKey) {
|
||||
redisService.del(dictKey);
|
||||
}
|
||||
List<DictEntity> dictEntityList = dictDao.selectList(Wrappers.emptyWrapper());
|
||||
Map<String, List<DictEntity>> dictListMap = dictEntityList.stream().collect(Collectors.groupingBy(DictEntity::getTypeId));
|
||||
redisTemplate.opsForHash().putAll(dictKey, dictListMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package cn.datax.service.data.standard.service.impl;
|
||||
|
||||
import cn.datax.service.data.standard.api.entity.ContrastEntity;
|
||||
import cn.datax.service.data.standard.api.entity.DictEntity;
|
||||
import cn.datax.service.data.standard.api.entity.TypeEntity;
|
||||
import cn.datax.service.data.standard.api.dto.TypeDto;
|
||||
import cn.datax.service.data.standard.dao.ContrastDao;
|
||||
import cn.datax.service.data.standard.dao.ContrastDictDao;
|
||||
import cn.datax.service.data.standard.dao.DictDao;
|
||||
import cn.datax.service.data.standard.service.TypeService;
|
||||
import cn.datax.service.data.standard.mapstruct.TypeMapper;
|
||||
import cn.datax.service.data.standard.dao.TypeDao;
|
||||
import cn.datax.common.base.BaseServiceImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据标准类别表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author AllDataDC
|
||||
* @date 2022-11-26
|
||||
*/
|
||||
@Service
|
||||
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
|
||||
public class TypeServiceImpl extends BaseServiceImpl<TypeDao, TypeEntity> implements TypeService {
|
||||
|
||||
@Autowired
|
||||
private TypeDao typeDao;
|
||||
|
||||
@Autowired
|
||||
private DictDao dictDao;
|
||||
|
||||
@Autowired
|
||||
private ContrastDao contrastDao;
|
||||
|
||||
@Autowired
|
||||
private TypeMapper typeMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TypeEntity saveType(TypeDto typeDto) {
|
||||
TypeEntity type = typeMapper.toEntity(typeDto);
|
||||
typeDao.insert(type);
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public TypeEntity updateType(TypeDto typeDto) {
|
||||
TypeEntity type = typeMapper.toEntity(typeDto);
|
||||
typeDao.updateById(type);
|
||||
return type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TypeEntity getTypeById(String id) {
|
||||
TypeEntity typeEntity = super.getById(id);
|
||||
return typeEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteTypeById(String id) {
|
||||
//zrx 查询是否有字典
|
||||
DictEntity dictEntity = dictDao.selectOne(new QueryWrapper<DictEntity>().eq("type_id", id).last("limit 1"));
|
||||
if (dictEntity != null) {
|
||||
throw new RuntimeException("该类别下有标准字典与之关联,不允许删除!");
|
||||
}
|
||||
ContrastEntity contrastEntity = contrastDao.selectOne(new QueryWrapper<ContrastEntity>().eq("gb_type_id", id).last("limit 1"));
|
||||
if (contrastEntity != null) {
|
||||
throw new RuntimeException("该类别有对照表与之关联,不允许删除!");
|
||||
}
|
||||
typeDao.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteTypeBatch(List<String> ids) {
|
||||
// zrx add
|
||||
for (String id : ids) {
|
||||
deleteTypeById(id);
|
||||
}
|
||||
// typeDao.deleteBatchIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
server:
|
||||
port: 8825
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: service-data-standard
|
||||
profiles:
|
||||
active: dev
|
||||
cloud:
|
||||
config:
|
||||
label: master
|
||||
name: ${spring.application.name}
|
||||
profile: ${spring.profiles.active}
|
||||
discovery:
|
||||
enabled: true
|
||||
service-id: config
|
||||
|
||||
# 注册中心配置
|
||||
eureka:
|
||||
instance:
|
||||
lease-renewal-interval-in-seconds: 20
|
||||
prefer-ip-address: true
|
||||
ip-address: 192.168.1.169
|
||||
client:
|
||||
register-with-eureka: true
|
||||
fetch-registry: true
|
||||
instance-info-replication-interval-seconds: 30
|
||||
registry-fetch-interval-seconds: 3
|
||||
service-url:
|
||||
defaultZone: http://192.168.1.169:8610/eureka
|
||||
@@ -0,0 +1,78 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="60 seconds" debug="false">
|
||||
<springProperty scope="context" name="springAppName" source="spring.application.name"/>
|
||||
<property name="log.path" value="logs/service-data-standard"/>
|
||||
<property name="log.maxHistory" value="15"/>
|
||||
<property name="log.totalSizeCap" value="500MB"/>
|
||||
<property name="log.maxFileSize" value="10MB"/>
|
||||
<property name="log.colorPattern"
|
||||
value="%magenta(%d{yyyy-MM-dd HH:mm:ss}) %highlight(%-5level) %boldCyan(${springAppName:-}) %yellow(%thread) %green(%logger) %msg%n"/>
|
||||
<property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss} %-5level ${springAppName:-} %thread %logger %msg%n"/>
|
||||
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.colorPattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--输出到文件-->
|
||||
<!-- RollingFileAppender:滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 -->
|
||||
<!-- 以下的大概意思是:1.先按日期存日志,日期变了,将前一天的日志文件名重命名为XXX%日期%索引,新的日志仍然是project_info.log -->
|
||||
<!-- 2.如果日期没有发生变化,但是当前日志的文件大小超过10MB时,对当前日志进行分割 重命名-->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<!--日志文件路径和名称-->
|
||||
<File>${log.path}/info/info.log</File>
|
||||
<!--是否追加到文件末尾,默认为true-->
|
||||
<append>true</append>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!-- 日志文件的名字会根据fileNamePattern的值,每隔一段时间改变一次 -->
|
||||
<!-- 文件名:logs/project_info.2017-12-05.0.log -->
|
||||
<!-- 注意:SizeAndTimeBasedRollingPolicy中 %i和%d令牌都是强制性的,必须存在,要不会报错 -->
|
||||
<fileNamePattern>${log.path}/info/info.%d.%i.log</fileNamePattern>
|
||||
<!-- 每产生一个日志文件,该日志文件的保存期限为30天, ps:maxHistory的单位是根据fileNamePattern中的翻转策略自动推算出来的,例如上面选用了yyyy-MM-dd,则单位为天
|
||||
如果上面选用了yyyy-MM,则单位为月,另外上面的单位默认为yyyy-MM-dd-->
|
||||
<MaxHistory>${log.maxHistory}</MaxHistory>
|
||||
<!-- 每个日志文件到2mb的时候开始切分,最多保留30天,但最大到500MB,哪怕没到30天也要删除多余的日志 -->
|
||||
<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
|
||||
<!-- maxFileSize:这是活动文件的大小,默认值是10MB,测试时可改成5KB看效果 -->
|
||||
<maxFileSize>${log.maxFileSize}</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>INFO</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<File>${log.path}/error/error.log</File>
|
||||
<append>true</append>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/error/error.%d.%i.log</fileNamePattern>
|
||||
<MaxHistory>${log.maxHistory}</MaxHistory>
|
||||
<totalSizeCap>${log.totalSizeCap}</totalSizeCap>
|
||||
<maxFileSize>${log.maxFileSize}</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<level>ERROR</level>
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<root level="debug">
|
||||
<appender-ref ref="console"/>
|
||||
</root>
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info"/>
|
||||
<appender-ref ref="file_error"/>
|
||||
</root>
|
||||
</configuration>
|
||||
@@ -0,0 +1,78 @@
|
||||
<?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="cn.datax.service.data.standard.dao.ContrastDictDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.data.standard.api.entity.ContrastDictEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_dept" property="createDept" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="contrast_id" property="contrastId" />
|
||||
<result column="col_code" property="colCode" />
|
||||
<result column="col_name" property="colName" />
|
||||
<result column="contrast_gb_id" property="contrastGbId" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ExtendResultMap" type="cn.datax.service.data.standard.api.entity.ContrastDictEntity" extends="BaseResultMap">
|
||||
<result column="source_name" property="sourceName" />
|
||||
<result column="table_name" property="tableName" />
|
||||
<result column="column_name" property="columnName" />
|
||||
<result column="gb_type_code" property="gbTypeCode" />
|
||||
<result column="gb_type_name" property="gbTypeName" />
|
||||
<result column="contrast_gb_code" property="contrastGbCode" />
|
||||
<result column="contrast_gb_name" property="contrastGbName" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
create_dept,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
contrast_id, col_code, col_name, contrast_gb_id
|
||||
</sql>
|
||||
|
||||
<sql id="Dict_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.status,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.create_dept,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.remark,
|
||||
${alias}.contrast_id, ${alias}.col_code, ${alias}.col_name, ${alias}.contrast_gb_id
|
||||
</sql>
|
||||
|
||||
<select id="selectList" resultMap="ExtendResultMap">
|
||||
SELECT c.source_name, c.table_name, c.column_name, t.gb_type_code, t.gb_type_name,
|
||||
sd.gb_code AS contrast_gb_code, sd.gb_name AS contrast_gb_name,
|
||||
<include refid="Dict_Column_List"><property name="alias" value="d"/></include>
|
||||
FROM standard_contrast_dict d
|
||||
LEFT JOIN standard_contrast c ON c.id = d.contrast_id
|
||||
LEFT JOIN standard_type t ON t.id = c.gb_type_id
|
||||
LEFT JOIN standard_dict sd ON sd.id = d.contrast_gb_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectPage" resultMap="ExtendResultMap">
|
||||
SELECT c.source_name, c.table_name, c.column_name, t.gb_type_code, t.gb_type_name,
|
||||
sd.gb_code AS contrast_gb_code, sd.gb_name AS contrast_gb_name,
|
||||
<include refid="Dict_Column_List"><property name="alias" value="d"/></include>
|
||||
FROM standard_contrast_dict d
|
||||
LEFT JOIN standard_contrast c ON c.id = d.contrast_id
|
||||
LEFT JOIN standard_type t ON t.id = c.gb_type_id
|
||||
LEFT JOIN standard_dict sd ON sd.id = d.contrast_gb_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,81 @@
|
||||
<?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="cn.datax.service.data.standard.dao.ContrastDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.data.standard.api.entity.ContrastEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_dept" property="createDept" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="source_id" property="sourceId" />
|
||||
<result column="source_name" property="sourceName" />
|
||||
<result column="table_id" property="tableId" />
|
||||
<result column="table_name" property="tableName" />
|
||||
<result column="table_comment" property="tableComment" />
|
||||
<result column="column_id" property="columnId" />
|
||||
<result column="column_name" property="columnName" />
|
||||
<result column="column_comment" property="columnComment" />
|
||||
<result column="gb_type_id" property="gbTypeId" />
|
||||
<result column="bind_gb_column" property="bindGbColumn" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ExtendResultMap" type="cn.datax.service.data.standard.api.entity.ContrastEntity" extends="BaseResultMap">
|
||||
<result column="gb_type_code" property="gbTypeCode" />
|
||||
<result column="gb_type_name" property="gbTypeName" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ExtendStatisticResultMap" type="cn.datax.service.data.standard.api.entity.ContrastEntity" extends="ExtendResultMap">
|
||||
<result column="mapping_count" property="mappingCount" />
|
||||
<result column="un_mapping_count" property="unMappingCount" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
create_dept,
|
||||
update_by,
|
||||
update_time,
|
||||
remark,
|
||||
source_id, source_name, table_id, table_name, table_comment, column_id, column_name, column_comment, gb_type_id, bind_gb_column
|
||||
</sql>
|
||||
|
||||
<sql id="Contrast_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.status,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.create_dept,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.remark,
|
||||
${alias}.source_id, ${alias}.source_name, ${alias}.table_id, ${alias}.table_name, ${alias}.table_comment, ${alias}.column_id,
|
||||
${alias}.column_name, ${alias}.column_comment, ${alias}.gb_type_id, ${alias}.bind_gb_column
|
||||
</sql>
|
||||
|
||||
<select id="selectById" resultMap="ExtendResultMap">
|
||||
SELECT t.gb_type_code, t.gb_type_name,
|
||||
<include refid="Contrast_Column_List"><property name="alias" value="c"/></include>
|
||||
FROM standard_contrast c
|
||||
LEFT JOIN standard_type t ON t.id = c.gb_type_id
|
||||
WHERE 1 = 1 AND c.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="statistic" resultMap="ExtendStatisticResultMap">
|
||||
SELECT t.gb_type_code, t.gb_type_name,
|
||||
(select count(1) from standard_contrast_dict where contrast_id = c.id and status = 1) as mapping_count,
|
||||
(select count(1) from standard_contrast_dict where contrast_id = c.id and status = 0) as un_mapping_count,
|
||||
<include refid="Contrast_Column_List"><property name="alias" value="c"/></include>
|
||||
FROM standard_contrast c
|
||||
LEFT JOIN standard_type t ON t.id = c.gb_type_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,64 @@
|
||||
<?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="cn.datax.service.data.standard.dao.DictDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.data.standard.api.entity.DictEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_dept" property="createDept" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="type_id" property="typeId" />
|
||||
<result column="gb_code" property="gbCode" />
|
||||
<result column="gb_name" property="gbName" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="ExtendResultMap" type="cn.datax.service.data.standard.api.entity.DictEntity" extends="BaseResultMap">
|
||||
<result column="gb_type_code" property="gbTypeCode" />
|
||||
<result column="gb_type_name" property="gbTypeName" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
create_dept,
|
||||
update_by,
|
||||
update_time,
|
||||
remark, type_id, gb_code, gb_name
|
||||
</sql>
|
||||
|
||||
<sql id="Dict_Column_List">
|
||||
${alias}.id,
|
||||
${alias}.status,
|
||||
${alias}.create_by,
|
||||
${alias}.create_time,
|
||||
${alias}.create_dept,
|
||||
${alias}.update_by,
|
||||
${alias}.update_time,
|
||||
${alias}.remark, ${alias}.type_id, ${alias}.gb_code, ${alias}.gb_name
|
||||
</sql>
|
||||
|
||||
<select id="selectById" resultMap="ExtendResultMap">
|
||||
SELECT t.gb_type_code, t.gb_type_name,
|
||||
<include refid="Dict_Column_List"><property name="alias" value="d"/></include>
|
||||
FROM standard_dict d
|
||||
LEFT JOIN standard_type t ON t.id = d.type_id
|
||||
WHERE 1 = 1 AND d.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectPage" resultMap="ExtendResultMap">
|
||||
SELECT t.gb_type_code, t.gb_type_name,
|
||||
<include refid="Dict_Column_List"><property name="alias" value="d"/></include>
|
||||
FROM standard_dict d
|
||||
LEFT JOIN standard_type t ON t.id = d.type_id
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,31 @@
|
||||
<?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="cn.datax.service.data.standard.dao.TypeDao">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="cn.datax.service.data.standard.api.entity.TypeEntity">
|
||||
<result column="id" property="id" />
|
||||
<result column="status" property="status" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="create_dept" property="createDept" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="gb_type_code" property="gbTypeCode" />
|
||||
<result column="gb_type_name" property="gbTypeName" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
create_dept,
|
||||
update_by,
|
||||
update_time,
|
||||
remark, gb_type_code, gb_type_name
|
||||
</sql>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,25 @@
|
||||
module.log=com.p6spy.engine.logging.P6LogFactory,com.p6spy.engine.outage.P6OutageFactory
|
||||
# <20>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE>ӡ
|
||||
logMessageFormat=com.baomidou.mybatisplus.extension.p6spy.P6SpyLogger
|
||||
#<23><>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨
|
||||
appender=com.baomidou.mybatisplus.extension.p6spy.StdoutLogger
|
||||
# ʹ<><CAB9><EFBFBD><EFBFBD>־ϵͳ<CFB5><CDB3>¼ sql
|
||||
#appender=com.p6spy.engine.spy.appender.Slf4JLogger
|
||||
# <20><><EFBFBD><EFBFBD> p6spy driver <20><><EFBFBD><EFBFBD>
|
||||
deregisterdrivers=true
|
||||
# ȡ<><C8A1>JDBC URLǰ
|
||||
useprefix=true
|
||||
# <20><><EFBFBD>ü<EFBFBD>¼ Log <20><><EFBFBD><EFBFBD>,<2C><>ȥ<EFBFBD><C8A5><EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>error,info,batch,debug,statement,commit,rollback,result,resultset.
|
||||
excludecategories=info,debug,result,batch,resultset
|
||||
# <20><><EFBFBD>ڸ<EFBFBD>ʽ
|
||||
dateformat=yyyy-MM-dd HH:mm:ss
|
||||
# ʵ<><CAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɶ<EFBFBD><C9B6><EFBFBD>
|
||||
#driverlist=org.h2.Driver
|
||||
# <20>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>SQL<51><4C>¼
|
||||
outagedetection=true
|
||||
# <20><>SQL<51><4C>¼<EFBFBD><C2BC> 2 <20><>
|
||||
outagedetectioninterval=2
|
||||
# <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
filter=true
|
||||
# <20><><EFBFBD>ò<EFBFBD><C3B2><EFBFBD>ӡ<EFBFBD><D3A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
exclude=select 1
|
||||
20
studio/modules/data-standard-service-parent/pom.xml
Normal file
20
studio/modules/data-standard-service-parent/pom.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>modules</artifactId>
|
||||
<groupId>com.platform</groupId>
|
||||
<version>0.4.x</version>
|
||||
</parent>
|
||||
<packaging>pom</packaging>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<version>0.4.x</version>
|
||||
<description>数据标准</description>
|
||||
<artifactId>data-standard-service-parent</artifactId>
|
||||
|
||||
<modules>
|
||||
<module>data-standard-service-api</module>
|
||||
<module>data-standard-service</module>
|
||||
</modules>
|
||||
</project>
|
||||
Reference in New Issue
Block a user