<?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.BStatTableQueryInfoMapper">
  <resultMap id="BaseResultMap" type="cn.cecep.talroad.domain.BStatTableQueryInfo">
    <!--@mbg.generated-->
    <!--@Table b_stat_table_query_info-->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="query_name" jdbcType="VARCHAR" property="queryName" />
    <result column="query_info" jdbcType="VARCHAR" property="queryInfo" />
    <result column="query_user_id" jdbcType="VARCHAR" property="queryUserId" />
    <result column="table_status" jdbcType="VARCHAR" property="tableStatus" />
    <result column="query_type" jdbcType="VARCHAR" property="queryType" />
    <result column="query_content" jdbcType="VARCHAR" property="queryContent" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--@mbg.generated-->
    id, query_name, query_info, query_user_id, table_status, query_type, query_content
  </sql>
  <update id="updateBatch" parameterType="java.util.List">
    <!--@mbg.generated-->
    update b_stat_table_query_info
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="query_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.queryName,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="query_info = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.queryInfo,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="query_user_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.queryUserId,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="table_status = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.tableStatus,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="query_type = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.queryType,jdbcType=VARCHAR}
        </foreach>
      </trim>
      <trim prefix="query_content = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          when id = #{item.id,jdbcType=BIGINT} then #{item.queryContent,jdbcType=VARCHAR}
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <update id="updateBatchSelective" parameterType="java.util.List">
    <!--@mbg.generated-->
    update b_stat_table_query_info
    <trim prefix="set" suffixOverrides=",">
      <trim prefix="query_name = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.queryName != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.queryName,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="query_info = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.queryInfo != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.queryInfo,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="query_user_id = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.queryUserId != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.queryUserId,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="table_status = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.tableStatus != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.tableStatus,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="query_type = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.queryType != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.queryType,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
      <trim prefix="query_content = case" suffix="end,">
        <foreach collection="list" index="index" item="item">
          <if test="item.queryContent != null">
            when id = #{item.id,jdbcType=BIGINT} then #{item.queryContent,jdbcType=VARCHAR}
          </if>
        </foreach>
      </trim>
    </trim>
    where id in
    <foreach close=")" collection="list" item="item" open="(" separator=", ">
      #{item.id,jdbcType=BIGINT}
    </foreach>
  </update>
  <insert id="batchInsert" parameterType="map">
    <!--@mbg.generated-->
    insert into b_stat_table_query_info
    (id, query_name, query_info, query_user_id, table_status, query_type, query_content
      )
    values
    <foreach collection="list" item="item" separator=",">
      (#{item.id,jdbcType=BIGINT}, #{item.queryName,jdbcType=VARCHAR}, #{item.queryInfo,jdbcType=VARCHAR}, 
        #{item.queryUserId,jdbcType=VARCHAR}, #{item.tableStatus,jdbcType=VARCHAR}, #{item.queryType,jdbcType=VARCHAR}, 
        #{item.queryContent,jdbcType=VARCHAR})
    </foreach>
  </insert>
</mapper>