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