<?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.meterwork.meterworkstaticmonitor.mapper.MeterWorkStaticMonitorMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.meterwork.meterworkstaticmonitor.model.MeterWorkStaticMonitor">
    <id column="POINT_NO" jdbcType="VARCHAR" property="pointNo" />
    <result column="POINT_NAME" jdbcType="VARCHAR" property="pointName" />
    <result column="VALID_FLAG" jdbcType="VARCHAR" property="validFlag" />
    <result column="IS_TAKE_OVER" jdbcType="VARCHAR" property="isTakeOver" />
    <result column="COLLECTION_CODE" jdbcType="VARCHAR" property="collectionCode" />
    <result column="USER_NO" jdbcType="VARCHAR" property="userNo" />
    <result column="MONITOR_USER_NO" jdbcType="VARCHAR" property="monitorUserNo" />
  </resultMap>
  <sql id="columns">
    POINT_NO, POINT_NAME, VALID_FLAG, IS_TAKE_OVER, COLLECTION_CODE, USER_NO, MONITOR_USER_NO
  </sql>
  <sql id="columns_alias">
    t.POINT_NO, t.POINT_NAME, t.VALID_FLAG, t.IS_TAKE_OVER, t.COLLECTION_CODE, t.USER_NO, 
    t.MONITOR_USER_NO
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM METER_WORK_STATIC_MONITOR
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM METER_WORK_STATIC_MONITOR t
  </sql>
  <sql id="where">
    <where> 
      <if test="pointNo != null and pointNo != ''">
        and POINT_NO = #{pointNo}
      </if>
      <if test="pointName != null and pointName != ''">
        and POINT_NAME = #{pointName}
      </if>
      <if test="validFlag != null and validFlag != ''">
        and VALID_FLAG = #{validFlag}
      </if>
      <if test="isTakeOver != null and isTakeOver != ''">
        and IS_TAKE_OVER = #{isTakeOver}
      </if>
      <if test="collectionCode != null and collectionCode != ''">
        and COLLECTION_CODE = #{collectionCode}
      </if>
      <if test="userNo != null and userNo != ''">
        and USER_NO = #{userNo}
      </if>
      <if test="monitorUserNo != null and monitorUserNo != ''">
        and MONITOR_USER_NO = #{monitorUserNo}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="pointNo != null and pointNo != ''">
        and POINT_NO LIKE '%${pointNo}%'
      </if>
      <if test="pointName != null and pointName != ''">
        and POINT_NAME LIKE '%${pointName}%'
      </if>
      <if test="validFlag != null and validFlag != ''">
        and VALID_FLAG LIKE '%${validFlag}%'
      </if>
      <if test="isTakeOver != null and isTakeOver != ''">
        and IS_TAKE_OVER LIKE '%${isTakeOver}%'
      </if>
      <if test="collectionCode != null and collectionCode != ''">
        and COLLECTION_CODE LIKE '%${collectionCode}%'
      </if>
      <if test="userNo != null and userNo != ''">
        and USER_NO LIKE '%${userNo}%'
      </if>
      <if test="monitorUserNo != null and monitorUserNo != ''">
        and MONITOR_USER_NO LIKE '%${monitorUserNo}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from METER_WORK_STATIC_MONITOR
    where POINT_NO = #{pointNo,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from METER_WORK_STATIC_MONITOR
    where 1!=1 
      <if test="pointName != null and pointName != ''">
        or POINT_NAME = #{pointName}
      </if>
      <if test="validFlag != null and validFlag != ''">
        or VALID_FLAG = #{validFlag}
      </if>
      <if test="isTakeOver != null and isTakeOver != ''">
        or IS_TAKE_OVER = #{isTakeOver}
      </if>
      <if test="collectionCode != null and collectionCode != ''">
        or COLLECTION_CODE = #{collectionCode}
      </if>
      <if test="userNo != null and userNo != ''">
        or USER_NO = #{userNo}
      </if>
      <if test="monitorUserNo != null and monitorUserNo != ''">
        or MONITOR_USER_NO = #{monitorUserNo}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.meterwork.meterworkstaticmonitor.model.MeterWorkStaticMonitor">
    insert into METER_WORK_STATIC_MONITOR (POINT_NO, POINT_NAME, VALID_FLAG, 
      IS_TAKE_OVER, COLLECTION_CODE, USER_NO, 
      MONITOR_USER_NO)
    values (#{pointNo,jdbcType=VARCHAR}, #{pointName,jdbcType=VARCHAR}, #{validFlag,jdbcType=VARCHAR}, 
      #{isTakeOver,jdbcType=VARCHAR}, #{collectionCode,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, 
      #{monitorUserNo,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.meterwork.meterworkstaticmonitor.model.MeterWorkStaticMonitor">
    insert into METER_WORK_STATIC_MONITOR
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="pointNo != null">
        POINT_NO,
      </if>
      <if test="pointName != null">
        POINT_NAME,
      </if>
      <if test="validFlag != null">
        VALID_FLAG,
      </if>
      <if test="isTakeOver != null">
        IS_TAKE_OVER,
      </if>
      <if test="collectionCode != null">
        COLLECTION_CODE,
      </if>
      <if test="userNo != null">
        USER_NO,
      </if>
      <if test="monitorUserNo != null">
        MONITOR_USER_NO,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="pointNo != null">
        #{pointNo,jdbcType=VARCHAR},
      </if>
      <if test="pointName != null">
        #{pointName,jdbcType=VARCHAR},
      </if>
      <if test="validFlag != null">
        #{validFlag,jdbcType=VARCHAR},
      </if>
      <if test="isTakeOver != null">
        #{isTakeOver,jdbcType=VARCHAR},
      </if>
      <if test="collectionCode != null">
        #{collectionCode,jdbcType=VARCHAR},
      </if>
      <if test="userNo != null">
        #{userNo,jdbcType=VARCHAR},
      </if>
      <if test="monitorUserNo != null">
        #{monitorUserNo,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.meterwork.meterworkstaticmonitor.model.MeterWorkStaticMonitor">
    update METER_WORK_STATIC_MONITOR
    set POINT_NAME = #{pointName,jdbcType=VARCHAR},
      VALID_FLAG = #{validFlag,jdbcType=VARCHAR},
      IS_TAKE_OVER = #{isTakeOver,jdbcType=VARCHAR},
      COLLECTION_CODE = #{collectionCode,jdbcType=VARCHAR},
      USER_NO = #{userNo,jdbcType=VARCHAR},
      MONITOR_USER_NO = #{monitorUserNo,jdbcType=VARCHAR}
    where POINT_NO = #{pointNo,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.meterwork.meterworkstaticmonitor.model.MeterWorkStaticMonitor">
    update METER_WORK_STATIC_MONITOR
    <set>
      <if test="pointName != null">
        POINT_NAME = #{pointName,jdbcType=VARCHAR},
      </if>
      <if test="validFlag != null">
        VALID_FLAG = #{validFlag,jdbcType=VARCHAR},
      </if>
      <if test="isTakeOver != null">
        IS_TAKE_OVER = #{isTakeOver,jdbcType=VARCHAR},
      </if>
      <if test="collectionCode != null">
        COLLECTION_CODE = #{collectionCode,jdbcType=VARCHAR},
      </if>
      <if test="userNo != null">
        USER_NO = #{userNo,jdbcType=VARCHAR},
      </if>
      <if test="monitorUserNo != null">
        MONITOR_USER_NO = #{monitorUserNo,jdbcType=VARCHAR},
      </if>
    </set>
    where POINT_NO = #{pointNo,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where POINT_NO = #{pointNo,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 METER_WORK_STATIC_MONITOR 
      (POINT_NO, 
      POINT_NAME, VALID_FLAG, IS_TAKE_OVER, 
      COLLECTION_CODE, USER_NO, MONITOR_USER_NO
      )
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.pointNo,jdbcType=VARCHAR}, 
      #{item.pointName,jdbcType=VARCHAR}, #{item.validFlag,jdbcType=VARCHAR}, #{item.isTakeOver,jdbcType=VARCHAR}, 
      #{item.collectionCode,jdbcType=VARCHAR}, #{item.userNo,jdbcType=VARCHAR}, #{item.monitorUserNo,jdbcType=VARCHAR}
       from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update METER_WORK_STATIC_MONITOR
     set
       POINT_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.pointNo,jdbcType=VARCHAR}
       </foreach>
       ,POINT_NAME=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.pointName,jdbcType=VARCHAR}
       </foreach>
       ,VALID_FLAG=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.validFlag,jdbcType=VARCHAR}
       </foreach>
       ,IS_TAKE_OVER=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.isTakeOver,jdbcType=VARCHAR}
       </foreach>
       ,COLLECTION_CODE=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.collectionCode,jdbcType=VARCHAR}
       </foreach>
       ,USER_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.userNo,jdbcType=VARCHAR}
       </foreach>
       ,MONITOR_USER_NO=
       <foreach collection="list" item="item" index="index" separator=" " open="case POINT_NO" close="end">
          when #{item.pointNo,jdbcType=VARCHAR} then #{item.monitorUserNo,jdbcType=VARCHAR}
       </foreach>
     where POINT_NO in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.pointNo,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from METER_WORK_STATIC_MONITOR
    where POINT_NO in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>