<?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.zm.order.tool.server.tempdb.OrderExtDao">
    <resultMap id="ResultMap" type="com.zm.order.tool.server.model.OrderExt">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="ext_key" jdbcType="VARCHAR" property="extKey"/>
        <result column="biz_table" jdbcType="VARCHAR" property="bizTable"/>
    </resultMap>

    <sql id="tb">
        order_ext
    </sql>

    <sql id="cols_all">
        id,
        ext_key,
        biz_table
    </sql>

    <insert id="insertList" parameterType="list">
        insert into
        <include refid="tb"/>
        (<include refid="cols_all"/>)
        values
        <foreach collection="list" item="each" index="index" separator=",">
            (
            #{each.id}, #{each.extKey}, #{each.bizTable}
            )
        </foreach>
    </insert>


    <select id="selectAll" parameterType="map" resultMap="ResultMap">
        select
        <include refid="cols_all"/>
        from
        <include refid="tb"/>
    </select>

    <select id="exist" parameterType="map" resultMap="ResultMap">
        select
        <include refid="cols_all"/>
        from
        <include refid="tb"/>
        where ext_key = #{extKey}
    </select>

</mapper>