<?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.steerinfo.task.taskconf.mapper.TaskConfMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.task.taskconf.model.TaskConf">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="CRON" jdbcType="VARCHAR" property="cron" />
    <result column="STATUS" jdbcType="DECIMAL" property="status" />
    <result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from TASK_CONF
    where ID = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from TASK_CONF
    where 1!=1 
      <if test="cron != null and cron != ''">
        and CRON = #{cron}
      </if>
      <if test="status != null">
        and STATUS = #{status}
      </if>
      <if test="description != null and description != ''">
        and DESCRIPTION = #{description}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.task.taskconf.model.TaskConf">
    insert into TASK_CONF (ID, CRON, STATUS, 
      DESCRIPTION)
    values (#{id,jdbcType=VARCHAR}, #{cron,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, 
      #{description,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.task.taskconf.model.TaskConf">
    insert into TASK_CONF
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        ID,
      </if>
      <if test="cron != null">
        CRON,
      </if>
      <if test="status != null">
        STATUS,
      </if>
      <if test="description != null">
        DESCRIPTION,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="cron != null">
        #{cron,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=DECIMAL},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.task.taskconf.model.TaskConf">
    update TASK_CONF
    set CRON = #{cron,jdbcType=VARCHAR},
      STATUS = #{status,jdbcType=DECIMAL},
      DESCRIPTION = #{description,jdbcType=VARCHAR}
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.task.taskconf.model.TaskConf">
    update TASK_CONF
    <set>
      <if test="cron != null">
        CRON = #{cron,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        STATUS = #{status,jdbcType=DECIMAL},
      </if>
      <if test="description != null">
        DESCRIPTION = #{description,jdbcType=VARCHAR},
      </if>
    </set>
    where ID = #{id,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select ID, CRON, STATUS, DESCRIPTION
    from TASK_CONF
    where ID = #{id,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select ID, CRON, STATUS, DESCRIPTION
    from TASK_CONF
    <where> 
      <if test="cron != null and cron != ''">
        and CRON = #{cron}
      </if>
      <if test="status != null">
        and STATUS = #{status}
      </if>
      <if test="description != null and description != ''">
        and DESCRIPTION = #{description}
      </if>
    </where>
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select ID, CRON, STATUS, DESCRIPTION
    from TASK_CONF
    <where> 
      <if test="cron != null and cron != ''">
        and CRON LIKE '%${cron}%'
      </if>
      <if test="status != null">
        and STATUS = #{status}
      </if>
      <if test="description != null and description != ''">
        and DESCRIPTION LIKE '%${description}%'
      </if>
    </where>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into TASK_CONF 
      (ID, 
      CRON, STATUS, DESCRIPTION
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.id,jdbcType=VARCHAR}, 
      #{item.cron,jdbcType=VARCHAR}, #{item.status,jdbcType=DECIMAL}, #{item.description,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update TASK_CONF
     set
       ID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.id,jdbcType=VARCHAR}
       </foreach>
       ,CRON=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.cron,jdbcType=VARCHAR}
       </foreach>
       ,STATUS=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.status,jdbcType=DECIMAL}
       </foreach>
       ,DESCRIPTION=
       <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id,jdbcType=VARCHAR} then #{item.description,jdbcType=VARCHAR}
       </foreach>
     where ID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.id,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from TASK_CONF
    where ID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
</mapper>