<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" 
"mybatis-3-mapper.dtd">
<mapper namespace="com.mortals.xhx.base.system.task.dao.ibatis.TaskDaoImpl">
    
	<!-- 字段和属性映射 -->
	<resultMap type="TaskEntity" id="TaskEntity-Map">
		<result property="id" column="id" />
		<result property="name" column="name" />
		<result property="taskKey" column="taskKey" />
		<result property="status" column="status" />
		<result property="excuteService" column="excuteService" />
		<result property="excuteParam" column="excuteParam" />
		<result property="excuteHost" column="excuteHost" />
		<result property="excuteStrategy" column="excuteStrategy" />
		<result property="excuteDate" column="excuteDate" />
		<result property="excuteTime" column="excuteTime" />
		<result property="remark" column="remark" />
		<result property="lastExcuteHost" column="lastExcuteHost" />
		<result property="lastExcuteTime" column="lastExcuteTime" />
		<result property="interimExcuteStatus" column="interimExcuteStatus" />
		<result property="createTime" column="createTime" />
		<result property="createUserId" column="createUserId" />
		<result property="createUserName" column="createUserName" />
	</resultMap>
	
	
	
	<!-- 表所有列 -->
	<sql id="_columns">
		<trim suffixOverrides="," suffix="">
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('id') or colPickMode == 1 and data.containsKey('id')))">
				a.id as id,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('name') or colPickMode == 1 and data.containsKey('name')))">
				a.name as name,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('taskKey') or colPickMode == 1 and data.containsKey('taskKey')))">
				a.taskKey as taskKey,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('status') or colPickMode == 1 and data.containsKey('status')))">
				a.status as status,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteService') or colPickMode == 1 and data.containsKey('excuteService')))">
				a.excuteService as excuteService,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteParam') or colPickMode == 1 and data.containsKey('excuteParam')))">
				a.excuteParam as excuteParam,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteHost') or colPickMode == 1 and data.containsKey('excuteHost')))">
				a.excuteHost as excuteHost,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteStrategy') or colPickMode == 1 and data.containsKey('excuteStrategy')))">
				a.excuteStrategy as excuteStrategy,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteDate') or colPickMode == 1 and data.containsKey('excuteDate')))">
				a.excuteDate as excuteDate,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('excuteTime') or colPickMode == 1 and data.containsKey('excuteTime')))">
				a.excuteTime as excuteTime,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('remark') or colPickMode == 1 and data.containsKey('remark')))">
				a.remark as remark,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastExcuteHost') or colPickMode == 1 and data.containsKey('lastExcuteHost')))">
				a.lastExcuteHost as lastExcuteHost,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('lastExcuteTime') or colPickMode == 1 and data.containsKey('lastExcuteTime')))">
				a.lastExcuteTime as lastExcuteTime,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('interimExcuteStatus') or colPickMode == 1 and data.containsKey('interimExcuteStatus')))">
				a.interimExcuteStatus as interimExcuteStatus,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createTime') or colPickMode == 1 and data.containsKey('createTime')))">
				a.createTime as createTime,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserId') or colPickMode == 1 and data.containsKey('createUserId')))">
				a.createUserId as createUserId,
			</if>
			<if test="(data == null) or (data != null and ( colPickMode == 0 and !data.containsKey('createUserName') or colPickMode == 1 and data.containsKey('createUserName')))">
				a.createUserName as createUserName,
			</if>
		</trim>
	</sql>
	<!-- 新增 -->
	<insert id="insert" parameterType="TaskEntity" useGeneratedKeys="true" keyProperty="id">
		insert into mortals_xhx_task 
		(name,taskKey,status,excuteService,excuteParam,
			excuteHost,excuteStrategy,excuteDate,excuteTime,remark,
			lastExcuteHost,lastExcuteTime,interimExcuteStatus,createTime,createUserId,
			createUserName
		)VALUES(#{name},#{taskKey},#{status},#{excuteService},#{excuteParam},
			#{excuteHost},#{excuteStrategy},#{excuteDate},#{excuteTime},#{remark},
			#{lastExcuteHost},#{lastExcuteTime},#{interimExcuteStatus},#{createTime},#{createUserId},
			#{createUserName})
	</insert>
	<!-- 批量新增 -->
	<insert id="insertBatch" parameterType="paramDto">
		insert into mortals_xhx_task 
		(name,taskKey,status,excuteService,excuteParam,
			excuteHost,excuteStrategy,excuteDate,excuteTime,remark,
			lastExcuteHost,lastExcuteTime,interimExcuteStatus,createTime,createUserId,
			createUserName
		)
		VALUES
		<foreach collection="data.dataList" item="item" index="index" separator="," >  
		(#{item.name},#{item.taskKey},#{item.status},#{item.excuteService},#{item.excuteParam},
			#{item.excuteHost},#{item.excuteStrategy},#{item.excuteDate},#{item.excuteTime},#{item.remark},
			#{item.lastExcuteHost},#{item.lastExcuteTime},#{item.interimExcuteStatus},#{item.createTime},#{item.createUserId},
			#{item.createUserName})
		</foreach>
	</insert>
	<!-- 根据ParamDto更新 -->
	<update id="update" parameterType="paramDto">
		update mortals_xhx_task as a
		   set
		   <trim suffixOverrides="," suffix="">
				<if test="(colPickMode==0 and data.containsKey('name')) or (colPickMode==1 and !data.containsKey('name'))">
					a.name=#{data.name},
				</if>
				<if test="(colPickMode==0 and data.containsKey('taskKey')) or (colPickMode==1 and !data.containsKey('taskKey'))">
					a.taskKey=#{data.taskKey},
				</if>
				<if test="(colPickMode==0 and data.containsKey('status')) or (colPickMode==1 and !data.containsKey('status'))">
					a.status=#{data.status},
				</if>
				<if test="(colPickMode==0 and data.containsKey('statusIncrement')) or (colPickMode==1 and !data.containsKey('statusIncrement'))">
					a.status=ifnull(a.status,0) + #{data.statusIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteService')) or (colPickMode==1 and !data.containsKey('excuteService'))">
					a.excuteService=#{data.excuteService},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteParam')) or (colPickMode==1 and !data.containsKey('excuteParam'))">
					a.excuteParam=#{data.excuteParam},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteHost')) or (colPickMode==1 and !data.containsKey('excuteHost'))">
					a.excuteHost=#{data.excuteHost},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteStrategy')) or (colPickMode==1 and !data.containsKey('excuteStrategy'))">
					a.excuteStrategy=#{data.excuteStrategy},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteStrategyIncrement')) or (colPickMode==1 and !data.containsKey('excuteStrategyIncrement'))">
					a.excuteStrategy=ifnull(a.excuteStrategy,0) + #{data.excuteStrategyIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteDate')) or (colPickMode==1 and !data.containsKey('excuteDate'))">
					a.excuteDate=#{data.excuteDate},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteDateIncrement')) or (colPickMode==1 and !data.containsKey('excuteDateIncrement'))">
					a.excuteDate=ifnull(a.excuteDate,0) + #{data.excuteDateIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('excuteTime')) or (colPickMode==1 and !data.containsKey('excuteTime'))">
					a.excuteTime=#{data.excuteTime},
				</if>
				<if test="(colPickMode==0 and data.containsKey('remark')) or (colPickMode==1 and !data.containsKey('remark'))">
					a.remark=#{data.remark},
				</if>
				<if test="(colPickMode==0 and data.containsKey('lastExcuteHost')) or (colPickMode==1 and !data.containsKey('lastExcuteHost'))">
					a.lastExcuteHost=#{data.lastExcuteHost},
				</if>
				<if test="(colPickMode==0 and data.containsKey('lastExcuteTime')) or (colPickMode==1 and !data.containsKey('lastExcuteTime'))">
					a.lastExcuteTime=#{data.lastExcuteTime},
				</if>
				<if test="(colPickMode==0 and data.containsKey('interimExcuteStatus')) or (colPickMode==1 and !data.containsKey('interimExcuteStatus'))">
					a.interimExcuteStatus=#{data.interimExcuteStatus},
				</if>
				<if test="(colPickMode==0 and data.containsKey('interimExcuteStatusIncrement')) or (colPickMode==1 and !data.containsKey('interimExcuteStatusIncrement'))">
					a.interimExcuteStatus=ifnull(a.interimExcuteStatus,0) + #{data.interimExcuteStatusIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createTime')) or (colPickMode==1 and !data.containsKey('createTime'))">
					a.createTime=#{data.createTime},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createUserId')) or (colPickMode==1 and !data.containsKey('createUserId'))">
					a.createUserId=#{data.createUserId},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createUserIdIncrement')) or (colPickMode==1 and !data.containsKey('createUserIdIncrement'))">
					a.createUserId=ifnull(a.createUserId,0) + #{data.createUserIdIncrement},
				</if>
				<if test="(colPickMode==0 and data.containsKey('createUserName')) or (colPickMode==1 and !data.containsKey('createUserName'))">
					a.createUserName=#{data.createUserName},
				</if>
		    </trim>
		   <trim suffixOverrides="where" suffix="">
			    where
			    <trim prefixOverrides="and" prefix="">
					<include refid="_condition_"/>
			   	</trim>
			</trim>
	</update>

	<!-- 根据主健查询 -->
	<select id="getByKey" parameterType="paramDto" resultMap="TaskEntity-Map">
		select <include refid="_columns"/>
		from mortals_xhx_task as a
	   where a.id=#{condition.id}
	</select>
	<!-- 根据主健删除 -->
	<delete id="deleteByKey" parameterType="paramDto">
		delete a.* from mortals_xhx_task as a where a.id=#{condition.id}
	</delete>
	<!-- 根据主健删除一批，针对单一主健有效 -->
	<delete id="deleteByKeys">
		delete from mortals_xhx_task where id in
		<foreach collection="array" item="item" index="index" open="(" separator="," close=")">
			#{item}
		</foreach>
	</delete>
	<!-- 根据paramDto删除一批 -->
	<delete id="deleteByMap" parameterType="paramDto">
		delete a.* from mortals_xhx_task as a
		<trim suffixOverrides="where" suffix="">
			 where 
			<trim prefixOverrides="and" prefix="">
				<include refid="_condition_"/>
			</trim>
		</trim>
	</delete>
	<!-- 获取列表 -->
	<select id="getList" parameterType="paramDto" resultMap="TaskEntity-Map">
		select <include refid="_columns"/>
		  from mortals_xhx_task as a
		 <trim suffixOverrides="where" suffix="">
			 where 
			 <trim prefixOverrides="and" prefix="">
			 	<include refid="_condition_"/>
			 </trim>
		 </trim>
		 <include refid="_orderCols_"/>
	</select>
	<!-- 获取 -->
	<select id="getListCount" parameterType="paramDto" resultType="int">
		select count(1)
		  from mortals_xhx_task as a
		 <trim suffixOverrides="where" suffix="">
			 where 
			 <trim prefixOverrides="and" prefix="">
				<include refid="_condition_"/>
			</trim>
		</trim>
	</select>
	
	<!-- 条件映射 -->
	<sql id="_condition_">
		<if test="condition != null and !condition.isEmpty()">
				<if test="condition.containsKey('id')">
					<if test="condition.id != null">
						and a.id=#{condition.id}
					</if>
				</if>
				<if test="condition.containsKey('id')">
					<if test="condition.id != null ">
						and a.id = #{condition.id}
					</if>
					<if test="condition.id == null">
						and a.id is null
					</if>
				</if>
				<if test="condition.containsKey('idList')">
					 and a.id in 
					<foreach collection="condition.idList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('idStart') and condition.idStart != null">
					<![CDATA[ and a.id >= #{condition.idStart} ]]>
				</if>
				<if test="condition.containsKey('idEnd') and condition.idEnd != null">
					<![CDATA[ and a.id <= #{condition.idEnd} ]]>
				</if>
				<if test="condition.containsKey('name')">
					<if test="condition.name != null and condition.name != ''">
						and a.name like #{condition.name}
					</if>
					<if test="condition.name == null">
						and a.name is null
					</if>
				</if>
				<if test="condition.containsKey('nameList')">
					 and a.name in 
					<foreach collection="condition.nameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('taskKey')">
					<if test="condition.taskKey != null and condition.taskKey != ''">
						and a.taskKey like #{condition.taskKey}
					</if>
					<if test="condition.taskKey == null">
						and a.taskKey is null
					</if>
				</if>
				<if test="condition.containsKey('taskKeyList')">
					 and a.taskKey in 
					<foreach collection="condition.taskKeyList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('status')">
					<if test="condition.status != null ">
						and a.status = #{condition.status}
					</if>
					<if test="condition.status == null">
						and a.status is null
					</if>
				</if>
				<if test="condition.containsKey('statusList')">
					 and a.status in 
					<foreach collection="condition.statusList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('statusStart') and condition.statusStart != null">
					<![CDATA[ and a.status >= #{condition.statusStart} ]]>
				</if>
				<if test="condition.containsKey('statusEnd') and condition.statusEnd != null">
					<![CDATA[ and a.status <= #{condition.statusEnd} ]]>
				</if>
				<if test="condition.containsKey('excuteService')">
					<if test="condition.excuteService != null and condition.excuteService != ''">
						and a.excuteService like #{condition.excuteService}
					</if>
					<if test="condition.excuteService == null">
						and a.excuteService is null
					</if>
				</if>
				<if test="condition.containsKey('excuteServiceList')">
					 and a.excuteService in 
					<foreach collection="condition.excuteServiceList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('excuteParam')">
					<if test="condition.excuteParam != null and condition.excuteParam != ''">
						and a.excuteParam like #{condition.excuteParam}
					</if>
					<if test="condition.excuteParam == null">
						and a.excuteParam is null
					</if>
				</if>
				<if test="condition.containsKey('excuteParamList')">
					 and a.excuteParam in 
					<foreach collection="condition.excuteParamList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('excuteHost')">
					<if test="condition.excuteHost != null and condition.excuteHost != ''">
						and a.excuteHost like #{condition.excuteHost}
					</if>
					<if test="condition.excuteHost == null">
						and a.excuteHost is null
					</if>
				</if>
				<if test="condition.containsKey('excuteHostList')">
					 and a.excuteHost in 
					<foreach collection="condition.excuteHostList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('excuteStrategy')">
					<if test="condition.excuteStrategy != null ">
						and a.excuteStrategy = #{condition.excuteStrategy}
					</if>
					<if test="condition.excuteStrategy == null">
						and a.excuteStrategy is null
					</if>
				</if>
				<if test="condition.containsKey('excuteStrategyList')">
					 and a.excuteStrategy in 
					<foreach collection="condition.excuteStrategyList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('excuteStrategyStart') and condition.excuteStrategyStart != null">
					<![CDATA[ and a.excuteStrategy >= #{condition.excuteStrategyStart} ]]>
				</if>
				<if test="condition.containsKey('excuteStrategyEnd') and condition.excuteStrategyEnd != null">
					<![CDATA[ and a.excuteStrategy <= #{condition.excuteStrategyEnd} ]]>
				</if>
				<if test="condition.containsKey('excuteDate')">
					<if test="condition.excuteDate != null ">
						and a.excuteDate = #{condition.excuteDate}
					</if>
					<if test="condition.excuteDate == null">
						and a.excuteDate is null
					</if>
				</if>
				<if test="condition.containsKey('excuteDateList')">
					 and a.excuteDate in 
					<foreach collection="condition.excuteDateList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('excuteDateStart') and condition.excuteDateStart != null">
					<![CDATA[ and a.excuteDate >= #{condition.excuteDateStart} ]]>
				</if>
				<if test="condition.containsKey('excuteDateEnd') and condition.excuteDateEnd != null">
					<![CDATA[ and a.excuteDate <= #{condition.excuteDateEnd} ]]>
				</if>
				<if test="condition.containsKey('excuteTime')">
					<if test="condition.excuteTime != null and condition.excuteTime != ''">
						and a.excuteTime like #{condition.excuteTime}
					</if>
					<if test="condition.excuteTime == null">
						and a.excuteTime is null
					</if>
				</if>
				<if test="condition.containsKey('excuteTimeList')">
					 and a.excuteTime in 
					<foreach collection="condition.excuteTimeList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('remark')">
					<if test="condition.remark != null and condition.remark != ''">
						and a.remark like #{condition.remark}
					</if>
					<if test="condition.remark == null">
						and a.remark is null
					</if>
				</if>
				<if test="condition.containsKey('remarkList')">
					 and a.remark in 
					<foreach collection="condition.remarkList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('lastExcuteHost')">
					<if test="condition.lastExcuteHost != null and condition.lastExcuteHost != ''">
						and a.lastExcuteHost like #{condition.lastExcuteHost}
					</if>
					<if test="condition.lastExcuteHost == null">
						and a.lastExcuteHost is null
					</if>
				</if>
				<if test="condition.containsKey('lastExcuteHostList')">
					 and a.lastExcuteHost in 
					<foreach collection="condition.lastExcuteHostList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('lastExcuteTime')">
					<if test="condition.lastExcuteTime != null ">
						and a.lastExcuteTime = #{condition.lastExcuteTime}
					</if>
					<if test="condition.lastExcuteTime == null">
						and a.lastExcuteTime is null
					</if>
				</if>
				<if test="condition.containsKey('lastExcuteTimeStart') and condition.lastExcuteTimeStart != null and condition.lastExcuteTimeStart!=''">
					<![CDATA[ and a.lastExcuteTime >= STR_TO_DATE(left(concat(#{condition.lastExcuteTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('lastExcuteTimeEnd') and condition.lastExcuteTimeEnd != null and condition.lastExcuteTimeEnd!=''">
					<![CDATA[ and a.lastExcuteTime <= STR_TO_DATE(left(concat(#{condition.lastExcuteTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('interimExcuteStatus')">
					<if test="condition.interimExcuteStatus != null ">
						and a.interimExcuteStatus = #{condition.interimExcuteStatus}
					</if>
					<if test="condition.interimExcuteStatus == null">
						and a.interimExcuteStatus is null
					</if>
				</if>
				<if test="condition.containsKey('interimExcuteStatusList')">
					 and a.interimExcuteStatus in 
					<foreach collection="condition.interimExcuteStatusList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('interimExcuteStatusStart') and condition.interimExcuteStatusStart != null">
					<![CDATA[ and a.interimExcuteStatus >= #{condition.interimExcuteStatusStart} ]]>
				</if>
				<if test="condition.containsKey('interimExcuteStatusEnd') and condition.interimExcuteStatusEnd != null">
					<![CDATA[ and a.interimExcuteStatus <= #{condition.interimExcuteStatusEnd} ]]>
				</if>
				<if test="condition.containsKey('createTime')">
					<if test="condition.createTime != null ">
						and a.createTime = #{condition.createTime}
					</if>
					<if test="condition.createTime == null">
						and a.createTime is null
					</if>
				</if>
				<if test="condition.containsKey('createTimeStart') and condition.createTimeStart != null and condition.createTimeStart!=''">
					<![CDATA[ and a.createTime >= STR_TO_DATE(left(concat(#{condition.createTimeStart},' 00:00:00'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('createTimeEnd') and condition.createTimeEnd != null and condition.createTimeEnd!=''">
					<![CDATA[ and a.createTime <= STR_TO_DATE(left(concat(#{condition.createTimeEnd},' 23:59:59'),19),'%Y-%m-%d %k:%i:%s') ]]>
				</if>
				<if test="condition.containsKey('createUserId')">
					<if test="condition.createUserId != null ">
						and a.createUserId = #{condition.createUserId}
					</if>
					<if test="condition.createUserId == null">
						and a.createUserId is null
					</if>
				</if>
				<if test="condition.containsKey('createUserIdList')">
					 and a.createUserId in 
					<foreach collection="condition.createUserIdList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
				<if test="condition.containsKey('createUserIdStart') and condition.createUserIdStart != null">
					<![CDATA[ and a.createUserId >= #{condition.createUserIdStart} ]]>
				</if>
				<if test="condition.containsKey('createUserIdEnd') and condition.createUserIdEnd != null">
					<![CDATA[ and a.createUserId <= #{condition.createUserIdEnd} ]]>
				</if>
				<if test="condition.containsKey('createUserName')">
					<if test="condition.createUserName != null and condition.createUserName != ''">
						and a.createUserName like #{condition.createUserName}
					</if>
					<if test="condition.createUserName == null">
						and a.createUserName is null
					</if>
				</if>
				<if test="condition.containsKey('createUserNameList')">
					 and a.createUserName in 
					<foreach collection="condition.createUserNameList" open="(" close=")" index="index" item="item" separator=",">
						#{item}
					</foreach>
				</if>
		</if>
	</sql>
	<sql id="_orderCols_">
		<if test="orderColList != null and !orderColList.isEmpty()">
	        order by
	        <trim suffixOverrides=","  suffix="">
				<foreach collection="orderColList" open="" close="" index="index" item="item" separator=",">
						${item.colName} ${item.sortKind}
				</foreach>
			</trim>
		</if>
		<if test="(orderColList == null or orderColList.isEmpty()) and orderCol != null and !orderCol.isEmpty()">
			order by
			<trim suffixOverrides=","  suffix="">
				<if test="orderCol.containsKey('id')">
					a.id
					<if test="orderCol.id!= null">
						${orderCol.id}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('name')">
					a.name
					<if test="orderCol.name!= null">
						${orderCol.name}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('taskKey')">
					a.taskKey
					<if test="orderCol.taskKey!= null">
						${orderCol.taskKey}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('status')">
					a.status
					<if test="orderCol.status!= null">
						${orderCol.status}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('excuteService')">
					a.excuteService
					<if test="orderCol.excuteService!= null">
						${orderCol.excuteService}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('excuteParam')">
					a.excuteParam
					<if test="orderCol.excuteParam!= null">
						${orderCol.excuteParam}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('excuteHost')">
					a.excuteHost
					<if test="orderCol.excuteHost!= null">
						${orderCol.excuteHost}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('excuteStrategy')">
					a.excuteStrategy
					<if test="orderCol.excuteStrategy!= null">
						${orderCol.excuteStrategy}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('excuteDate')">
					a.excuteDate
					<if test="orderCol.excuteDate!= null">
						${orderCol.excuteDate}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('excuteTime')">
					a.excuteTime
					<if test="orderCol.excuteTime!= null">
						${orderCol.excuteTime}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('remark')">
					a.remark
					<if test="orderCol.remark!= null">
						${orderCol.remark}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('lastExcuteHost')">
					a.lastExcuteHost
					<if test="orderCol.lastExcuteHost!= null">
						${orderCol.lastExcuteHost}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('lastExcuteTime')">
					a.lastExcuteTime
					<if test="orderCol.lastExcuteTime!= null">
						${orderCol.lastExcuteTime}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('interimExcuteStatus')">
					a.interimExcuteStatus
					<if test="orderCol.interimExcuteStatus!= null">
						${orderCol.interimExcuteStatus}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('createTime')">
					a.createTime
					<if test="orderCol.createTime!= null">
						${orderCol.createTime}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('createUserId')">
					a.createUserId
					<if test="orderCol.createUserId!= null">
						${orderCol.createUserId}
					</if>
					,
				</if>
				<if test="orderCol.containsKey('createUserName')">
					a.createUserName
					<if test="orderCol.createUserName!= null">
						${orderCol.createUserName}
					</if>
					,
				</if>
			</trim>
		</if>
	</sql>
	<sql id="_group_by_">
		<if test="groupList != null and !groupList.isEmpty()">
			GROUP BY
			<trim suffixOverrides=","  suffix="">
				<foreach collection="groupList" open="" close="" index="index" item="item" separator=",">
						${item}
				</foreach>
			</trim>
		</if>
	</sql>
</mapper>