wuww
2025-05-14 d6a4e2730aeff24b8e28eee486926b945bf671d6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?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.se.nsl.mapper.RegionMapper">
    <insert id="inserts" parameterType="com.se.nsl.domain.po.Region">
        insert into nsl.tbl_yj_tr_region (name, type, geom) values
        <foreach collection="list" item="item" index="index" separator=",">
        (
            #{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.tbl_yj_tr_region
            set name = #{item.name},
                type = #{item.type},
                <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>
</mapper>