<?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.huatek.busi.mapper.BusiOfflineArresterCheckMapper">
  <resultMap id="BaseResultMap" type="com.huatek.busi.entity.BusiOfflineArresterCheck">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="test_equipment" jdbcType="VARCHAR" property="testEquipment" />
    <result column="insulation_resistanceA1" jdbcType="VARCHAR" property="insulationResistancea1" />
    <result column="insulation_resistanceA2" jdbcType="VARCHAR" property="insulationResistancea2" />
    <result column="insulation_resistanceA3" jdbcType="VARCHAR" property="insulationResistancea3" />
    <result column="insulation_resistanceA4" jdbcType="VARCHAR" property="insulationResistancea4" />
    <result column="insulation_resistanceB1" jdbcType="VARCHAR" property="insulationResistanceb1" />
    <result column="insulation_resistanceB2" jdbcType="VARCHAR" property="insulationResistanceb2" />
    <result column="insulation_resistanceB3" jdbcType="VARCHAR" property="insulationResistanceb3" />
    <result column="insulation_resistanceB4" jdbcType="VARCHAR" property="insulationResistanceb4" />
    <result column="insulation_resistanceC1" jdbcType="VARCHAR" property="insulationResistancec1" />
    <result column="insulation_resistanceC2" jdbcType="VARCHAR" property="insulationResistancec2" />
    <result column="insulation_resistanceC3" jdbcType="VARCHAR" property="insulationResistancec3" />
    <result column="insulation_resistanceC4" jdbcType="VARCHAR" property="insulationResistancec4" />
    <result column="eqm_code" jdbcType="VARCHAR" property="eqmCode" />
    <result column="experi_date" jdbcType="TIMESTAMP" property="experiDate" />
  </resultMap>
  <resultMap id="BaseResultVOMap" type="com.huatek.busi.vo.BusiOfflineArresterCheckVo">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="test_equipment" jdbcType="VARCHAR" property="testEquipment" />
    <result column="insulation_resistanceA1" jdbcType="VARCHAR" property="insulationResistancea1" />
    <result column="insulation_resistanceA2" jdbcType="VARCHAR" property="insulationResistancea2" />
    <result column="insulation_resistanceA3" jdbcType="VARCHAR" property="insulationResistancea3" />
    <result column="insulation_resistanceA4" jdbcType="VARCHAR" property="insulationResistancea4" />
    <result column="insulation_resistanceB1" jdbcType="VARCHAR" property="insulationResistanceb1" />
    <result column="insulation_resistanceB2" jdbcType="VARCHAR" property="insulationResistanceb2" />
    <result column="insulation_resistanceB3" jdbcType="VARCHAR" property="insulationResistanceb3" />
    <result column="insulation_resistanceB4" jdbcType="VARCHAR" property="insulationResistanceb4" />
    <result column="insulation_resistanceC1" jdbcType="VARCHAR" property="insulationResistancec1" />
    <result column="insulation_resistanceC2" jdbcType="VARCHAR" property="insulationResistancec2" />
    <result column="insulation_resistanceC3" jdbcType="VARCHAR" property="insulationResistancec3" />
    <result column="insulation_resistanceC4" jdbcType="VARCHAR" property="insulationResistancec4" />
    <result column="eqm_code" jdbcType="VARCHAR" property="eqmCode" />
    <result column="experi_date" jdbcType="TIMESTAMP" property="experiDate" />
  </resultMap>
  <sql id="Base_Column_List">
    id, test_equipment, insulation_resistanceA1, insulation_resistanceA2, insulation_resistanceA3, 
    insulation_resistanceA4, insulation_resistanceB1, insulation_resistanceB2, insulation_resistanceB3, 
    insulation_resistanceB4, insulation_resistanceC1, insulation_resistanceC2, insulation_resistanceC3, 
    insulation_resistanceC4, eqm_code, experi_date
  </sql>
  <select id="selectByeqmCode" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from busi_offline_arrester_check
    where eqm_code = #{eqmCode,jdbcType=VARCHAR} ORDER BY experi_date DESC limit 1
  </select>
  <select id="selectBusiOfflineGisCheckPage" parameterType="com.huatek.busi.dto.BusiOfflineArresterCheckDto" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from busi_offline_arrester_check t
    where 1=1
    <if test="experiDate != null">
     AND t.experi_date <![CDATA[ >= ]]>  #{experiDate}
     AND t.experi_date <![CDATA[ <= ]]>  #{experiDateAfter}
    </if>
    ORDER BY experi_date DESC
  </select>
  <insert id="insertBusiOfflineArresterCheck" parameterType="com.huatek.busi.entity.BusiOfflineArresterCheck">
    insert into busi_offline_arrester_check
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="testEquipment != null">
        test_equipment,
      </if>
      <if test="insulationResistancea1 != null">
        insulation_resistanceA1,
      </if>
      <if test="insulationResistancea2 != null">
        insulation_resistanceA2,
      </if>
      <if test="insulationResistancea3 != null">
        insulation_resistanceA3,
      </if>
      <if test="insulationResistancea4 != null">
        insulation_resistanceA4,
      </if>
      <if test="insulationResistanceb1 != null">
        insulation_resistanceB1,
      </if>
      <if test="insulationResistanceb2 != null">
        insulation_resistanceB2,
      </if>
      <if test="insulationResistanceb3 != null">
        insulation_resistanceB3,
      </if>
      <if test="insulationResistanceb4 != null">
        insulation_resistanceB4,
      </if>
      <if test="insulationResistancec1 != null">
        insulation_resistanceC1,
      </if>
      <if test="insulationResistancec2 != null">
        insulation_resistanceC2,
      </if>
      <if test="insulationResistancec3 != null">
        insulation_resistanceC3,
      </if>
      <if test="insulationResistancec4 != null">
        insulation_resistanceC4,
      </if>
      <if test="eqmCode != null">
        eqm_code,
      </if>
      <if test="experiDate != null">
        experi_date,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="testEquipment != null">
        #{testEquipment,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancea1 != null">
        #{insulationResistancea1,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancea2 != null">
        #{insulationResistancea2,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancea3 != null">
        #{insulationResistancea3,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancea4 != null">
        #{insulationResistancea4,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistanceb1 != null">
        #{insulationResistanceb1,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistanceb2 != null">
        #{insulationResistanceb2,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistanceb3 != null">
        #{insulationResistanceb3,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistanceb4 != null">
        #{insulationResistanceb4,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancec1 != null">
        #{insulationResistancec1,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancec2 != null">
        #{insulationResistancec2,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancec3 != null">
        #{insulationResistancec3,jdbcType=VARCHAR},
      </if>
      <if test="insulationResistancec4 != null">
        #{insulationResistancec4,jdbcType=VARCHAR},
      </if>
      <if test="eqmCode != null">
        #{eqmCode,jdbcType=VARCHAR},
      </if>
      <if test="experiDate != null">
        #{experiDate,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
</mapper>