| | |
| | | <!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> |