gunshi-project-ss/src/main/resources/mapper/StWaterRRealMapper.xml

27 lines
936 B
XML
Raw Normal View History

2024-07-08 17:47:02 +08:00
<?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">
2025-07-17 15:26:39 +08:00
<mapper namespace="com.gunshi.project.hsz.mapper.StWaterRRealMapper">
2024-07-08 17:47:02 +08:00
2025-07-17 15:26:39 +08:00
<select id="listRelated" resultType="com.gunshi.project.hsz.model.StWaterRReal">
2025-09-05 16:13:08 +08:00
SELECT
stb.stcd,
stb.sttp,
stb.stnm,
t.tm,
t.q,
t.v
2024-07-24 09:02:59 +08:00
FROM public.st_stbprp_b stb
2025-09-05 16:13:08 +08:00
JOIN public.st_water_r_real t ON t.stcd = stb.stcd
JOIN (
SELECT stcd, MAX(tm) as max_tm
FROM public.st_water_r_real
GROUP BY stcd
) latest ON t.stcd = latest.stcd AND t.tm = latest.max_tm
2024-07-24 09:02:59 +08:00
<where>
<!-- stb.sttp in ('QQ', 'PQ','ZI') 站点类型 站点编码是唯一的,所以不用对类型进行 -->
and stb.stcd in ('1112','1113','1114') <!-- 站点编码 -->
2024-07-24 09:02:59 +08:00
</where>
2025-09-05 16:13:08 +08:00
2024-07-24 09:02:59 +08:00
</select>
2024-07-08 17:47:02 +08:00
</mapper>