|
@@ -2,11 +2,11 @@
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
<mapper namespace="cn.sagacloud.mybatis.mapper.TaskMapper">
|
|
|
<insert id="addTask" parameterType="cn.sagacloud.mybatis.model.TaskModel" useGeneratedKeys="true" keyProperty="id">
|
|
|
- INSERT INTO `task`(task_name, task_cmd, task_param, task_status, task_result_json, task_last_mac, task_expected_finish_time)
|
|
|
- VALUE(#{task_name},#{task_cmd},#{task_param},#{task_status},#{task_result_json},#{task_last_mac},#{task_expected_finish_time});
|
|
|
+ INSERT INTO `task`(task_name, task_cmd, task_param, task_status, task_result_json, task_last_client, task_expected_finish_time)
|
|
|
+ VALUE(#{task_name},#{task_cmd},#{task_param},#{task_status},#{task_result_json},#{task_last_client},#{task_expected_finish_time});
|
|
|
</insert>
|
|
|
|
|
|
- <insert id="addDownload" parameterType="cn.sagacloud.mybatis.model.DownloadTaskModel" useGeneratedKeys="true" keyProperty="list.">
|
|
|
+ <insert id="addDownload" parameterType="cn.sagacloud.mybatis.model.DownloadTaskModel" useGeneratedKeys="true" keyProperty="list.id">
|
|
|
INSERT INTO `download`(task_id,task_url,task_md5) VALUES
|
|
|
<foreach collection="list" item="item" separator=",">
|
|
|
(#{taskId},#{item.task_url},#{item.task_md5})
|
|
@@ -14,7 +14,7 @@
|
|
|
</insert>
|
|
|
|
|
|
<select id="getTasksByIds" resultMap="taskModelList">
|
|
|
- select task.id, task_name, task_cmd, task_param, task_status, task_result_json, task_last_mac,
|
|
|
+ select task.id, task_name, task_cmd, task_param, task_status, task_result_json, task_last_client,
|
|
|
task_expected_finish_time, download.id downloadId, task_id, task_url, task_md5
|
|
|
from `task` right join `download` on task.id = download.task_id where task.id in
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
|
@@ -23,13 +23,32 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="getTasksByStatus" resultMap="taskModelList">
|
|
|
- select task.id, task_name, task_cmd, task_param, task_status, task_result_json, task_last_mac,
|
|
|
+ select task.id, task_name, task_cmd, task_param, task_status, task_result_json, task_last_client,
|
|
|
task_expected_finish_time, download.id downloadId, task_id, task_url, task_md5
|
|
|
from `task` right join `download` on task.id = download.task_id where task.task_status in
|
|
|
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
|
|
#{item}
|
|
|
</foreach>;
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getTasksMapByIds" resultMap="taskModelList">
|
|
|
+ select task.id, task_name, task_cmd, task_param, task_status, task_result_json, task_last_client,
|
|
|
+ task_expected_finish_time, download.id downloadId, task_id, task_url, task_md5
|
|
|
+ from `task` right join `download` on task.id = download.task_id where task.id in
|
|
|
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>;
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getTasksMapByStatus" resultMap="taskModelList">
|
|
|
+ select task.id, task_name, task_cmd, task_param, task_status, task_result_json, task_last_client,
|
|
|
+ task_expected_finish_time, download.id downloadId, task_id, task_url, task_md5
|
|
|
+ from `task` right join `download` on task.id = download.task_id where task.task_status in
|
|
|
+ <foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
|
|
+ #{item}
|
|
|
+ </foreach>;
|
|
|
+ </select>
|
|
|
+
|
|
|
<resultMap id="taskModelList" type="cn.sagacloud.mybatis.model.TaskModel">
|
|
|
<id property="id" column="id"/>
|
|
|
<result property="task_name" column="task_name"/>
|
|
@@ -37,7 +56,7 @@
|
|
|
<result property="task_param" column="task_param"/>
|
|
|
<result property="task_status" column="task_status"/>
|
|
|
<result property="task_result_json" column="task_result_json"/>
|
|
|
- <result property="task_last_mac" column="task_last_mac"/>
|
|
|
+ <result property="task_last_client" column="task_last_client"/>
|
|
|
<result property="task_expected_finish_time" column="task_expected_finish_time"/>
|
|
|
<collection property="downloadTaskModelList" ofType="cn.sagacloud.mybatis.model.DownloadTaskModel">
|
|
|
<id property="id" column="downloadId"/>
|
|
@@ -46,4 +65,15 @@
|
|
|
<result property="task_md5" column="task_md5"/>
|
|
|
</collection>
|
|
|
</resultMap>
|
|
|
+
|
|
|
+ <update id="updateSingleTask" parameterType="cn.sagacloud.mybatis.model.TaskModel">
|
|
|
+ UPDATE task
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="task_status!=null">task_status=#{task_status},</if>
|
|
|
+ <if test="task_result_json!=null">task_result_json=#{task_result_json},</if>
|
|
|
+ <if test="task_last_client!=null">task_last_client=#{task_last_client},</if>
|
|
|
+ </trim>
|
|
|
+ WHERE id = #{id};
|
|
|
+ </update>
|
|
|
+
|
|
|
</mapper>
|