Commit d3ed5ad9 by yuwei

项目初始化

parent 7656bfa2
......@@ -40,10 +40,14 @@ public class CheckRuleDto implements Serializable {
private String ruleTableId;
@ApiModelProperty(value = "数据表")
private String ruleTable;
@ApiModelProperty(value = "数据表名称")
private String ruleTableComment;
@ApiModelProperty(value = "核查字段主键")
private String ruleColumnId;
@ApiModelProperty(value = "核查字段")
private String ruleColumn;
@ApiModelProperty(value = "核查字段名称")
private String ruleColumnComment;
@ApiModelProperty(value = "核查脚本")
private String ruleSql;
@ApiModelProperty(value = "状态")
......
......@@ -65,6 +65,11 @@ public class CheckRuleEntity extends DataScopeBaseEntity {
private String ruleTable;
/**
* 数据表名称
*/
private String ruleTableComment;
/**
* 核查字段主键
*/
private String ruleColumnId;
......@@ -75,6 +80,11 @@ public class CheckRuleEntity extends DataScopeBaseEntity {
private String ruleColumn;
/**
* 核查字段名称
*/
private String ruleColumnComment;
/**
* 核查脚本
*/
private String ruleSql;
......
package cn.datax.service.data.quality.api.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <p>
* 数据质量监控任务信息表
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Data
@Accessors(chain = true)
@TableName("quality_schedule_job")
public class ScheduleJobEntity implements Serializable {
private static final long serialVersionUID=1L;
/**
* 主键
*/
@TableId(value = "id", type = IdType.ASSIGN_ID)
private String id;
/**
* 任务名称
*/
private String jobName;
/**
* bean名称
*/
private String beanName;
/**
* 方法名称
*/
private String methodName;
/**
* 方法参数
*/
private String methodParams;
/**
* cron表达式
*/
private String cronExpression;
/**
* 状态(1运行 0暂停)
*/
private String status;
}
package cn.datax.service.data.quality.api.query;
import cn.datax.common.base.BaseQueryParams;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <p>
* 数据质量监控任务信息表 查询实体
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Data
@EqualsAndHashCode(callSuper = true)
public class ScheduleJobQuery extends BaseQueryParams {
private static final long serialVersionUID=1L;
}
......@@ -32,7 +32,9 @@ public class CheckRuleVo implements Serializable {
private String ruleSource;
private String ruleTableId;
private String ruleTable;
private String ruleTableComment;
private String ruleColumnId;
private String ruleColumn;
private String ruleColumnComment;
private String ruleSql;
}
package cn.datax.service.data.quality.api.vo;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
* 数据质量监控任务信息表 实体VO
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Data
public class ScheduleJobVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
private String status;
private String jobName;
private String beanName;
private String methodName;
private String methodParams;
private String cronExpression;
}
package cn.datax.service.data.quality.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
@Configuration
public class SchedulingConfig {
@Bean
public TaskScheduler taskScheduler() {
ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
// 定时任务执行线程池核心线程数
taskScheduler.setPoolSize(5);
taskScheduler.setRemoveOnCancelPolicy(true);
taskScheduler.setThreadNamePrefix("TaskSchedulerThreadPool-");
return taskScheduler;
}
}
package cn.datax.service.data.quality.config;
import cn.datax.common.core.DataConstant;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.service.ScheduleJobService;
import cn.datax.service.data.quality.task.CronTaskRegistrar;
import cn.datax.service.data.quality.task.SchedulingRunnable;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ConfigurableApplicationContext;
......@@ -9,7 +18,9 @@ import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
@Slf4j
@Component
@RequiredArgsConstructor
public class StartedUpRunner implements ApplicationRunner {
......@@ -17,6 +28,12 @@ public class StartedUpRunner implements ApplicationRunner {
private final ConfigurableApplicationContext context;
private final Environment environment;
@Autowired
private CronTaskRegistrar cronTaskRegistrar;
@Autowired
private ScheduleJobService scheduleJobService;
@Override
public void run(ApplicationArguments args) {
if (context.isActive()) {
......@@ -26,6 +43,15 @@ public class StartedUpRunner implements ApplicationRunner {
"端口号:" + environment.getProperty("server.port") + "\n" +
"-----------------------------------------";
System.out.println(banner);
List<ScheduleJobEntity> list = scheduleJobService.list(Wrappers.<ScheduleJobEntity>lambdaQuery().eq(ScheduleJobEntity::getStatus, DataConstant.TrueOrFalse.TRUE.getKey()));
if (CollUtil.isNotEmpty(list)) {
list.stream().forEach(job -> {
SchedulingRunnable task = new SchedulingRunnable(job.getBeanName(), job.getMethodName(), job.getMethodParams());
cronTaskRegistrar.addCronTask(task, job.getCronExpression());
});
}
log.info("定时任务已加载完毕...");
}
}
}
package cn.datax.service.data.quality.controller;
import cn.datax.common.core.JsonPage;
import cn.datax.common.core.R;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.api.vo.ScheduleJobVo;
import cn.datax.service.data.quality.api.query.ScheduleJobQuery;
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
import cn.datax.service.data.quality.service.ScheduleJobService;
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.web.bind.annotation.*;
import cn.datax.common.base.BaseController;
import java.util.List;
import java.util.stream.Collectors;
/**
* <p>
* 数据质量监控任务信息表 前端控制器
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Api(tags = {"数据质量监控任务信息表"})
@RestController
@RequestMapping("/quality/scheduleJob")
public class ScheduleJobController extends BaseController {
@Autowired
private ScheduleJobService scheduleJobService;
@Autowired
private ScheduleJobMapper scheduleJobMapper;
/**
* 通过ID查询信息
*
* @param id
* @return
*/
@ApiOperation(value = "获取详细信息", notes = "根据url的id来获取详细信息")
@ApiImplicitParam(name = "id", value = "ID", required = true, dataType = "String", paramType = "path")
@GetMapping("/{id}")
public R getScheduleJobById(@PathVariable String id) {
ScheduleJobEntity scheduleJobEntity = scheduleJobService.getScheduleJobById(id);
return R.ok().setData(scheduleJobMapper.toVO(scheduleJobEntity));
}
/**
* 分页查询信息
*
* @param scheduleJobQuery
* @return
*/
@ApiOperation(value = "分页查询", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "scheduleJobQuery", value = "查询实体scheduleJobQuery", required = true, dataTypeClass = ScheduleJobQuery.class)
})
@GetMapping("/page")
public R getScheduleJobPage(ScheduleJobQuery scheduleJobQuery) {
QueryWrapper<ScheduleJobEntity> queryWrapper = new QueryWrapper<>();
IPage<ScheduleJobEntity> page = scheduleJobService.page(new Page<>(scheduleJobQuery.getPageNum(), scheduleJobQuery.getPageSize()), queryWrapper);
List<ScheduleJobVo> collect = page.getRecords().stream().map(scheduleJobMapper::toVO).collect(Collectors.toList());
JsonPage<ScheduleJobVo> jsonPage = new JsonPage<>(page.getCurrent(), page.getSize(), page.getTotal(), collect);
return R.ok().setData(jsonPage);
}
}
package cn.datax.service.data.quality.dao;
import cn.datax.common.base.BaseDao;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* <p>
* 数据质量监控任务信息表 Mapper 接口
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Mapper
public interface ScheduleJobDao extends BaseDao<ScheduleJobEntity> {
}
package cn.datax.service.data.quality.mapstruct;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.api.vo.ScheduleJobVo;
import org.mapstruct.Mapper;
import java.util.List;
/**
* <p>
* 数据质量监控任务信息表 Mapper 实体映射
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Mapper(componentModel = "spring")
public interface ScheduleJobMapper {
/**
* 将源对象转换为VO对象
* @param e
* @return D
*/
ScheduleJobVo toVO(ScheduleJobEntity e);
/**
* 将源对象集合转换为VO对象集合
* @param es
* @return List<D>
*/
List<ScheduleJobVo> toVO(List<ScheduleJobEntity> es);
}
package cn.datax.service.data.quality.service;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.common.base.BaseService;
/**
* <p>
* 数据质量监控任务信息表 服务类
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
public interface ScheduleJobService extends BaseService<ScheduleJobEntity> {
ScheduleJobEntity getScheduleJobById(String id);
}
package cn.datax.service.data.quality.service.impl;
import cn.datax.service.data.quality.api.entity.ScheduleJobEntity;
import cn.datax.service.data.quality.service.ScheduleJobService;
import cn.datax.service.data.quality.mapstruct.ScheduleJobMapper;
import cn.datax.service.data.quality.dao.ScheduleJobDao;
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;
/**
* <p>
* 数据质量监控任务信息表 服务实现类
* </p>
*
* @author yuwei
* @since 2020-09-29
*/
@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ScheduleJobServiceImpl extends BaseServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
@Autowired
private ScheduleJobDao scheduleJobDao;
@Autowired
private ScheduleJobMapper scheduleJobMapper;
@Override
public ScheduleJobEntity getScheduleJobById(String id) {
ScheduleJobEntity scheduleJobEntity = super.getById(id);
return scheduleJobEntity;
}
}
package cn.datax.service.data.quality.task;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.config.CronTask;
import org.springframework.stereotype.Component;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@Component
public class CronTaskRegistrar implements DisposableBean {
private final Map<Runnable, ScheduledTask> scheduledTasks = new ConcurrentHashMap<>(8);
@Autowired
private TaskScheduler taskScheduler;
public TaskScheduler getScheduler() {
return this.taskScheduler;
}
public void addCronTask(Runnable task, String cronExpression) {
addCronTask(new CronTask(task, cronExpression));
}
public void addCronTask(CronTask cronTask) {
if (cronTask != null) {
Runnable task = cronTask.getRunnable();
if (this.scheduledTasks.containsKey(task)) {
removeCronTask(task);
}
this.scheduledTasks.put(task, scheduleCronTask(cronTask));
}
}
public void removeCronTask(Runnable task) {
ScheduledTask scheduledTask = this.scheduledTasks.remove(task);
if (scheduledTask != null) {
scheduledTask.cancel();
}
}
public ScheduledTask scheduleCronTask(CronTask cronTask) {
ScheduledTask scheduledTask = new ScheduledTask();
scheduledTask.future = this.taskScheduler.schedule(cronTask.getRunnable(), cronTask.getTrigger());
return scheduledTask;
}
@Override
public void destroy() {
for (ScheduledTask task : this.scheduledTasks.values()) {
task.cancel();
}
this.scheduledTasks.clear();
}
}
package cn.datax.service.data.quality.task;
import org.springframework.stereotype.Component;
@Component("myTask")
public class MyTask {
public void taskWithParams(String params) {
System.out.println("执行有参示例任务:" + params);
}
public void taskNoParams() {
System.out.println("执行无参示例任务");
}
}
package cn.datax.service.data.quality.task;
import java.util.concurrent.ScheduledFuture;
public final class ScheduledTask {
volatile ScheduledFuture<?> future;
/**
* 取消定时任务
*/
public void cancel() {
ScheduledFuture<?> future = this.future;
if (future != null) {
future.cancel(true);
}
}
}
package cn.datax.service.data.quality.task;
import cn.datax.common.utils.SpringContextHolder;
import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Method;
import java.util.Objects;
@Slf4j
public class SchedulingRunnable implements Runnable {
private String beanName;
private String methodName;
private String params;
public SchedulingRunnable(String beanName, String methodName) {
this(beanName, methodName, null);
}
public SchedulingRunnable(String beanName, String methodName, String params) {
this.beanName = beanName;
this.methodName = methodName;
this.params = params;
}
@Override
public void run() {
log.info("定时任务开始执行 - bean:{},方法:{},参数:{}", beanName, methodName, params);
long startTime = System.currentTimeMillis();
try {
Object target = SpringContextHolder.getBean(beanName);
Method method = null;
if (StrUtil.isNotEmpty(params)) {
method = target.getClass().getDeclaredMethod(methodName, String.class);
} else {
method = target.getClass().getDeclaredMethod(methodName);
}
ReflectionUtils.makeAccessible(method);
if (StrUtil.isNotEmpty(params)) {
method.invoke(target, params);
} else {
method.invoke(target);
}
} catch (Exception ex) {
log.error(String.format("定时任务执行异常 - bean:%s,方法:%s,参数:%s ", beanName, methodName, params), ex);
}
long times = System.currentTimeMillis() - startTime;
log.info("定时任务执行结束 - bean:{},方法:{},参数:{},耗时:{} 毫秒", beanName, methodName, params, times);
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
SchedulingRunnable that = (SchedulingRunnable) o;
if (params == null) {
return beanName.equals(that.beanName) &&
methodName.equals(that.methodName) &&
that.params == null;
}
return beanName.equals(that.beanName) &&
methodName.equals(that.methodName) &&
params.equals(that.params);
}
@Override
public int hashCode() {
if (params == null) {
return Objects.hash(beanName, methodName);
}
return Objects.hash(beanName, methodName, params);
}
}
......@@ -20,8 +20,10 @@
<result column="rule_source" property="ruleSource" />
<result column="rule_table_id" property="ruleTableId" />
<result column="rule_table" property="ruleTable" />
<result column="rule_table_comment" property="ruleTableComment" />
<result column="rule_column_id" property="ruleColumnId" />
<result column="rule_column" property="ruleColumn" />
<result column="rule_column_comment" property="ruleColumnComment" />
<result column="rule_sql" property="ruleSql" />
<result column="last_check_batch" property="lastCheckBatch" />
</resultMap>
......@@ -36,7 +38,8 @@
update_by,
update_time,
remark,
rule_name, rule_type_id, rule_level, rule_source_id, rule_source, rule_table_id, rule_table, rule_column_id, rule_column, rule_sql, last_check_batch
rule_name, rule_type_id, rule_level, rule_source_id, rule_source, rule_table_id, rule_table, rule_table_comment
rule_column_id, rule_column, rule_column_comment, rule_sql, last_check_batch
</sql>
<sql id="Rule_Column_List">
......@@ -48,7 +51,8 @@
${alias}.update_by,
${alias}.update_time,
${alias}.remark,
${alias}.rule_name, ${alias}.rule_type_id, ${alias}.rule_level, ${alias}.rule_source_id, ${alias}.rule_source, ${alias}.rule_table_id, ${alias}.rule_table, ${alias}.rule_column_id, ${alias}.rule_column, ${alias}.rule_sql, ${alias}.last_check_batch
${alias}.rule_name, ${alias}.rule_type_id, ${alias}.rule_level, ${alias}.rule_source_id, ${alias}.rule_source,
${alias}.rule_table_id, ${alias}.rule_table, ${alias}.rule_table_comment, ${alias}.rule_column_id, ${alias}.rule_column, ${alias}.rule_column_comment, ${alias}.rule_sql, ${alias}.last_check_batch
</sql>
<select id="selectPage" resultMap="BaseResultMap">
......
<?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.quality.dao.ScheduleJobDao">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="cn.datax.service.data.quality.api.entity.ScheduleJobEntity">
<result column="id" property="id" />
<result column="status" property="status" />
<result column="job_name" property="jobName" />
<result column="bean_name" property="beanName" />
<result column="method_name" property="methodName" />
<result column="method_params" property="methodParams" />
<result column="cron_expression" property="cronExpression" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
status,
job_name, bean_name, method_name, method_params, cron_expression
</sql>
</mapper>
......@@ -33,14 +33,20 @@ public class ContrastDto implements Serializable {
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 gbTypeCode;
@ApiModelProperty(value = "标准类别名称")
private String gbTypeName;
@ApiModelProperty(value = "绑定标准字段")
private String bindGbColumn;
}
......@@ -43,6 +43,11 @@ public class ContrastEntity extends DataScopeBaseEntity {
private String tableName;
/**
* 数据表名称
*/
private String tableComment;
/**
* 对照字段主键
*/
private String columnId;
......@@ -53,6 +58,11 @@ public class ContrastEntity extends DataScopeBaseEntity {
private String columnName;
/**
* 对照字段名称
*/
private String columnComment;
/**
* 标准类别主键
*/
private String gbTypeId;
......@@ -66,4 +76,9 @@ public class ContrastEntity extends DataScopeBaseEntity {
* 标准类别名称
*/
private String gbTypeName;
/**
* 绑定标准字段
*/
private String bindGbColumn;
}
......@@ -11,11 +11,8 @@ public class ContrastTreeVo implements Serializable {
private static final long serialVersionUID=1L;
private String id;
/**
* 数据层级 database、table、column
*/
private String type;
private String label;
private String name;
/**
* 数据
*/
......
......@@ -28,9 +28,12 @@ public class ContrastVo implements Serializable {
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;
}
......@@ -13,6 +13,8 @@ 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;
......@@ -71,8 +73,45 @@ public class ContrastServiceImpl extends BaseServiceImpl<ContrastDao, ContrastEn
@Override
public List<ContrastTreeVo> getContrastTree() {
List<ContrastTreeVo> list = new ArrayList<>();
List<ContrastEntity> contrastEntityList = contrastDao.selectList(Wrappers.emptyWrapper());
Map<String, List<ContrastEntity>> sourceListMap = contrastEntityList.stream().collect(Collectors.groupingBy(ContrastEntity::getSourceId));
return null;
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;
}
}
......@@ -16,11 +16,14 @@
<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="gb_type_code" property="gbTypeCode" />
<result column="gb_type_name" property="gbTypeName" />
<result column="bind_gb_column" property="bindGbColumn" />
</resultMap>
<!-- 通用查询结果列 -->
......@@ -33,7 +36,7 @@
update_by,
update_time,
remark,
source_id, source_name, table_id, table_name, column_id, column_name, gb_type_id, gb_type_code, gb_type_name
source_id, source_name, table_id, table_name, table_comment, column_id, column_name, column_comment, gb_type_id, gb_type_code, gb_type_name, bind_gb_column
</sql>
</mapper>
......@@ -204,7 +204,7 @@
<el-form-item :prop="'modelColumns.' + scope.$index + '.bindDictColumn'">
<el-select :disabled="scope.row.isSystem === '1' || scope.row.isBindDict === '0'" v-model="scope.row.bindDictColumn" clearable placeholder="请选择">
<el-option
v-for="item in dictColumnOptions"
v-for="item in gbColumnOptions"
:key="item.value"
:label="item.label"
:value="item.value">
......@@ -308,7 +308,7 @@ export default {
// 数据标准类别数据字典
dictTypeOptions: [],
// 标准字典字段数据字典
dictColumnOptions: [
gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' }
],
......
......@@ -198,7 +198,7 @@
<el-form-item>
<el-select v-model="scope.row.bindDictColumn" clearable placeholder="请选择">
<el-option
v-for="item in dictColumnOptions"
v-for="item in gbColumnOptions"
:key="item.value"
:label="item.label"
:value="item.value">
......@@ -263,7 +263,7 @@ export default {
queryTypeOptions: [],
htmlTypeOptions: [],
dictTypeOptions: [],
dictColumnOptions: [
gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' }
]
......
......@@ -204,7 +204,7 @@
<el-form-item :prop="'modelColumns.' + scope.$index + '.bindDictColumn'">
<el-select :disabled="scope.row.isSystem === '1' || scope.row.isBindDict === '0'" v-model="scope.row.bindDictColumn" clearable placeholder="请选择">
<el-option
v-for="item in dictColumnOptions"
v-for="item in gbColumnOptions"
:key="item.value"
:label="item.label"
:value="item.value">
......@@ -296,7 +296,7 @@ export default {
queryTypeOptions: [],
htmlTypeOptions: [],
dictTypeOptions: [],
dictColumnOptions: [
gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' }
]
......
......@@ -193,8 +193,10 @@ export default {
return item.id === val
})
this.form.ruleTable = table.tableName
this.form.ruleTableComment = table.tableComment
this.form.ruleColumnId = ''
this.form.ruleColumn = ''
this.form.ruleColumnComment = ''
}
})
},
......@@ -203,6 +205,8 @@ export default {
return item.id === val
})
this.form.ruleColumn = column.columnName
this.form.ruleColumnComment = column.columnComment
this.$forceUpdate()
},
/** 提交按钮 */
submitForm: function() {
......
......@@ -202,8 +202,10 @@ export default {
return item.id === val
})
this.form.ruleTable = table.tableName
this.form.ruleTableComment = table.tableComment
this.form.ruleColumnId = ''
this.form.ruleColumn = ''
this.form.ruleColumnComment = ''
}
})
},
......@@ -212,6 +214,8 @@ export default {
return item.id === val
})
this.form.ruleColumn = column.columnName
this.form.ruleColumnComment = column.columnComment
this.$forceUpdate()
},
/** 提交按钮 */
submitForm: function() {
......
......@@ -184,8 +184,8 @@ export default {
{ prop: 'ruleName', label: '规则名称', show: true },
{ prop: 'ruleType', label: '规则类型', show: true },
{ prop: 'ruleSource', label: '数据源', show: true },
{ prop: 'ruleTable', label: '数据表', show: true },
{ prop: 'ruleColumn', label: '核查字段', show: true },
{ prop: 'ruleTable', label: '数据表', show: true, formatter: this.ruleTableFormatter },
{ prop: 'ruleColumn', label: '核查字段', show: true, formatter: this.ruleColumnFormatter },
{ prop: 'ruleLevel', label: '规则级别', show: true, formatter: this.ruleLevelFormatter },
{
prop: 'status',
......@@ -371,6 +371,12 @@ export default {
return <el-tag type='warning'>{dictLabel}</el-tag>
}
},
ruleTableFormatter(row, column, cellValue, index) {
return row.ruleTableComment ? row.ruleTable + '(' + row.ruleTableComment + ')' : row.ruleTable
},
ruleColumnFormatter(row, column, cellValue, index) {
return row.ruleColumnComment ? row.ruleColumn + '(' + row.ruleColumnComment + ')' : row.ruleColumn
},
ruleLevelFormatter(row, column, cellValue, index) {
const dictLabel = this.selectDictLabel(this.ruleLevelOptions, cellValue)
if (cellValue === '1') {
......
......@@ -16,7 +16,7 @@
>
<template slot-scope="{ node, data }">
<span class="custom-tree-node" @mouseenter="mouseenter(data)" @mouseleave="mouseleave(data)">
<span><i v-if="node.level === 1" class="iconfont icon-zuzhi tree-folder" />{{ node.label }}</span>
<span><i v-if="node.level === 1" class="iconfont icon-zuzhi tree-folder" />{{ data.name ? node.label + '(' + data.name + ')' : node.label }}</span>
<span class="tree-bts">
<i v-show="node.level === 1 && data.show" class="el-icon-circle-plus-outline bt-add" @click="() => handleAddContrast()" />
<i v-show="node.level === 4 && data.show" class="el-icon-edit-outline bt-edit" @click="() => handleEditContrast(data)" />
......@@ -271,6 +271,7 @@ export default {
},
/** 节点单击事件 */
handleNodeClick(data, node) {
this.queryParams.contrastId = ''
if (node.level === 4) {
this.queryParams.contrastId = data.id
this.getList()
......@@ -289,7 +290,7 @@ export default {
},
handleEditContrast(data) {
this.dialogFormContrastVisible = true
this.currentContrast = Object.assign({}, data)
this.currentContrast = Object.assign({}, data.data)
},
handleDelContrast(data) {
this.$confirm('选中数据将被永久删除, 是否继续?', '提示', {
......
......@@ -44,6 +44,16 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="绑定标准字段" prop="bindGbColumn">
<el-select v-model="form.bindGbColumn" placeholder="请选择标准字典字段">
<el-option
v-for="item in gbColumnOptions"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确定</el-button>
......@@ -86,7 +96,8 @@ export default {
columnName: undefined,
gbTypeId: undefined,
gbTypeCode: undefined,
gbTypeName: undefined
gbTypeName: undefined,
bindGbColumn: undefined
},
rules: {
sourceId: [
......@@ -100,12 +111,20 @@ export default {
],
gbTypeId: [
{ required: true, message: '标准类别不能为空', trigger: 'change' }
],
bindGbColumn: [
{ required: true, message: '绑定标准字段不能为空', trigger: 'change' }
]
},
sourceOptions: [],
tableOptions: [],
columnOptions: [],
gbTypeOptions: []
gbTypeOptions: [],
// 标准字典字段数据字典
gbColumnOptions: [
{ value: 'gb_code', label: '标准编码' },
{ value: 'gb_name', label: '标准名称' }
]
}
},
computed: {
......@@ -163,8 +182,10 @@ export default {
return item.id === val
})
this.form.tableName = table.tableName
this.form.tableComment = table.tableComment
this.form.columnId = ''
this.form.columnName = ''
this.form.columnComment = ''
}
})
},
......@@ -173,6 +194,8 @@ export default {
return item.id === val
})
this.form.columnName = column.columnName
this.form.columnComment = column.columnComment
this.$forceUpdate()
},
gbTypeSelectChanged(val) {
const gbType = this.gbTypeOptions.find(function(item) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment