gunshi-project-ss/src/main/java/com/gunshi/project/xyt/mapper/OsmoticPressRMapper.java

197 lines
8.9 KiB
Java

package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gunshi.project.xyt.entity.so.OsmoticDetailQuerySo;
import com.gunshi.project.xyt.entity.so.OsmoticQueryPageSo;
import com.gunshi.project.xyt.entity.so.OsmoticQuerySo;
import com.gunshi.project.xyt.entity.vo.OsmoticPressDetailVo;
import com.gunshi.project.xyt.entity.vo.OsmoticPressVo;
import com.gunshi.project.xyt.entity.vo.OsmoticValueVo;
import com.gunshi.project.xyt.entity.vo.StRzVo;
import com.gunshi.project.xyt.model.OsmoticPressR;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
/**
* 描述: 渗压监测记录表
* author: xusan
* date: 2024-07-08 15:44:07
*/
@Mapper
public interface OsmoticPressRMapper extends BaseMapper<OsmoticPressR> {
@Select("""
<script>
select t.*,m.profile_name
from public.osmotic_press_r t
left join public.osmotic_press_device s on t.station_code = s.station_code
left join public.att_dam_profile m on s.profile_code = m.profile_code
<where>
<if test="obj.stationCode != null and obj.stationCode !=''">
t.station_code =#{obj.stationCode}
</if>
<if test="obj.profileCode != null and obj.profileCode !=''">
s.profile_code =#{obj.profileCode}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
</where>
order by t.tm,t.station_code desc
</script>
""")
Page<OsmoticPressR> queryPage(Page<OsmoticPressR> page,@Param("obj") OsmoticQueryPageSo osmoticQueryPageSo);
@Select("""
<script>
select to_char(t.tm,'YYYY-MM-DD') as tm,t.rz
from public.st_rsvr_r t
where to_char(t.tm, 'HH24:MI:SS') = '08:00:00' and t.stcd = '716119601'
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc
</script>
""")
List<StRzVo> queryRz(@Param("obj") OsmoticQuerySo osmoticQuerySo);
@Select("""
<script>
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD') as tm,
<if test = "obj.type == 1">
t.value from public.osmotic_press_r t
</if>
<if test = "obj.type == 2">
t.q as value from public.osmotic_flow_r t
</if>
where to_char(t.tm, 'HH24:MI:SS') = '08:00:00' and t.station_code in
<foreach collection="obj.stationCodes" item="code" separator="," open="(" close=")">
#{code}
</foreach>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc
</script>
""")
List<OsmoticValueVo> queryValue(@Param("obj") OsmoticQuerySo osmoticQuerySo);
@Select("""
<script>
select to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm,t.rz
from public.st_rsvr_r t
where t.stcd = '716119601'
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc
</script>
""")
List<StRzVo> queryLineRz(@Param("obj") OsmoticQuerySo osmoticQuerySo);
@Select("""
<script>
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm,t.value
from public.osmotic_press_r t
where t.station_code in
<foreach collection="obj.stationCodes" item="code" separator="," open="(" close=")">
#{code}
</foreach>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc
</script>
""")
List<OsmoticValueVo> queryLineValue(@Param("obj") OsmoticQuerySo osmoticQuerySo);
@Select("""
<script>
select t.station_code as stationCode,to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm
from public.osmotic_warn_r t
where t.station_code in
<foreach collection="obj.stationCodes" item="code" separator="," open="(" close=")">
#{code}
</foreach>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc
</script>
""")
List<OsmoticValueVo> queryWarn(@Param("obj") OsmoticQuerySo osmoticQuerySo);
@Select("""
<script>
select to_char(t.tm,'YYYY-MM-DD') as tm,t.drp as rz
from public.st_pptn_r_d t
where t.year = #{year} and t.stcd = '2'
order by t.tm desc
</script>
""")
List<StRzVo> queryDrp(@Param("year") Integer year);
@Select("""
<script>
SELECT st.station_code,r.value, to_char(r.tm,'YYYY-MM-DD HH24:MI:SS') as tm,m.profile_name FROM osmotic_press_device st
LEFT JOIN (SELECT station_code,MAX(tm) tm FROM osmotic_press_r GROUP BY station_code) maxr ON st.station_code = maxr.station_code
LEFT JOIN osmotic_press_r r ON maxr.station_code = r.station_code AND maxr.tm = r.tm
LEFT JOIN att_dam_profile m ON st.profile_code = m.profile_code
ORDER BY m.profile_name asc,st.station_code asc,r.tm desc
</script>
""")
List<OsmoticPressVo> listValue();
@Select("""
<script>
SELECT st.station_code,r.q as value, to_char(r.tm,'YYYY-MM-DD HH24:MI:SS') as tm FROM osmotic_flow_device st
LEFT JOIN (SELECT station_code,MAX(tm) tm FROM osmotic_flow_r GROUP BY station_code) maxr ON st.station_code = maxr.station_code
LEFT JOIN osmotic_flow_r r ON maxr.station_code = r.station_code AND maxr.tm = r.tm
ORDER BY st.station_code asc,r.tm desc
</script>
""")
List<OsmoticPressVo> flowListValue();
@Select("""
<script>
select to_char(t.tm,'YYYY-MM-DD HH24:MI:SS') as tm,
<if test = "obj.type == 1">
t.value from public.osmotic_press_r t
</if>
<if test = "obj.type == 2">
t.q as value from public.osmotic_flow_r t
</if>
where t.station_code = #{obj.stationCode}
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.start != null">
and t.tm <![CDATA[>=]]> #{obj.dateTimeRangeSo.start}
</if>
<if test="obj.dateTimeRangeSo != null and obj.dateTimeRangeSo.end != null">
and t.tm <![CDATA[<=]]> #{obj.dateTimeRangeSo.end}
</if>
order by t.tm desc
</script>
""")
List<OsmoticPressDetailVo> detailValue(@Param("obj") OsmoticDetailQuerySo so);
}