You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
3.4 KiB

<?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.ruoyi.swlscx.excerpt.mapper.HyHltdzBMapper">
<resultMap id="BaseResultMap" type="com.ruoyi.swlscx.excerpt.domain.po.HyHltdzB">
<id property="stcd" column="stcd" jdbcType="VARCHAR"/>
<id property="tm" column="tm" jdbcType="TIMESTAMP"/>
<result property="tdtp" column="tdtp" jdbcType="VARCHAR"/>
<result property="tdz" column="tdz" jdbcType="DECIMAL"/>
<result property="tdzrcd" column="tdzrcd" jdbcType="VARCHAR"/>
<result property="tdrng" column="tdrng" jdbcType="DECIMAL"/>
<result property="dr" column="dr" jdbcType="VARCHAR"/>
<result property="nt" column="nt" jdbcType="VARCHAR"/>
</resultMap>
<update id="deleteAll">
TRUNCATE TABLE hy_hltdz_b_temp;
</update>
<insert id="batchInsert" parameterType="java.util.List">
INSERT INTO hy_hltdz_b_temp (stcd, tm, tdtp, tdz,tdzrcd,tdrng,dr,nt)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.stcd}, #{item.tm,jdbcType=TIMESTAMP}, #{item.tdtp}, #{item.tdz},#{item.tdzrcd},#{item.tdrng},#{item.dr},#{item.nt})
</foreach>
</insert>
<insert id="batchInsertOrUpdate">
insert into hy_hltdz_b (stcd, tm, tdtp, tdz, tdzrcd, tdrng, dr, nt)
select a.stcd,
a.tm,
a.tdtp,
a.tdz,
a.tdzrcd,
a.tdrng,
a.dr,
a.nt
from hy_hltdz_b_temp a
on duplicate key
update tdtp = a.tdtp,
tdz = a.tdz,
tdzrcd = a.tdzrcd,
tdrng = a.tdrng,
dr = a.dr,
nt = a.nt
</insert>
<select id="selectHyHltdzBPageByInfo" resultType="com.ruoyi.swlscx.excerpt.domain.vo.HyHltdzBVo">
select hme.stcd,
hme.tm,
hme.tdtp,
hme.tdz,
hme.tdzrcd,
hme.tdrng,
hme.dr,
hme.nt,
hme.stnm
from v_hy_hltdz_b hme
<where>
<trim prefixOverrides="and">
<if test="map.stnm != null and map.stnm != ''">
and hme.stnm like concat('%',#{map.stnm},'%')
</if>
<if test="map.stcd != null and map.stcd != ''">
and hme.stcd like concat('%',#{map.stcd},'%')
</if>
<if test="map.startTime != null and map.startTime != ''">
and hme.tm >= #{map.startTime}
</if>
<if test="map.endTime != null and map.endTime != ''">
and hme.tm &lt;= #{map.endTime}
</if>
</trim>
</where>
order by hme.tm
</select>
<insert id="mergeToData">
MERGE INTO hy_hltdz_b AS a
USING hy_hltdz_b_temp AS temp
ON (a.stcd = temp.stcd AND a.tm = temp.tm)
WHEN MATCHED THEN
UPDATE SET a.tdtp = temp.tdtp,a.tdz = temp.tdz, a.tdzrcd = temp.tdzrcd, a.tdrng = temp.tdrng, a.dr = temp.dr, a.nt = temp.nt
WHEN NOT MATCHED THEN
INSERT (stcd, tm, tdtp, tdz, tdzrcd, tdrng, dr, nt)
VALUES
(temp.stcd, temp.tm, temp.tdtp, temp.tdz, temp.tdzrcd, temp.tdrng, temp.dr, temp.nt);
</insert>
</mapper>