<?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="cn.cecep.talroad.mapper.effective.MGovernanceTechnologyEstimateFactoryMapper">
  <resultMap id="BaseResultMap" type="cn.cecep.talroad.domain.effective.MGovernanceTechnologyEstimateFactory">
    <!--@mbg.generated-->
    <!--@Table m_governance_technology_estimate_factory-->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="factory_name" jdbcType="VARCHAR" property="factoryName" />
    <result column="industry_category" jdbcType="VARCHAR" property="industryCategory" />
    <result column="country_name" jdbcType="VARCHAR" property="countryName" />
    <result column="governance_technology" jdbcType="VARCHAR" property="governanceTechnology" />
    <result column="facilities_num" jdbcType="INTEGER" property="facilitiesNum" />
    <result column="administer_results" jdbcType="VARCHAR" property="administerResults" />
    <result column="administer_efficiency" jdbcType="VARCHAR" property="administerEfficiency" />
    <result column="administer_pollutant_num" jdbcType="VARCHAR" property="administerPollutantNum" />
    <result column="administer_pollutant_concentration" jdbcType="VARCHAR" property="administerPollutantConcentration" />
    <result column="operation_drug_num" jdbcType="VARCHAR" property="operationDrugNum" />
    <result column="operation_pollutant_drug_num" jdbcType="VARCHAR" property="operationPollutantDrugNum" />
    <result column="operation_pollutant_electricity_num" jdbcType="VARCHAR" property="operationPollutantElectricityNum" />
    <result column="management_level_time_ratio" jdbcType="VARCHAR" property="managementLevelTimeRatio" />
    <result column="management_excess_num" jdbcType="VARCHAR" property="managementExcessNum" />
    <result column="management_warning_num" jdbcType="VARCHAR" property="managementWarningNum" />
    <result column="management_concentration" jdbcType="VARCHAR" property="managementConcentration" />
    <result column="quarter" jdbcType="VARCHAR" property="quarter" />
    <result column="year" jdbcType="VARCHAR" property="year" />
    <result column="type" jdbcType="SMALLINT" property="type" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, factory_name, industry_category, country_name, governance_technology, facilities_num, 
    administer_results, administer_efficiency, administer_pollutant_num, administer_pollutant_concentration, 
    operation_drug_num, operation_pollutant_drug_num, operation_pollutant_electricity_num, 
    management_level_time_ratio, management_excess_num, management_warning_num, management_concentration, 
    quarter, "year", "type"
  </sql>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update m_governance_technology_estimate_factory
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="factory_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.factoryName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="industry_category = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.industryCategory,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="country_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.countryName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="governance_technology = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.governanceTechnology,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="facilities_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.facilitiesNum,jdbcType=INTEGER}
        </foreach>
      </trim>
      <trim prefix="administer_results = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.administerResults,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="administer_efficiency = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.administerEfficiency,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="administer_pollutant_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.administerPollutantNum,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="administer_pollutant_concentration = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.administerPollutantConcentration,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="operation_drug_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.operationDrugNum,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="operation_pollutant_drug_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.operationPollutantDrugNum,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="operation_pollutant_electricity_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.operationPollutantElectricityNum,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="management_level_time_ratio = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.managementLevelTimeRatio,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="management_excess_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.managementExcessNum,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="management_warning_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.managementWarningNum,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="management_concentration = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.managementConcentration,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="quarter = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.quarter,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="&quot;year&quot; = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.year,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="&quot;type&quot; = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.type,jdbcType=SMALLINT}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=VARCHAR}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update m_governance_technology_estimate_factory
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="factory_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.factoryName != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.factoryName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="industry_category = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.industryCategory != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.industryCategory,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="country_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.countryName != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.countryName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="governance_technology = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.governanceTechnology != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.governanceTechnology,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="facilities_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.facilitiesNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.facilitiesNum,jdbcType=INTEGER}
          </if>
        </foreach>
      </trim>
      <trim prefix="administer_results = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.administerResults != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.administerResults,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="administer_efficiency = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.administerEfficiency != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.administerEfficiency,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="administer_pollutant_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.administerPollutantNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.administerPollutantNum,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="administer_pollutant_concentration = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.administerPollutantConcentration != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.administerPollutantConcentration,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="operation_drug_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.operationDrugNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.operationDrugNum,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="operation_pollutant_drug_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.operationPollutantDrugNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.operationPollutantDrugNum,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="operation_pollutant_electricity_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.operationPollutantElectricityNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.operationPollutantElectricityNum,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="management_level_time_ratio = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.managementLevelTimeRatio != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.managementLevelTimeRatio,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="management_excess_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.managementExcessNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.managementExcessNum,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="management_warning_num = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.managementWarningNum != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.managementWarningNum,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="management_concentration = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.managementConcentration != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.managementConcentration,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="quarter = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.quarter != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.quarter,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="&quot;year&quot; = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.year != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.year,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="&quot;type&quot; = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.type != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.type,jdbcType=SMALLINT}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=VARCHAR}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into m_governance_technology_estimate_factory
    (id, factory_name, industry_category, country_name, governance_technology, facilities_num, 
      administer_results, administer_efficiency, administer_pollutant_num, administer_pollutant_concentration, 
      operation_drug_num, operation_pollutant_drug_num, operation_pollutant_electricity_num, 
      management_level_time_ratio, management_excess_num, management_warning_num, management_concentration, 
      quarter, "year", "type")
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.id,jdbcType=VARCHAR}, #{item.factoryName,jdbcType=VARCHAR}, #{item.industryCategory,jdbcType=VARCHAR}, 
        #{item.countryName,jdbcType=VARCHAR}, #{item.governanceTechnology,jdbcType=VARCHAR}, 
        #{item.facilitiesNum,jdbcType=INTEGER}, #{item.administerResults,jdbcType=VARCHAR}, 
        #{item.administerEfficiency,jdbcType=VARCHAR}, #{item.administerPollutantNum,jdbcType=VARCHAR}, 
        #{item.administerPollutantConcentration,jdbcType=VARCHAR}, #{item.operationDrugNum,jdbcType=VARCHAR}, 
        #{item.operationPollutantDrugNum,jdbcType=VARCHAR}, #{item.operationPollutantElectricityNum,jdbcType=VARCHAR}, 
        #{item.managementLevelTimeRatio,jdbcType=VARCHAR}, #{item.managementExcessNum,jdbcType=VARCHAR}, 
        #{item.managementWarningNum,jdbcType=VARCHAR}, #{item.managementConcentration,jdbcType=VARCHAR}, 
        #{item.quarter,jdbcType=VARCHAR}, #{item.year,jdbcType=VARCHAR}, #{item.type,jdbcType=SMALLINT}
        )
    </foreach>
  </insert>

  <select id="selectNameByAnalyzeLatitude" resultType="java.lang.String">
    SELECT ${field} FROM ${tableName}
    <where>
      <if test="value != null and value != ''">
       AND ${field} LIKE CONCAT ('%',#{value,jdbcType=VARCHAR},'%')
      </if>
    </where>
    GROUP BY ${field}
  </select>
</mapper>