fix: 同步日志按时间排序;修复添加定时任务失败

This commit is contained in:
taojinlong 2021-05-12 16:10:54 +08:00
parent 5c26b5986d
commit a77fb3c7ae
11 changed files with 122 additions and 108 deletions

View File

@ -17,9 +17,9 @@ public class DatasetTableTaskLog implements Serializable {
private String status;
private String info;
private Long createTime;
private String info;
private static final long serialVersionUID = 1L;
}

View File

@ -504,76 +504,6 @@ public class DatasetTableTaskLogExample {
return (Criteria) this;
}
public Criteria andInfoIsNull() {
addCriterion("info is null");
return (Criteria) this;
}
public Criteria andInfoIsNotNull() {
addCriterion("info is not null");
return (Criteria) this;
}
public Criteria andInfoEqualTo(String value) {
addCriterion("info =", value, "info");
return (Criteria) this;
}
public Criteria andInfoNotEqualTo(String value) {
addCriterion("info <>", value, "info");
return (Criteria) this;
}
public Criteria andInfoGreaterThan(String value) {
addCriterion("info >", value, "info");
return (Criteria) this;
}
public Criteria andInfoGreaterThanOrEqualTo(String value) {
addCriterion("info >=", value, "info");
return (Criteria) this;
}
public Criteria andInfoLessThan(String value) {
addCriterion("info <", value, "info");
return (Criteria) this;
}
public Criteria andInfoLessThanOrEqualTo(String value) {
addCriterion("info <=", value, "info");
return (Criteria) this;
}
public Criteria andInfoLike(String value) {
addCriterion("info like", value, "info");
return (Criteria) this;
}
public Criteria andInfoNotLike(String value) {
addCriterion("info not like", value, "info");
return (Criteria) this;
}
public Criteria andInfoIn(List<String> values) {
addCriterion("info in", values, "info");
return (Criteria) this;
}
public Criteria andInfoNotIn(List<String> values) {
addCriterion("info not in", values, "info");
return (Criteria) this;
}
public Criteria andInfoBetween(String value1, String value2) {
addCriterion("info between", value1, value2, "info");
return (Criteria) this;
}
public Criteria andInfoNotBetween(String value1, String value2) {
addCriterion("info not between", value1, value2, "info");
return (Criteria) this;
}
public Criteria andCreateTimeIsNull() {
addCriterion("create_time is null");
return (Criteria) this;

View File

@ -10,13 +10,21 @@ public interface DatasetTableIncrementalConfigMapper {
int deleteByExample(DatasetTableIncrementalConfigExample example);
int deleteByPrimaryKey(String id);
int insert(DatasetTableIncrementalConfig record);
int insertSelective(DatasetTableIncrementalConfig record);
List<DatasetTableIncrementalConfig> selectByExample(DatasetTableIncrementalConfigExample example);
DatasetTableIncrementalConfig selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") DatasetTableIncrementalConfig record, @Param("example") DatasetTableIncrementalConfigExample example);
int updateByExample(@Param("record") DatasetTableIncrementalConfig record, @Param("example") DatasetTableIncrementalConfigExample example);
int updateByPrimaryKeySelective(DatasetTableIncrementalConfig record);
int updateByPrimaryKey(DatasetTableIncrementalConfig record);
}

View File

@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.dataease.base.mapper.DatasetTableIncrementalConfigMapper">
<resultMap id="BaseResultMap" type="io.dataease.base.domain.DatasetTableIncrementalConfig">
<result column="id" jdbcType="VARCHAR" property="id" />
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="table_id" jdbcType="VARCHAR" property="tableId" />
<result column="incremental_delete" jdbcType="VARCHAR" property="incrementalDelete" />
<result column="incremental_add" jdbcType="VARCHAR" property="incrementalAdd" />
@ -82,6 +82,16 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from dataset_table_incremental_config
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from dataset_table_incremental_config
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfigExample">
delete from dataset_table_incremental_config
<if test="_parameter != null">
@ -161,4 +171,26 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfig">
update dataset_table_incremental_config
<set>
<if test="tableId != null">
table_id = #{tableId,jdbcType=VARCHAR},
</if>
<if test="incrementalDelete != null">
incremental_delete = #{incrementalDelete,jdbcType=VARCHAR},
</if>
<if test="incrementalAdd != null">
incremental_add = #{incrementalAdd,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.DatasetTableIncrementalConfig">
update dataset_table_incremental_config
set table_id = #{tableId,jdbcType=VARCHAR},
incremental_delete = #{incrementalDelete,jdbcType=VARCHAR},
incremental_add = #{incrementalAdd,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -16,15 +16,21 @@ public interface DatasetTableTaskLogMapper {
int insertSelective(DatasetTableTaskLog record);
List<DatasetTableTaskLog> selectByExampleWithBLOBs(DatasetTableTaskLogExample example);
List<DatasetTableTaskLog> selectByExample(DatasetTableTaskLogExample example);
DatasetTableTaskLog selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") DatasetTableTaskLog record, @Param("example") DatasetTableTaskLogExample example);
int updateByExampleWithBLOBs(@Param("record") DatasetTableTaskLog record, @Param("example") DatasetTableTaskLogExample example);
int updateByExample(@Param("record") DatasetTableTaskLog record, @Param("example") DatasetTableTaskLogExample example);
int updateByPrimaryKeySelective(DatasetTableTaskLog record);
int updateByPrimaryKeyWithBLOBs(DatasetTableTaskLog record);
int updateByPrimaryKey(DatasetTableTaskLog record);
}

View File

@ -8,9 +8,11 @@
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="info" jdbcType="VARCHAR" property="info" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.DatasetTableTaskLog">
<result column="info" jdbcType="LONGVARCHAR" property="info" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
@ -70,8 +72,27 @@
</where>
</sql>
<sql id="Base_Column_List">
id, table_id, task_id, start_time, end_time, `status`, info, create_time
id, table_id, task_id, start_time, end_time, `status`, create_time
</sql>
<sql id="Blob_Column_List">
info
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.dataease.base.domain.DatasetTableTaskLogExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from dataset_table_task_log
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.dataease.base.domain.DatasetTableTaskLogExample" resultMap="BaseResultMap">
select
<if test="distinct">
@ -86,9 +107,11 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from dataset_table_task_log
where id = #{id,jdbcType=VARCHAR}
</select>
@ -105,10 +128,10 @@
<insert id="insert" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
insert into dataset_table_task_log (id, table_id, task_id,
start_time, end_time, `status`,
info, create_time)
create_time, info)
values (#{id,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{taskId,jdbcType=VARCHAR},
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{info,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT})
#{createTime,jdbcType=BIGINT}, #{info,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
insert into dataset_table_task_log
@ -131,12 +154,12 @@
<if test="status != null">
`status`,
</if>
<if test="info != null">
info,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="info != null">
info,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -157,12 +180,12 @@
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="info != null">
#{info,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=BIGINT},
</if>
<if test="info != null">
#{info,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.dataease.base.domain.DatasetTableTaskLogExample" resultType="java.lang.Long">
@ -192,17 +215,31 @@
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.info != null">
info = #{record.info,jdbcType=VARCHAR},
</if>
<if test="record.createTime != null">
create_time = #{record.createTime,jdbcType=BIGINT},
</if>
<if test="record.info != null">
info = #{record.info,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update dataset_table_task_log
set id = #{record.id,jdbcType=VARCHAR},
table_id = #{record.tableId,jdbcType=VARCHAR},
task_id = #{record.taskId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
info = #{record.info,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update dataset_table_task_log
set id = #{record.id,jdbcType=VARCHAR},
@ -211,7 +248,6 @@
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=VARCHAR},
info = #{record.info,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -235,15 +271,26 @@
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="info != null">
info = #{info,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=BIGINT},
</if>
<if test="info != null">
info = #{info,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
update dataset_table_task_log
set table_id = #{tableId,jdbcType=VARCHAR},
task_id = #{taskId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
`status` = #{status,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
info = #{info,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.DatasetTableTaskLog">
update dataset_table_task_log
set table_id = #{tableId,jdbcType=VARCHAR},
@ -251,7 +298,6 @@
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
`status` = #{status,jdbcType=VARCHAR},
info = #{info,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>

View File

@ -13,6 +13,7 @@
FROM dataset_table_task_log
LEFT JOIN dataset_table_task ON dataset_table_task_log.task_id = dataset_table_task.id
WHERE dataset_table_task_log.table_id = #{tableId,jdbcType=VARCHAR}
ORDER BY dataset_table_task_log.create_time desc
</select>
</mapper>

View File

@ -664,9 +664,7 @@ public class DataSetTableService {
datasetTableIncrementalConfig.setId(UUID.randomUUID().toString());
datasetTableIncrementalConfigMapper.insertSelective(datasetTableIncrementalConfig);
} else {
DatasetTableIncrementalConfigExample example = new DatasetTableIncrementalConfigExample();
example.createCriteria().andTableIdEqualTo(datasetTableIncrementalConfig.getTableId());
datasetTableIncrementalConfigMapper.updateByExample(datasetTableIncrementalConfig, example);
datasetTableIncrementalConfigMapper.updateByPrimaryKey(datasetTableIncrementalConfig);
}
}

View File

@ -39,12 +39,6 @@ public class DataSetTableTaskLogService {
}
public List<DataSetTaskLogDTO> list(DatasetTableTaskLog request) {
DatasetTableTaskLogExample datasetTableTaskLogExample = new DatasetTableTaskLogExample();
DatasetTableTaskLogExample.Criteria criteria = datasetTableTaskLogExample.createCriteria();
if (StringUtils.isNotEmpty(request.getTableId())) {
criteria.andTableIdEqualTo(request.getTableId());
}
datasetTableTaskLogExample.setOrderByClause("create_time desc");
return extDataSetTaskMapper.list(request);
}

View File

@ -64,11 +64,12 @@
<!--要生成的数据库表 -->
<!-- <table tableName="datasource"/>-->
<!-- <table tableName="sys_dict"/>-->
<!-- <table tableName="sys_dict_item"/>-->
<table tableName="my_plugin"/>
<!-- <table tableName="panel_design"/>-->
<table tableName="dataset_table_incremental_config">
<columnOverride column="incremental_delete" javaType="java.lang.String" jdbcType="VARCHAR" />
<columnOverride column="incremental_add" javaType="java.lang.String" jdbcType="VARCHAR" />
</table>
</context>

View File

@ -468,8 +468,6 @@ export default {
this.incrementalConfig.incrementalDelete = this.sql
}
this.incrementalConfig.tableId = this.table.id
console.log(this.incrementalConfig)
task.startTime = new Date(task.startTime).getTime()
task.endTime = new Date(task.endTime).getTime()
task.tableId = this.table.id