<?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.zghbjkbz.mapper.ZghbjkbzMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.zghbjkbz.model.Zghbjkbz">
    <id column="ID" jdbcType="VARCHAR" property="id" />
    <result column="LOCATION" jdbcType="VARCHAR" property="location" />
    <result column="WR_TYPE" jdbcType="VARCHAR" property="wrType" />
    <result column="DRAIN_NAME" jdbcType="VARCHAR" property="drainName" />
    <result column="SOURCE_NAME" jdbcType="VARCHAR" property="sourceName" />
    <result column="CHECK_ELE" jdbcType="VARCHAR" property="checkEle" />
    <result column="UPDATEMAN" jdbcType="VARCHAR" property="updateman" />
    <result column="UPDATETIME" jdbcType="TIMESTAMP" property="updatetime" />
    <result column="MIN_VALUE" jdbcType="DECIMAL" property="minValue" />
    <result column="MAX_VALUE" jdbcType="DECIMAL" property="maxValue" />
    <result column="MEASURE_NO" jdbcType="VARCHAR" property="measureNo" />
    <result column="MEMO" jdbcType="VARCHAR" property="memo" />
    <result column="C_NAME" jdbcType="VARCHAR" property="cName" />
  </resultMap>

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

  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select ID, LOCATION, WR_TYPE, DRAIN_NAME, SOURCE_NAME, CHECK_ELE, UPDATEMAN, UPDATETIME,MIN_VALUE,MAX_VALUE, MEASURE_NO, MEMO,C_NAME
    from ZGHBJKBZ
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    select ID, LOCATION, WR_TYPE, DRAIN_NAME, SOURCE_NAME, CHECK_ELE, UPDATEMAN, UPDATETIME,MIN_VALUE,MAX_VALUE, MEASURE_NO, MEMO,C_NAME
    from ZGHBJKBZ
    <where>
      <if test="wrType != null and wrType != ''">
        ${wrType}
      </if>
      <if test="location != null and location != ''">
        ${location}
      </if>
      <if test="drainName != null and drainName != ''">
        ${drainName}
      </if>
      <if test="checkEle != null and checkEle != ''">
        ${checkEle}
      </if>
    </where>
    order by WR_TYPE,DRAIN_NAME,SOURCE_NAME,LOCATION,CHECK_ELE
  </select>

  <insert id="insert" parameterType="com.steerinfo.ems.zghbjkbz.model.Zghbjkbz">
    insert into ZGHBJKBZ (ID, LOCATION, WR_TYPE, DRAIN_NAME, SOURCE_NAME, CHECK_ELE, UPDATEMAN, UPDATETIME,MIN_VALUE,MAX_VALUE, MEASURE_NO, MEMO,C_NAME)
    values (#{id,jdbcType=VARCHAR}, #{location,jdbcType=VARCHAR}, #{wrType,jdbcType=VARCHAR},
      #{drainName,jdbcType=VARCHAR},  #{sourceName,jdbcType=VARCHAR}, #{checkEle,jdbcType=VARCHAR},#{updateman,jdbcType=VARCHAR},SYSDATE,
      #{minValue,jdbcType=DECIMAL}, #{maxValue,jdbcType=DECIMAL}, #{measureNo,jdbcType=VARCHAR}, #{memo,jdbcType=VARCHAR}, #{cName,jdbcType=VARCHAR})
  </insert>

  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.zghbjkbz.model.Zghbjkbz">
    update ZGHBJKBZ
    <set>
      <if test="drainName != null">
        DRAIN_NAME = #{drainName,jdbcType=VARCHAR},
      </if>
      <if test="sourceName != null">
        SOURCE_NAME = #{sourceName,jdbcType=VARCHAR},
      </if>
      <if test="location != null">
        LOCATION = #{location,jdbcType=VARCHAR},
      </if>
      <if test="checkEle != null">
        CHECK_ELE = #{checkEle,jdbcType=VARCHAR},
      </if>
      <if test="minValue != null">
        MIN_VALUE = #{minValue,jdbcType=DECIMAL},
      </if>
      <if test="maxValue != null">
        MAX_VALUE = #{maxValue,jdbcType=DECIMAL},
      </if>
      <if test="cName != null">
        C_NAME = #{cName,jdbcType=VARCHAR},
      </if>
      <if test="memo != null">
        MEMO = #{memo,jdbcType=VARCHAR},
      </if>
      UPDATEMAN = #{updateman,jdbcType=VARCHAR},
      UPDATETIME = SYSDATE
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  
  <select id="getAll" parameterType="java.lang.String" resultMap="BaseResultMap">
    select ID, LOCATION, WR_TYPE, DRAIN_NAME, SOURCE_NAME, CHECK_ELE, UPDATEMAN, UPDATETIME,MIN_VALUE,MAX_VALUE, MEASURE_NO, MEMO,C_NAME
    from ZGHBJKBZ
  </select>
  
</mapper>