<?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.tofly.watermeter.custom.mapper.DmaCodeMapper">

    <delete id="deleteData">
        delete
        from ${tableName}
    </delete>

    <insert id="insertAreaCode">
        insert into TF_YWPN_DMACISCBPQ_W (CBPQ_BM, CBPQ_MC, YXBZ)
        <foreach collection="dto" item="a" separator="union all">
            select
            #{a.CBPQ_BM},
            #{a.CBPQ_MC},
            #{a.YXBZ}
            from DUAL
        </foreach>
    </insert>

    <insert id="insertAreaCodeQfcb">
        insert into TF_YWPN_QFCBCBPQ_W (PQBM, PQMC, YXBZ)
        <foreach collection="dto" item="a" separator="union all">
            select
            #{a.CBPQ_BM},
            #{a.CBPQ_MC},
            #{a.YXBZ}
            from DUAL
        </foreach>
    </insert>

    <insert id="insertBookCode">
        insert into TF_YWPN_DMACISCBB_W (cbb_bm, cbb_mc, cbry_bm, cbzq, yxbz)
        <foreach collection="dto" item="a" separator="union all">
            select
            #{a.CBB_BM},
            #{a.CBB_MC},
            #{a.CBRY_BM},
            #{a.CBZQ},
            #{a.YXBZ}
            from DUAL
        </foreach>
    </insert>

    <insert id="insertVendorCode">
        insert into TF_YWPN_DMACISSBCJ_W (SBCJ_BM, SBCJ_MC, YXBZ)
        <foreach collection="dto" item="a" separator="union all">
            select
            to_number(#{a.SBCJ_BM}),
            #{a.SBCJ_MC},
            #{a.YXBZ}
            from DUAL
        </foreach>
    </insert>

    <insert id="insertTypeCode">
        insert into TF_YWPN_DMACISSBLX_W (SBLX_BM, SBLX_MC, YXBZ)
        <foreach collection="dto" item="a" separator="union all">
            select
            #{a.SBLX_BM},
            #{a.SBLX_MC},
            #{a.YXBZ}
            from DUAL
        </foreach>
    </insert>

    <insert id="insertReadBookCode">
        insert into TF_YWPN_DMACISCBB_W (CBB_BM, CBB_MC, YXBZ)
        <foreach collection="dto" item="a" separator="union all">
            select
            #{a.code},
            #{a.name},
            1
            from DUAL
        </foreach>
    </insert>

</mapper>