From f31f0991c0d2036e563b886f57de4cf45d3c72cb Mon Sep 17 00:00:00 2001 From: dcb <xgybdcb@163.com> Date: 星期二, 01 七月 2025 14:51:59 +0800 Subject: [PATCH] 实时模拟异步功能实现 --- src/main/resources/mapper/SimuMapper.xml | 89 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 86 insertions(+), 3 deletions(-) diff --git a/src/main/resources/mapper/SimuMapper.xml b/src/main/resources/mapper/SimuMapper.xml index a4029ad..d86d159 100644 --- a/src/main/resources/mapper/SimuMapper.xml +++ b/src/main/resources/mapper/SimuMapper.xml @@ -1,7 +1,90 @@ <?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.SimuMapper"> - <select id="selectMaxId" resultType="java.lang.Integer"> - select coalesce(max(id), 0) from bs.simu; - </select> + <insert id="insert" parameterType="com.se.nsl.domain.po.Simu"> + <selectKey resultType="java.lang.Long" order="AFTER" keyProperty="id"> + select currval('nsl.simu_id_seq'::regclass) as id + </selectKey> + + insert into nsl.tbl_yj_tr_simulate ( + name, service_name, type, area_type, area_name, data, status, result, create_time, create_user, bak, geom) + values ( + #{name}, + #{serviceName}, + #{type}, + #{areaType}, + #{areaName}, + #{data}, + #{status}, + #{result}, + now(), + #{createUser}, + #{bak}, + <choose> + <when test="geom != null and geom != ''"> + ST_GeomFromText('${geom}') + </when> + <otherwise> + null + </otherwise> + </choose> + ) + </insert> + + <insert id="inserts" parameterType="com.se.nsl.domain.po.Simu"> + insert into nsl.tbl_yj_tr_simulate ( + name, service_name, type, area_type, data, status, result, create_time, create_user, bak, geom) + values + <foreach collection="list" item="item" separator=","> + ( + #{item.name}, + #{item.serviceName}, + #{item.type}, + #{item.areaType}, + #{item.data}, + #{item.status}, + #{item.result}, + now(), + #{item.createUser}, + #{item.bak}, + <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.Simu"> + <foreach collection="list" item="item" separator=";"> + update nsl.tbl_yj_tr_simulate + set name=#{item.name}, + service_name=#{item.serviceName}, + type=#{item.type}, + area_type=#{item.areaType}, + data=#{item.data}, + status=#{item.status}, + result=#{item.result}, + update_time=now(), + update_user=#{item.updateUser}, + bak=#{item.bak}, + <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> + + <update id="updateResult" parameterType="com.se.nsl.domain.po.Simu"> + update nsl.tbl_yj_tr_simulate set result=#{result} where id = #{id} + </update> </mapper> \ No newline at end of file -- Gitblit v1.9.3