<?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="com.cloud.control.dao.TaskMapper">
|
<resultMap id="BaseResultMap" type="com.cloud.control.model.Task">
|
<id column="id" jdbcType="VARCHAR" property="id" />
|
<result column="name" jdbcType="VARCHAR" property="name" />
|
<result column="startTime" jdbcType="TIMESTAMP" property="startTime" />
|
<result column="endTime" jdbcType="TIMESTAMP" property="endTime" />
|
<result column="status" jdbcType="INTEGER" property="status" />
|
<result column="source" jdbcType="VARCHAR" property="source" />
|
<result column="scope" jdbcType="OTHER" property="scope" />
|
<result column="createBy" jdbcType="VARCHAR" property="createBy" />
|
<result column="createTime" jdbcType="TIMESTAMP" property="createTime" />
|
<result column="updateBy" jdbcType="VARCHAR" property="updateBy" />
|
<result column="updateTime" jdbcType="TIMESTAMP" property="updateTime" />
|
<result column="enabled" jdbcType="VARCHAR" property="enabled" />
|
<result column="threshold" jdbcType="INTEGER" property="threshold" />
|
<result column="delFlag" jdbcType="VARCHAR" property="delFlag" />
|
<result column="syncType" jdbcType="INTEGER" property="syncType" />
|
<result column="personCount" jdbcType="INTEGER" property="personCount"/>
|
</resultMap>
|
<sql id="Base_Column_List">
|
t.id id,t.name name,t.startTime startTime,t.endTime endTime,t.status status, t.source source,
|
t.scope scope,t.createBy createBy,t.createTime createTime, t.updateBy updateBy,t.updateTime updateTime, t.enabled enabled,
|
t.threshold threshold,t.syncType syncType
|
</sql>
|
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from task t
|
where id = #{id,jdbcType=VARCHAR}
|
</select>
|
<!-- 查询条件下任务总数 wp 19-01-22 -->
|
<select id="selectAllTaskCount" resultType="java.lang.Long">
|
select count(id)
|
from task
|
where delFlag != '1'
|
<if test="startTime != null">
|
and startTime > #{startTime}
|
</if>
|
<if test="endTime != null" >
|
and endTime < #{endTime}
|
</if>
|
<if test="likeName != null and likeName != ''" >
|
and (name like concat('%',#{likeName},'%') or scope like concat('%',#{likeName},'%') )
|
</if>
|
<if test="status != null" >
|
and status = #{status}
|
</if>
|
<if test="source !=null" >
|
and source = #{source}
|
</if>
|
</select>
|
<!-- 查询条件下任务列表 wp 19-01-22-->
|
<select id="selectAllTaskByPage" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List"></include>,count(tu.id) personCount
|
from task t
|
left join task_user tu on t.id = tu.taskId
|
where t.delFlag != '1'
|
<if test="startTime != null">
|
and t.startTime > #{startTime}
|
</if>
|
<if test="endTime != null" >
|
and t.endTime < #{endTime}
|
</if>
|
<if test="likeName != null and likeName != '' " >
|
and (t.name like concat('%',#{likeName},'%') or t.scope like concat('%',#{likeName},'%') )
|
</if>
|
<if test="status != null" >
|
and t.status = #{status,jdbcType=INTEGER}
|
</if>
|
<if test="source !=null" >
|
and t.source = #{source}
|
</if>
|
group by t.id
|
<if test="sortName != null and sortName != ''" >
|
order by ${sortName}
|
<if test="sortType != null and sortType != ''" >
|
${sortType}
|
</if>
|
<if test="sortType == null or sortType == ''">
|
desc
|
</if>
|
</if>
|
</select>
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
|
delete from task
|
where id = #{id,jdbcType=VARCHAR}
|
</delete>
|
<insert id="insert" parameterType="com.cloud.control.model.Task">
|
insert into task (id, name,startTime,
|
endTime, status, source,
|
scope, createBy, createTime, updateBy, updateTime,
|
enabled, threshold, delFlag,syncType
|
)
|
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP},
|
#{endTime,jdbcType=TIMESTAMP}, #{status,jdbcType=INTEGER}, #{source,jdbcType=VARCHAR},
|
#{scope,jdbcType=OTHER}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
|
#{updateBy,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},
|
#{enabled,jdbcType=VARCHAR}, #{threshold,jdbcType=INTEGER}, #{delFlag,jdbcType=VARCHAR}, #{syncType,jdbcType=INTEGER}
|
)
|
</insert>
|
<insert id="insertSelective" parameterType="com.cloud.control.model.Task">
|
insert into task
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
id,
|
</if>
|
<if test="name != null">
|
name,
|
</if>
|
<if test="startTime != null">
|
startTime,
|
</if>
|
<if test="endTime != null">
|
endTime,
|
</if>
|
<if test="status != null">
|
status,
|
</if>
|
<if test="source != null">
|
source,
|
</if>
|
<if test="scope != null">
|
scope,
|
</if>
|
<if test="createBy != null">
|
createBy,
|
</if>
|
<if test="createTime != null">
|
createTime,
|
</if>
|
<if test="updateBy != null">
|
updateBy,
|
</if>
|
<if test="updateTime != null">
|
updateTime,
|
</if>
|
<if test="enabled != null">
|
enabled,
|
</if>
|
<if test="threshold != null">
|
threshold,
|
</if>
|
<if test="delFlag != null">
|
delFlag,
|
</if>
|
<if test="syncType != null">
|
syncType,
|
</if>
|
</trim>
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<if test="id != null">
|
#{id,jdbcType=VARCHAR},
|
</if>
|
<if test="name != null">
|
#{name,jdbcType=VARCHAR},
|
</if>
|
<if test="startTime != null">
|
#{startTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="endTime != null">
|
#{endTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="status != null">
|
#{status,jdbcType=INTEGER},
|
</if>
|
<if test="source != null">
|
#{source,jdbcType=VARCHAR},
|
</if>
|
<if test="scope != null">
|
#{scope,jdbcType=OTHER},
|
</if>
|
<if test="createBy != null">
|
#{createBy,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
#{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateBy != null">
|
#{updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="updateTime != null">
|
#{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="enabled != null">
|
#{enabled,jdbcType=VARCHAR},
|
</if>
|
<if test="threshold != null">
|
#{threshold,jdbcType=INTEGER},
|
</if>
|
<if test="delFlag != null">
|
#{delFlag,jdbcType=VARCHAR},
|
</if>
|
<if test="syncType != null">
|
#{syncType,jdbcType=INTEGER},
|
</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKeySelective" parameterType="com.cloud.control.model.Task">
|
update task
|
<set>
|
<if test="name != null">
|
name = #{name,jdbcType=VARCHAR},
|
</if>
|
<if test="startTime != null">
|
startTime = #{startTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="endTime != null">
|
endTime = #{endTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="status != null">
|
status = #{status,jdbcType=INTEGER},
|
</if>
|
<if test="source != null">
|
source = #{source,jdbcType=VARCHAR},
|
</if>
|
<if test="scope != null">
|
scope = #{scope,jdbcType=OTHER},
|
</if>
|
<if test="createBy != null">
|
createBy = #{createBy,jdbcType=VARCHAR},
|
</if>
|
<if test="createTime != null">
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="updateBy != null">
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
</if>
|
<if test="updateTime != null">
|
updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
</if>
|
<if test="enabled != null">
|
enabled = #{enabled,jdbcType=VARCHAR},
|
</if>
|
<if test="threshold != null">
|
threshold = #{threshold,jdbcType=INTEGER},
|
</if>
|
<if test="delFlag != null">
|
delFlag = #{delFlag,jdbcType=VARCHAR},
|
</if>
|
<if test="syncType != null">
|
syncType = #{syncType,jdbcType=INTEGER},
|
</if>
|
</set>
|
where id = #{id,jdbcType=VARCHAR}
|
</update>
|
<update id="updateByPrimaryKey" parameterType="com.cloud.control.model.Task">
|
update task
|
set name = #{name,jdbcType=VARCHAR},
|
startTime = #{startTime,jdbcType=TIMESTAMP},
|
endTime = #{endTime,jdbcType=TIMESTAMP},
|
status = #{status,jdbcType=INTEGER},
|
source = #{source,jdbcType=VARCHAR},
|
scope = #{scope,jdbcType=OTHER},
|
createBy = #{createBy,jdbcType=VARCHAR},
|
createTime = #{createTime,jdbcType=TIMESTAMP},
|
updateBy = #{updateBy,jdbcType=VARCHAR},
|
updateTime = #{updateTime,jdbcType=TIMESTAMP},
|
enabled = #{enabled,jdbcType=VARCHAR},
|
threshold = #{threshold,jdbcType=INTEGER},
|
delFlag = #{delFlag,jdbcType=VARCHAR},
|
syncType = #{syncType,jdbcType=INTEGER}
|
where id = #{id,jdbcType=VARCHAR}
|
</update>
|
<select id="findAll" resultMap="BaseResultMap" parameterType="java.util.Map">
|
select <include refid="Base_Column_List" />
|
from task t
|
where t.delFlag='0'
|
|
</select>
|
<select id="selectScopeById" parameterType="java.lang.String" resultMap="BaseResultMap">
|
select
|
<include refid="Base_Column_List" />
|
from task t
|
where id = #{id,jdbcType=VARCHAR}
|
</select>
|
</mapper>
|