<?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.tcm0316.mapper.TCm0316Mapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.tcm0316.model.TCm0316">
    <!-- <id column="TIMEGRANID" jdbcType="VARCHAR" property="timegranid" />
        <id column="ITEMID" jdbcType="VARCHAR" property="itemid" /> -->
    <result column="RECORDID" jdbcType="VARCHAR" property="recordid" />
    <result column="POWERMONITORCODE" jdbcType="VARCHAR" property="powermonitorcode" />
    <result column="POWERMONITORNAME" jdbcType="VARCHAR" property="powermonitorname" />
    <result column="CREATYEAR" jdbcType="VARCHAR" property="creatyear" />
    <result column="POWERSYSTEMNAME" jdbcType="VARCHAR" property="powersystemname" />
  </resultMap>

  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select RECORDID, POWERMONITORCODE, POWERMONITORNAME, CREATYEAR, POWERSYSTEMNAME
      from T_CM_0316
    <where>
      <if test="powermonitorcode != null and powermonitorcode != ''">
          and POWERMONITORCODE like '%${powermonitorcode}%'
        </if>
      <if test="powermonitorname != null and powermonitorname != ''">
          and POWERMONITORNAME like '%${powermonitorname}%'
        </if>
      <if test="creatyear != null and creatyear != ''">
          and CREATYEAR like '%${creatyear}%'
        </if>
      <if test="powersystemname != null and powersystemname != ''">
          and POWERSYSTEMNAME = #{powersystemname}
        </if>
    </where>
  </select>

  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select RECORDID, POWERMONITORCODE, POWERMONITORNAME, CREATYEAR, POWERSYSTEMNAME
    from T_CM_0316
    where POWERMONITORCODE = #{powermonitorcode,jdbcType=VARCHAR}
  </select>

  <insert id="insert" parameterType="com.steerinfo.ems.tcm0316.model.TCm0316">
    insert into T_CM_0316
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="recordid != null">
        RECORDID,
      </if>
      <if test="powermonitorcode != null">
        POWERMONITORCODE,
      </if>
      <if test="powermonitorname != null">
        POWERMONITORNAME,
      </if>
      <if test="creatyear != null">
        CREATYEAR,
      </if>
      <if test="powersystemname != null">
        POWERSYSTEMNAME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="recordid != null">
        #{recordid,jdbcType=VARCHAR},
      </if>
      <if test="powermonitorcode != null">
        #{powermonitorcode,jdbcType=VARCHAR},
      </if>
      <if test="powermonitorname != null">
        #{powermonitorname,jdbcType=VARCHAR},
      </if>
      <if test="creatyear != null">
        #{creatyear,jdbcType=VARCHAR},
      </if>
      <if test="powersystemname != null">
        #{powersystemname,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>

  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.tcm0316.model.TCm0316">
    update T_CM_0316
    <set>
      <!-- <if test="recordid != null">
        RECORDID = #{recordid,jdbcType=VARCHAR},
      </if> -->
      <!-- <if test="powermonitorcode != null">
        POWERMONITORCODE = #{powermonitorcode,jdbcType=VARCHAR},
      </if> -->
      <if test="powermonitorname != null">
        POWERMONITORNAME = #{powermonitorname,jdbcType=VARCHAR},
      </if>
      <if test="creatyear != null">
        CREATYEAR = #{creatyear,jdbcType=VARCHAR},
      </if>
      <if test="powersystemname != null">
        POWERSYSTEMNAME = #{powersystemname,jdbcType=VARCHAR},
      </if>
    </set>
    where POWERMONITORCODE = #{powermonitorcode,jdbcType=VARCHAR}
  </update>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from T_CM_0316
    where POWERMONITORCODE = #{powermonitorcode,jdbcType=VARCHAR}
  </delete>

  <delete id="batchDelete" parameterType="java.util.List">
    delete from T_CM_0316
    where POWERMONITORCODE in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>

  <select id="getNameAndId" resultMap="BaseResultMap">
  select POWERMONITORCODE, POWERMONITORNAME from T_CM_0316
  order by POWERMONITORNAME
  </select>

  <!--
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select RECORDID, POWERMONITORCODE, POWERMONITORNAME, CREATYEAR, POWERSYSTEMNAME
      from T_CM_0316
    <where>
      <if test="recordid != null and recordid != ''">
        and RECORDID LIKE '%${recordid}%'
      </if>
      <if test="powermonitorcode != null and powermonitorcode != ''">
        and POWERMONITORCODE = #{powermonitorcode}
      </if>
      <if test="powermonitorname != null and powermonitorname != ''">
        and POWERMONITORNAME LIKE '%${powermonitorname}%'
      </if>
      <if test="creatyear != null and creatyear != ''">
        and CREATYEAR LIKE '%${creatyear}%'
      </if>
      <if test="powersystemname != null and powersystemname != ''">
        and POWERSYSTEMNAME = #{powersystemname}
      </if>
    </where>
  </select>
-->
</mapper>