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

137 lines
5.8 KiB
Java
Raw Normal View History

2024-07-08 17:41:17 +08:00
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
2024-07-15 17:11:36 +08:00
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
2024-07-09 09:39:21 +08:00
import com.gunshi.project.xyt.entity.so.DataQueryCommonSo;
2024-07-15 17:11:36 +08:00
import com.gunshi.project.xyt.entity.so.PicQuerySo;
2024-07-09 09:39:21 +08:00
import com.gunshi.project.xyt.entity.vo.AttResBaseVo;
import com.gunshi.project.xyt.entity.vo.AttResMonitorVo;
2024-07-15 17:11:36 +08:00
import com.gunshi.project.xyt.model.*;
2024-07-08 17:41:17 +08:00
import org.apache.ibatis.annotations.Mapper;
2024-07-09 09:39:21 +08:00
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
2024-07-15 16:58:18 +08:00
import java.math.BigDecimal;
import java.util.Date;
2024-07-09 09:39:21 +08:00
import java.util.List;
2024-07-08 17:41:17 +08:00
2024-07-08 17:47:02 +08:00
/**
* :
* author: xusan
* date: 2024-07-08 15:44:07
*/
2024-07-08 17:41:17 +08:00
@Mapper
public interface AttResBaseMapper extends BaseMapper<AttResBase> {
2024-07-09 09:39:21 +08:00
@Select("""
<script>
select t.stcd,t.stnm,COALESCE(t.clgtd,t.lgtd) lgtd,COALESCE(t.clttd,t.lttd) lttd,t.source,t.sttp,t.stlc,t.adcd,t.esstym,s.res_code,s.fl_low_lim_lev,
s.tot_cap,s.ben_res_cap,s.norm_wat_lev,s.crest_elev,s.des_flood_lev,s.dead_lev,s.cal_flood_lev,sad.adnm,
m.tm,m.rz,(m.rz-s.fl_low_lim_lev) as aFsltdz,sprr.tm as drpTm,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today,
case when s.cal_flood_lev is not null and m.rz-s.cal_flood_lev &gt; 0 then 1 else 0 end as calState,
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev &gt; 0 then 1 else 0 end as desState,
case when s.fl_low_lim_lev is not null and m.rz-s.fl_low_lim_lev &gt; 0 then 1 else 0 end as flState
from public.st_stbprp_b t
left join public.att_res_base s on t.stcd = s.stcd
left join public.st_addvcd_d sad on t.adcd = sad.adcd
left join public.st_rsvr_r_real m on t.stcd = m.stcd
left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
where t.sttp = 'RR'
order by aFsltdz desc nulls last
</script>
""")
List<AttResBaseVo> queryList();
@Select("""
<script>
select t.stcd,t.tm,t.drp from public.st_pptn_r t
where t.stcd = #{obj.stcd}
and t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
order by t.tm desc
</script>
""")
List<AttResMonitorVo> drpData(@Param("obj") DataQueryCommonSo dataQueryCommonSo);
@Select("""
<script>
select t.stcd,t.tm,t.rz from public.st_rsvr_r t
where t.stcd = #{obj.stcd}
and t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
and TRIM(TO_CHAR(t.tm, 'MI:SS')) = '00:00'
order by t.tm desc
</script>
""")
List<AttResMonitorVo> rzData(@Param("obj") DataQueryCommonSo dataQueryCommonSo);
@Select("""
<script>
select t.stcd,t.tm,t.img_path from public.st_img_r_real t
where t.stcd in (select stcd from public.st_stbprp_b where res_code = #{resCode}
and sttp = 'TX')
</script>
""")
List<StImgRReal> realImg(@Param("resCode") String resCode);
2024-07-08 17:41:17 +08:00
2024-07-09 09:39:21 +08:00
@Select("""
<script>
select t.stcd,t.tm,t.rz from public.st_rsvr_r t
where t.stcd = #{stcd}
and t.tm <![CDATA[>=]]> to_timestamp(#{stm},'YYYY-MM-DD HH24:MI:SS')
and t.tm <![CDATA[<=]]> to_timestamp(#{etm},'YYYY-MM-DD HH24:MI:SS')
order by t.tm desc
</script>
""")
List<StRsvrR> queryRzList(@Param("stcd") String stcd, @Param("stm") String startTime, @Param("etm") String endTime);
2024-07-15 16:58:18 +08:00
@Select("""
<script>
select t.tm,t.rz from public.st_rsvr_r_real t
where t.stcd = #{stcd}
order by t.TM desc limit 1
</script>
""")
AttResMonitorVo latestRz(@Param("stcd") String stcd);
@Select("""
<script>
select t.rz from public.st_rsvr_r t
where t.stcd = #{stcd} and t.tm = #{dateTime}
</script>
""")
BigDecimal oldRz(@Param("stcd") String stcd,@Param("dateTime") Date dateTime);
@Select("""
<script>
select
max(t.rz) from public.st_rsvr_r t
where t.stcd = #{stcd} and t.tm <![CDATA[>=]]> #{startTime} and t.tm <![CDATA[<=]]> #{endTime}
</script>
""")
BigDecimal queryMaxRzByStcdAndTime(@Param("stcd") String stcd, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
@Select("""
<script>
select stcd,stnm from st_stbprp_b where res_code = #{resCode}
and sttp = 'TX'
</script>
""")
List<StStbprpB> channel(@Param("resCode") String resCode);
2024-07-15 17:11:36 +08:00
@Select("""
<script>
select t.stcd,t.tm,t.img_path from public.st_img_r t
where t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
<if test="obj.stcd != null and obj.stcd !=''">
AND t.stcd = #{obj.stcd}
</if>
<if test="obj.stcd == null or obj.stcd == ''">
and t.stcd in (select stcd from st_stbprp_b where res_code = #{obj.resCode}
and sttp = 'TX')
</if>
order by t.tm desc
</script>
""")
Page<StImgR> imageInfo(@Param("page") Page<StImgR> page ,@Param("obj") PicQuerySo picQuerySo);
2024-07-08 17:41:17 +08:00
}