Commit cbd215fb authored by mcb's avatar mcb

离线同步任务列表

parent c8ead692
alter table dmp_develop_task add SOURCE_DB_ID varchar(64) default NULL COMMENT'源数据库ID';
alter table dmp_develop_task add SOURCE_DB_NAME varchar(64) default NULL COMMENT'源数据库名称';
alter table dmp_develop_task add SOURCE_TABLE_NAME varchar(64) default NULL COMMENT'源数据表名称';
alter table dmp_develop_task add TARGET_DB_NAME varchar(64) default NULL COMMENT'目标数据库名称';
alter table dmp_develop_task add TARGET_TABLE_NAME varchar(64) default NULL COMMENT'目标数据表名称';
\ No newline at end of file
......@@ -47,8 +47,6 @@ public class OfflineSynchController {
pageInfo.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return pageInfo;
}
}
......@@ -6,7 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: TaskListPageDto
* @Description: 离线同步任务列表返回参数
* @Author
* @Author :Bellamy
* @Date 2020/12/21
* @Version 1.0
*/
......@@ -14,10 +14,10 @@ import io.swagger.annotations.ApiModelProperty;
public class TaskListPageDto {
/*
* id
* taskId
* */
@ApiModelProperty(value = "id")
String id;
@ApiModelProperty(value = "任务taskId")
String taskId;
/*
* treeId
......@@ -50,12 +50,42 @@ public class TaskListPageDto {
* 创建时间
* */
@ApiModelProperty(value = "创建时间")
String creTime;
String createTime;
/*
* 更改时间
* */
@ApiModelProperty(value = "更改时间")
String uptTime;
String updateTime;
/*
* 源数据库名称
* */
@ApiModelProperty(value = "源数据库名称")
String sourceDbName;
/*
* 源数据库表名称
* */
@ApiModelProperty(value = "源数据表名称")
String sourceTableName;
/*
* 目标数据库名称
* */
@ApiModelProperty(value = "目标数据库名称")
String targetDbName;
/*
* 目标数据库表名称
* */
@ApiModelProperty(value = "目标数据表名称")
String targetTableName;
/*
* 目标数据库类型
* */
@ApiModelProperty(value = "目标数据库类型")
String targetDbType;
public String getSyncTime() {
return syncTime;
......@@ -89,28 +119,28 @@ public class TaskListPageDto {
this.chkTime = chkTime;
}
public String getCreTime() {
return creTime;
public String getCreateTime() {
return createTime;
}
public void setCreTime(String creTime) {
this.creTime = creTime;
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUptTime() {
return uptTime;
public String getUpdateTime() {
return updateTime;
}
public void setUptTime(String uptTime) {
this.uptTime = uptTime;
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getId() {
return id;
public String getTaskId() {
return taskId;
}
public void setId(String id) {
this.id = id;
public void setTaskId(String taskId) {
this.taskId = taskId;
}
public String getTreeId() {
......@@ -120,4 +150,44 @@ public class TaskListPageDto {
public void setTreeId(String treeId) {
this.treeId = treeId;
}
public String getSourceDbName() {
return sourceDbName;
}
public void setSourceDbName(String sourceDbName) {
this.sourceDbName = sourceDbName;
}
public String getTargetDbName() {
return targetDbName;
}
public void setTargetDbName(String targetDbName) {
this.targetDbName = targetDbName;
}
public String getTargetDbType() {
return targetDbType;
}
public void setTargetDbType(String targetDbType) {
this.targetDbType = targetDbType;
}
public String getSourceTableName() {
return sourceTableName;
}
public void setSourceTableName(String sourceTableName) {
this.sourceTableName = sourceTableName;
}
public String getTargetTableName() {
return targetTableName;
}
public void setTargetTableName(String targetTableName) {
this.targetTableName = targetTableName;
}
}
......@@ -6,6 +6,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
/**
......@@ -21,6 +22,7 @@ public class TaskListPageReq extends BasePageBean {
* 项目ID
* */
@NotNull(message = "项目ID不能空")
@NotEmpty(message = "项目ID不能空")
@ApiModelProperty(value = "项目ID")
private String projectId;
......@@ -32,28 +34,34 @@ public class TaskListPageReq extends BasePageBean {
private String parentId;
/*
* 源数据id
* 源数据id
* */
@ApiModelProperty(value = "源数据id")
private String sourceDb;
@ApiModelProperty(value = "源数据id")
private String sourceDbId;
/*
* 目标数据库id
* */
@ApiModelProperty(value = "目标数据库id")
private String targetDb;
private String targetDbId;
/*
* 源数据库表
* 目标数据库名称
* */
@ApiModelProperty(value = "目标数据库名称")
private String targetDbName;
/*
* 源数据库表名称
* */
@ApiModelProperty(value = "源数据库表")
private String sourceTable;
private String sourceTableName;
/*
* 目标数据库表
* 目标数据库表名称
* */
@ApiModelProperty(value = "目标数据库表")
private String targetTable;
private String targetTableName;
public String getProjectId() {
return projectId;
......@@ -71,35 +79,43 @@ public class TaskListPageReq extends BasePageBean {
this.parentId = parentId;
}
public String getSourceDb() {
return sourceDb;
public String getSourceDbId() {
return sourceDbId;
}
public void setSourceDbId(String sourceDbId) {
this.sourceDbId = sourceDbId;
}
public String getTargetDbId() {
return targetDbId;
}
public void setSourceDb(String sourceDb) {
this.sourceDb = sourceDb;
public void setTargetDbId(String targetDbId) {
this.targetDbId = targetDbId;
}
public String getTargetDb() {
return targetDb;
public String getTargetDbName() {
return targetDbName;
}
public void setTargetDb(String targetDb) {
this.targetDb = targetDb;
public void setTargetDbName(String targetDbName) {
this.targetDbName = targetDbName;
}
public String getSourceTable() {
return sourceTable;
public String getSourceTableName() {
return sourceTableName;
}
public void setSourceTable(String sourceTable) {
this.sourceTable = sourceTable;
public void setSourceTableName(String sourceTableName) {
this.sourceTableName = sourceTableName;
}
public String getTargetTable() {
return targetTable;
public String getTargetTableName() {
return targetTableName;
}
public void setTargetTable(String targetTable) {
this.targetTable = targetTable;
public void setTargetTableName(String targetTableName) {
this.targetTableName = targetTableName;
}
}
......@@ -4,43 +4,36 @@
<select id="queryTaskListPage" resultType="com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageDto"
parameterType="com.jz.dmp.modules.controller.DataIntegration.bean.TaskListPageReq">
SELECT * FROM (
SELECT cast(ddt.script AS char) AS script,
SELECT
ddt.chk_result AS chkResult,
ddt.sync_result AS syncResult,
ddt.id AS id,
ddt.id AS taskId,
ddt.tree_id AS treeId,
dnt.name AS treeName,
DATE_FORMAT(ddt.create_time,'%Y-%m-%d %H:%i:%s') AS createTime,
DATE_FORMAT(ddt.update_time ,'%Y-%m-%d %H:%i:%s') AS updateTime,
DATE_FORMAT(ddt.chk_time,'%Y-%m-%d %H:%i:%s') AS chkTime,
DATE_FORMAT(ddt.sync_time,'%Y-%m-%d %H:%i:%s') AS syncTime,
dsdt.datasource_type AS dbType
FROM dmp_develop_task AS ddt
INNER JOIN dmp_navigation_tree AS dnt ON ddt.TREE_ID = dnt.ID
LEFT JOIN dmp_syncing_datasource AS dsd ON
instr(script,concat('"targetDbConnection":"',dsd.datasource_name,'"'))>0
LEFT JOIN dmp_syncing_datasource_type AS dsdt ON dsd.datasource_type = dsdt.id
WHERE ddt.data_status ='1' AND ddt.TYPE='3' AND ddt.TASK_TYPE ='2'
AND dnt.CATEGORY='2' AND dnt.TYPE ='3'
AND dnt.IS_LEVEL ='1'
AND dnt.PROJECT_ID =#{projectId}
AND dsd.PROJECT_ID=#{projectId}
) AS a
WHERE 1=1
<if test="sourceDb !=null and sourceDb !=''">
AND a.SCRIPT LIKE CONCAT('%','"dbConnection":','"',#{sourceDb},'"','%')
</if>
<if test="targetDb !=null and targetDb !=''">
AND a.SCRIPT LIKE CONCAT('%','"targetDbConnection":','"',#{targetDb},'"','%')
</if>
<if test="sourceTable !=null and sourceTable !=''">
AND a.SCRIPT LIKE CONCAT('%','"registerTableName":','"',#{sourceTable},'"','%')
</if>
<if test="targetTable !=null and targetTable !=''">
AND a.SCRIPT LIKE CONCAT('%','"targetTable":','"',#{targetTable},'"','%')
</if>
ORDER BY a.createTime DESC
dnt.NAME AS treeName,
DATE_FORMAT( ddt.create_time, '%Y-%m-%d %H:%i:%s' ) AS createTime,
DATE_FORMAT( ddt.update_time, '%Y-%m-%d %H:%i:%s' ) AS updateTime,
DATE_FORMAT( ddt.chk_time, '%Y-%m-%d %H:%i:%s' ) AS chkTime,
DATE_FORMAT( ddt.sync_time, '%Y-%m-%d %H:%i:%s' ) AS syncTime,
ddt.source_db_id as sourceDbId,
ddt.source_db_name as sourceDbName,
ddt.source_table_name as sourceTableName,
ddt.target_db_name as targetDbName,
ddt.target_table_name as targetTableName,
dsdt.datasource_type AS targetDbType
FROM dmp_develop_task AS ddt
INNER JOIN dmp_navigation_tree AS dnt ON ddt.TREE_ID = dnt.ID
LEFT JOIN dmp_syncing_datasource AS dsd ON instr(script,concat('"targetDbConnection":"',dsd.datasource_name,'"'))>0
LEFT JOIN dmp_syncing_datasource_type AS dsdt ON dsd.datasource_type = dsdt.id
WHERE ddt.data_status ='1' AND ddt.TYPE='3' AND ddt.TASK_TYPE ='2'
AND dnt.CATEGORY='2' AND dnt.TYPE ='3'
AND dnt.IS_LEVEL ='1'
AND dnt.PROJECT_ID =#{projectId}
AND dsd.PROJECT_ID=#{projectId}
<if test="sourceDbId != null and sourceDbId !=''">and ddt.source_db_id=#{sourceDbId}</if>
<if test="sourceTableName != null and sourceTableName !=''">and ddt.source_table_name like concat('%',#{sourceTableName},'%')</if>
<if test="targetDbName != null and targetDbName !=''">and ddt.target_db_name like concat('%',#{targetDbName},'%')</if>
<if test="targetTableName != null and targetTableName !=''">and ddt.target_table_name like concat('%',#{targetTableName},'%')</if>
ORDER BY ddt.create_time DESC
</select>
</mapper>
\ No newline at end of file
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