wuww
2025-04-16 cf0f1f174cd26eb0bba66d5684ccd3b591337e46
src/main/resources/mapper/RegionMapper.xml
@@ -4,7 +4,18 @@
    <insert id="inserts" parameterType="com.se.nsl.domain.po.Region">
        insert into nsl.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>
@@ -13,7 +24,14 @@
            update nsl.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>