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