<?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.MAiControlDelayAssessmentMapper">
  <resultMap id="BaseResultMap" type="cn.cecep.talroad.domain.effective.MAiControlDelayAssessment">
    <!--@mbg.generated-->
    <!--@Table m_ai_control_delay_ssessment-->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="factory_name" jdbcType="VARCHAR" property="factoryName" />
    <result column="average_speed" jdbcType="VARCHAR" property="averageSpeed" />
    <result column="wind_direction" jdbcType="VARCHAR" property="windDirection" />
    <result column="chimney_height" jdbcType="DOUBLE" property="chimneyHeight" />
    <result column="site_name" jdbcType="VARCHAR" property="siteName" />
    <result column="site_type" jdbcType="VARCHAR" property="siteType" />
    <result column="estimated_time" jdbcType="INTEGER" property="estimatedTime" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, factory_name, average_speed, wind_direction, chimney_height, site_name, site_type, 
    estimated_time
  </sql>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update m_ai_control_delay_ssessment
    <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="average_speed = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.averageSpeed,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="wind_direction = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.windDirection,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="chimney_height = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.chimneyHeight,jdbcType=DOUBLE}
        </foreach>
      </trim>
      <trim prefix="site_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.siteName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="site_type = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.siteType,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="estimated_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=VARCHAR} then #{item.estimatedTime,jdbcType=INTEGER}
        </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_ai_control_delay_ssessment
    <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="average_speed = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.averageSpeed != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.averageSpeed,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="wind_direction = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.windDirection != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.windDirection,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="chimney_height = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.chimneyHeight != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.chimneyHeight,jdbcType=DOUBLE}
          </if>
        </foreach>
      </trim>
      <trim prefix="site_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.siteName != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.siteName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="site_type = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.siteType != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.siteType,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="estimated_time = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.estimatedTime != null">
            when id = #{item.id,jdbcType=VARCHAR} then #{item.estimatedTime,jdbcType=INTEGER}
          </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_ai_control_delay_ssessment
    (id, factory_name, average_speed, wind_direction, chimney_height, site_name, site_type, 
      estimated_time)
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.id,jdbcType=VARCHAR}, #{item.factoryName,jdbcType=VARCHAR}, #{item.averageSpeed,jdbcType=VARCHAR}, 
        #{item.windDirection,jdbcType=VARCHAR}, #{item.chimneyHeight,jdbcType=DOUBLE}, 
        #{item.siteName,jdbcType=VARCHAR}, #{item.siteType,jdbcType=VARCHAR}, #{item.estimatedTime,jdbcType=INTEGER}
        )
    </foreach>
  </insert>
</mapper>