<?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.ems.dispatchzlog.mapper.DispatchZLogMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.dispatchzlog.model.DispatchZLog">
    <id column="CLOCK" jdbcType="VARCHAR" property="clock" />
    <result column="TIM" jdbcType="VARCHAR" property="tim" />
    <result column="DTYPE" jdbcType="VARCHAR" property="dtype" />
    <result column="TURN_USER" jdbcType="VARCHAR" property="turnUser" />
    <result column="CARRY_USER" jdbcType="VARCHAR" property="carryUser" />
    <result column="LEADER" jdbcType="VARCHAR" property="leader" />
    <result column="ELOG" jdbcType="VARCHAR" property="elog" />
    <result column="PLOG" jdbcType="VARCHAR" property="plog" />
    <result column="WLOG" jdbcType="VARCHAR" property="wlog" />
  </resultMap>
  <sql id="columns">
    CLOCK, TIM, DTYPE, TURN_USER, CARRY_USER, LEADER, ELOG, PLOG, WLOG
  </sql>
  <sql id="columns_alias">
    t.CLOCK, t.TIM, t.DTYPE, t.TURN_USER, t.CARRY_USER, t.LEADER, t.ELOG, t.PLOG, t.WLOG
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM DISPATCH_Z_LOG
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM DISPATCH_Z_LOG t
  </sql>
  <sql id="where">
    <where> 
      <if test="tim != null and tim != ''">
        and TIM = #{tim}
      </if>
      <if test="dtype != null and dtype != ''">
        and DTYPE = #{dtype}
      </if>
      <if test="turnUser != null and turnUser != ''">
        and TURN_USER = #{turnUser}
      </if>
      <if test="carryUser != null and carryUser != ''">
        and CARRY_USER = #{carryUser}
      </if>
      <if test="leader != null and leader != ''">
        and LEADER = #{leader}
      </if>
      <if test="elog != null and elog != ''">
        and ELOG = #{elog}
      </if>
      <if test="plog != null and plog != ''">
        and PLOG = #{plog}
      </if>
      <if test="wlog != null and wlog != ''">
        and WLOG = #{wlog}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="tim != null and tim != ''">
        and TIM LIKE '%${tim}%'
      </if>
      <if test="dtype != null and dtype != ''">
        and DTYPE LIKE '%${dtype}%'
      </if>
      <if test="turnUser != null and turnUser != ''">
        and TURN_USER LIKE '%${turnUser}%'
      </if>
      <if test="carryUser != null and carryUser != ''">
        and CARRY_USER LIKE '%${carryUser}%'
      </if>
      <if test="leader != null and leader != ''">
        and LEADER LIKE '%${leader}%'
      </if>
      <if test="elog != null and elog != ''">
        and ELOG LIKE '%${elog}%'
      </if>
      <if test="plog != null and plog != ''">
        and PLOG LIKE '%${plog}%'
      </if>
      <if test="wlog != null and wlog != ''">
        and WLOG LIKE '%${wlog}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from DISPATCH_Z_LOG
    where CLOCK = #{clock,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from DISPATCH_Z_LOG
    where 1!=1 
      <if test="tim != null and tim != ''">
        or TIM = #{tim}
      </if>
      <if test="dtype != null and dtype != ''">
        or DTYPE = #{dtype}
      </if>
      <if test="turnUser != null and turnUser != ''">
        or TURN_USER = #{turnUser}
      </if>
      <if test="carryUser != null and carryUser != ''">
        or CARRY_USER = #{carryUser}
      </if>
      <if test="leader != null and leader != ''">
        or LEADER = #{leader}
      </if>
      <if test="elog != null and elog != ''">
        or ELOG = #{elog}
      </if>
      <if test="plog != null and plog != ''">
        or PLOG = #{plog}
      </if>
      <if test="wlog != null and wlog != ''">
        or WLOG = #{wlog}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.dispatchzlog.model.DispatchZLog">
    insert into DISPATCH_Z_LOG (CLOCK, TIM, DTYPE, 
      TURN_USER, CARRY_USER, LEADER, 
      ELOG, PLOG, WLOG)
    values (#{clock,jdbcType=VARCHAR}, #{tim,jdbcType=VARCHAR}, #{dtype,jdbcType=VARCHAR}, 
      #{turnUser,jdbcType=VARCHAR}, #{carryUser,jdbcType=VARCHAR}, #{leader,jdbcType=VARCHAR}, 
      #{elog,jdbcType=VARCHAR}, #{plog,jdbcType=VARCHAR}, #{wlog,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.dispatchzlog.model.DispatchZLog">
    insert into DISPATCH_Z_LOG
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="clock != null">
        CLOCK,
      </if>
      <if test="tim != null">
        TIM,
      </if>
      <if test="dtype != null">
        DTYPE,
      </if>
      <if test="turnUser != null">
        TURN_USER,
      </if>
      <if test="carryUser != null">
        CARRY_USER,
      </if>
      <if test="leader != null">
        LEADER,
      </if>
      <if test="elog != null">
        ELOG,
      </if>
      <if test="plog != null">
        PLOG,
      </if>
      <if test="wlog != null">
        WLOG,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="clock != null">
        #{clock,jdbcType=VARCHAR},
      </if>
      <if test="tim != null">
        #{tim,jdbcType=VARCHAR},
      </if>
      <if test="dtype != null">
        #{dtype,jdbcType=VARCHAR},
      </if>
      <if test="turnUser != null">
        #{turnUser,jdbcType=VARCHAR},
      </if>
      <if test="carryUser != null">
        #{carryUser,jdbcType=VARCHAR},
      </if>
      <if test="leader != null">
        #{leader,jdbcType=VARCHAR},
      </if>
      <if test="elog != null">
        #{elog,jdbcType=VARCHAR},
      </if>
      <if test="plog != null">
        #{plog,jdbcType=VARCHAR},
      </if>
      <if test="wlog != null">
        #{wlog,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.dispatchzlog.model.DispatchZLog">
    update DISPATCH_Z_LOG
    set TIM = #{tim,jdbcType=VARCHAR},
      DTYPE = #{dtype,jdbcType=VARCHAR},
      TURN_USER = #{turnUser,jdbcType=VARCHAR},
      CARRY_USER = #{carryUser,jdbcType=VARCHAR},
      LEADER = #{leader,jdbcType=VARCHAR},
      ELOG = #{elog,jdbcType=VARCHAR},
      PLOG = #{plog,jdbcType=VARCHAR},
      WLOG = #{wlog,jdbcType=VARCHAR}
    where CLOCK = #{clock,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.dispatchzlog.model.DispatchZLog">
    update DISPATCH_Z_LOG
    <set>
      <if test="tim != null">
        TIM = #{tim,jdbcType=VARCHAR},
      </if>
      <if test="dtype != null">
        DTYPE = #{dtype,jdbcType=VARCHAR},
      </if>
      <if test="turnUser != null">
        TURN_USER = #{turnUser,jdbcType=VARCHAR},
      </if>
      <if test="carryUser != null">
        CARRY_USER = #{carryUser,jdbcType=VARCHAR},
      </if>
      <if test="leader != null">
        LEADER = #{leader,jdbcType=VARCHAR},
      </if>
      <if test="elog != null">
        ELOG = #{elog,jdbcType=VARCHAR},
      </if>
      <if test="plog != null">
        PLOG = #{plog,jdbcType=VARCHAR},
      </if>
      <if test="wlog != null">
        WLOG = #{wlog,jdbcType=VARCHAR},
      </if>
    </set>
    where CLOCK = #{clock,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where CLOCK = #{clock,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into DISPATCH_Z_LOG 
      (CLOCK, 
      TIM, DTYPE, TURN_USER, 
      CARRY_USER, LEADER, ELOG, 
      PLOG, WLOG)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.clock,jdbcType=VARCHAR}, 
      #{item.tim,jdbcType=VARCHAR}, #{item.dtype,jdbcType=VARCHAR}, #{item.turnUser,jdbcType=VARCHAR}, 
      #{item.carryUser,jdbcType=VARCHAR}, #{item.leader,jdbcType=VARCHAR}, #{item.elog,jdbcType=VARCHAR}, 
      #{item.plog,jdbcType=VARCHAR}, #{item.wlog,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update DISPATCH_Z_LOG
     set
       CLOCK=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.clock,jdbcType=VARCHAR}
       </foreach>
       ,TIM=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.tim,jdbcType=VARCHAR}
       </foreach>
       ,DTYPE=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.dtype,jdbcType=VARCHAR}
       </foreach>
       ,TURN_USER=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.turnUser,jdbcType=VARCHAR}
       </foreach>
       ,CARRY_USER=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.carryUser,jdbcType=VARCHAR}
       </foreach>
       ,LEADER=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.leader,jdbcType=VARCHAR}
       </foreach>
       ,ELOG=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.elog,jdbcType=VARCHAR}
       </foreach>
       ,PLOG=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.plog,jdbcType=VARCHAR}
       </foreach>
       ,WLOG=
       <foreach collection="list" item="item" index="index" separator=" " open="case CLOCK" close="end">
          when #{item.clock,jdbcType=VARCHAR} then #{item.wlog,jdbcType=VARCHAR}
       </foreach>
     where CLOCK in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.clock,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from DISPATCH_Z_LOG
    where CLOCK in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>