wuww
2025-05-14 d6a4e2730aeff24b8e28eee486926b945bf671d6
src/main/resources/mapper/RegionMapper.xml
@@ -2,18 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.se.nsl.mapper.RegionMapper">
    <insert id="inserts" parameterType="com.se.nsl.domain.po.Region">
        insert into nsl.region(name, type, geom) values
        insert into nsl.tbl_yj_tr_region (name, type, geom) values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.name}, #{item.type}, ${item.geom})
        (
            #{item.name},
            #{item.type},
            <choose>
                <when test="item.geom != null and item.geom != ''">
                    ST_GeomFromText('${item.geom}')
                </when>
                <otherwise>
                    null
                </otherwise>
            </choose>
        )
        </foreach>
    </insert>
    <update id="updates" parameterType="com.se.nsl.domain.po.Region">
        <foreach collection="list" item="item" separator=";">
            update nsl.region
            update nsl.tbl_yj_tr_region
            set name = #{item.name},
                type = #{item.type},
                geom = ${item.geom}
                <choose>
                    <when test="item.geom != null and item.geom != ''">
                        geom = ST_GeomFromText('${item.geom}')
                    </when>
                    <otherwise>
                        geom = null
                    </otherwise>
                </choose>
            where id = #{item.id}
        </foreach>
    </update>