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