<?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.trmenergyconvert.mapper.TRmEnergyConvertMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.trmenergyconvert.model.TRmEnergyConvert">
    <id column="ENERGYID" jdbcType="VARCHAR" property="energyid" />
    <id column="CLOCK" jdbcType="VARCHAR" property="clock" />
    <result column="SEQ" jdbcType="DECIMAL" property="seq" />
    <result column="REMARK" jdbcType="VARCHAR" property="remark" />
    <result column="RATE" jdbcType="DECIMAL" property="rate" />
    <result column="RATE1" jdbcType="DECIMAL" property="rate1" />
  </resultMap>
  <delete id="deleteByPrimaryKey" parameterType="map">
    delete from T_RM_ENERGY_CONVERT
    where ENERGYID = #{energyid,jdbcType=VARCHAR}
      and CLOCK = #{clock,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByUPrimaryKey" parameterType="map">
    delete from T_RM_ENERGY_CONVERT
    where ENERGYID = #{energyid,jdbcType=VARCHAR}
      and CLOCK = #{clock,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from T_RM_ENERGY_CONVERT
    where 1!=1 
      <if test="clock != null and clock != ''">
        and CLOCK = #{clock}
      </if>
      <if test="seq != null">
        and SEQ = #{seq}
      </if>
      <if test="remark != null and remark != ''">
        and REMARK = #{remark}
      </if>
      <if test="rate != null">
        and RATE = #{rate}
      </if>
      <if test="rate1 != null">
        and RATE1 = #{rate1}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.trmenergyconvert.model.TRmEnergyConvert">
    insert into T_RM_ENERGY_CONVERT (ENERGYID, CLOCK, SEQ, 
      REMARK, RATE, RATE1
      )
    values (#{energyid,jdbcType=VARCHAR}, #{clock,jdbcType=VARCHAR}, #{seq,jdbcType=DECIMAL}, 
      #{remark,jdbcType=VARCHAR}, #{rate,jdbcType=DECIMAL}, #{rate1,jdbcType=DECIMAL}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.trmenergyconvert.model.TRmEnergyConvert">
    insert into T_RM_ENERGY_CONVERT
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="energyid != null">
        ENERGYID,
      </if>
      <if test="clock != null">
        CLOCK,
      </if>
      <if test="seq != null">
        SEQ,
      </if>
      <if test="remark != null">
        REMARK,
      </if>
      <if test="rate != null">
        RATE,
      </if>
      <if test="rate1 != null">
        RATE1,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="energyid != null">
        #{energyid,jdbcType=VARCHAR},
      </if>
      <if test="clock != null">
        #{clock,jdbcType=VARCHAR},
      </if>
      <if test="seq != null">
        #{seq,jdbcType=DECIMAL},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="rate != null">
        #{rate,jdbcType=DECIMAL},
      </if>
      <if test="rate1 != null">
        #{rate1,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.trmenergyconvert.model.TRmEnergyConvert">
    update T_RM_ENERGY_CONVERT
    set SEQ = #{seq,jdbcType=DECIMAL},
      REMARK = #{remark,jdbcType=VARCHAR},
      RATE = #{rate,jdbcType=DECIMAL},
      RATE1 = #{rate1,jdbcType=DECIMAL}
    where ENERGYID = #{energyid,jdbcType=VARCHAR}
      and CLOCK = #{clock,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.trmenergyconvert.model.TRmEnergyConvert">
    update T_RM_ENERGY_CONVERT
    <set>
      <if test="seq != null">
        SEQ = #{seq,jdbcType=DECIMAL},
      </if>
      <if test="remark != null">
        REMARK = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="rate != null">
        RATE = #{rate,jdbcType=DECIMAL},
      </if>
      <if test="rate1 != null">
        RATE1 = #{rate1,jdbcType=DECIMAL},
      </if>
    </set>
    where ENERGYID = #{energyid,jdbcType=VARCHAR}
      and CLOCK = #{clock,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="map" resultMap="BaseResultMap">
    select ENERGYID, CLOCK, SEQ, REMARK, RATE, RATE1
    from T_RM_ENERGY_CONVERT
    where ENERGYID = #{energyid,jdbcType=VARCHAR}
      and CLOCK = #{clock,jdbcType=VARCHAR}
  </select>
  <select id="selectByUPrimaryKey" parameterType="map" resultMap="BaseResultMap">
    select ENERGYID, CLOCK, SEQ, REMARK, RATE, RATE1
    from T_RM_ENERGY_CONVERT
    where ENERGYID = #{energyid,jdbcType=VARCHAR}
      and CLOCK = #{clock,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select ENERGYID, CLOCK, SEQ, REMARK, RATE, RATE1
    from T_RM_ENERGY_CONVERT
    <where> 
      <if test="clock != null and clock != ''">
        and CLOCK = #{clock}
      </if>
      <if test="seq != null">
        and SEQ = #{seq}
      </if>
      <if test="remark != null and remark != ''">
        and REMARK = #{remark}
      </if>
      <if test="rate != null">
        and RATE = #{rate}
      </if>
      <if test="rate1 != null">
        and RATE1 = #{rate1}
      </if>
    </where>
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select ENERGYID, CLOCK, SEQ, REMARK, RATE, RATE1
    from T_RM_ENERGY_CONVERT
    <where> 
      <if test="clock != null and clock != ''">
        and CLOCK LIKE '%${clock}%'
      </if>
      <if test="seq != null">
        and SEQ = #{seq}
      </if>
      <if test="remark != null and remark != ''">
        and REMARK LIKE '%${remark}%'
      </if>
      <if test="rate != null">
        and RATE = #{rate}
      </if>
      <if test="rate1 != null">
        and RATE1 = #{rate1}
      </if>
    </where>
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into T_RM_ENERGY_CONVERT 
      (ENERGYID, 
      CLOCK, SEQ, REMARK, 
      RATE, RATE1)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.energyid,jdbcType=VARCHAR}, 
      #{item.clock,jdbcType=VARCHAR}, #{item.seq,jdbcType=DECIMAL}, #{item.remark,jdbcType=VARCHAR}, 
      #{item.rate,jdbcType=DECIMAL}, #{item.rate1,jdbcType=DECIMAL} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update T_RM_ENERGY_CONVERT
     set
       ENERGYID=
       <foreach collection="list" item="item" index="index" separator=" " open="case ENERGYID" close="end">
          when #{item.energyid,jdbcType=VARCHAR} then #{item.energyid,jdbcType=VARCHAR}
       </foreach>
       ,CLOCK=
       <foreach collection="list" item="item" index="index" separator=" " open="case ENERGYID" close="end">
          when #{item.energyid,jdbcType=VARCHAR} then #{item.clock,jdbcType=VARCHAR}
       </foreach>
       ,SEQ=
       <foreach collection="list" item="item" index="index" separator=" " open="case ENERGYID" close="end">
          when #{item.energyid,jdbcType=VARCHAR} then #{item.seq,jdbcType=DECIMAL}
       </foreach>
       ,REMARK=
       <foreach collection="list" item="item" index="index" separator=" " open="case ENERGYID" close="end">
          when #{item.energyid,jdbcType=VARCHAR} then #{item.remark,jdbcType=VARCHAR}
       </foreach>
       ,RATE=
       <foreach collection="list" item="item" index="index" separator=" " open="case ENERGYID" close="end">
          when #{item.energyid,jdbcType=VARCHAR} then #{item.rate,jdbcType=DECIMAL}
       </foreach>
       ,RATE1=
       <foreach collection="list" item="item" index="index" separator=" " open="case ENERGYID" close="end">
          when #{item.energyid,jdbcType=VARCHAR} then #{item.rate1,jdbcType=DECIMAL}
       </foreach>
     where ENERGYID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.energyid,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from T_RM_ENERGY_CONVERT
    where ENERGYID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
</mapper>