309 lines
14 KiB
Java
309 lines
14 KiB
Java
package com.gunshi.project.hsz.mapper;
|
|
|
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.gunshi.project.hsz.common.model.StRsvrR;
|
|
import com.gunshi.project.hsz.common.model.StStbprpB;
|
|
import com.gunshi.project.hsz.entity.so.DataQueryCommonSo;
|
|
import com.gunshi.project.hsz.entity.so.PicQuerySo;
|
|
import com.gunshi.project.hsz.entity.vo.*;
|
|
import com.gunshi.project.hsz.model.*;
|
|
import org.apache.ibatis.annotations.Mapper;
|
|
import org.apache.ibatis.annotations.Param;
|
|
import org.apache.ibatis.annotations.Select;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* 描述: 水库基本信息表
|
|
* author: xusan
|
|
* date: 2024-07-08 15:44:07
|
|
*/
|
|
@Mapper
|
|
public interface AttResBaseMapper extends BaseMapper<AttResBase> {
|
|
@Select("""
|
|
<script>
|
|
select t.stcd,t.stnm,t.lgtd lgtd,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,s.wat_shed_area,s.dead_cap,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 >= 0 then 1 else 0 end as calState,
|
|
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev >= 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 >= 0 then 1 else 0 end as flState
|
|
from public.st_stbprp_b t
|
|
left join public.att_res_base s on 1=1
|
|
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
|
|
join public.st_stbprp_b_elem stbe on t.stcd = stbe.stcd
|
|
where stbe.elem ='rz' and s.res_code = '42118130001' and t.stcd='232'
|
|
order by aFsltdz desc nulls last
|
|
</script>
|
|
""")
|
|
List<AttResBaseVo> queryList();
|
|
|
|
@Select("""
|
|
<script>
|
|
select t.stcd,t.stnm,t.lgtd lgtd,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,s.wat_shed_area,s.dead_cap,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 > 0 then 1 else 0 end as calState,
|
|
case when s.des_flood_lev is not null and m.rz-s.des_flood_lev > 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 > 0 then 1 else 0 end as flState
|
|
from public.st_stbprp_b t
|
|
left join public.att_res_base s on 1=1
|
|
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
|
|
join public.st_stbprp_b_elem stbe on t.stcd = stbe.stcd
|
|
where stbe.elem = 'rz'
|
|
order by _order asc nulls last
|
|
</script>
|
|
""")
|
|
List<AttResBaseVo> queryListV2();
|
|
|
|
@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}
|
|
<if test="obj.stm != null ">
|
|
and t.tm <![CDATA[>=]]> to_timestamp(#{obj.stm},'YYYY-MM-DD HH24:MI:SS')
|
|
</if>
|
|
<if test="obj.etm != null ">
|
|
and t.tm <![CDATA[<=]]> to_timestamp(#{obj.etm},'YYYY-MM-DD HH24:MI:SS')
|
|
</if>
|
|
and TRIM(TO_CHAR(t.tm, 'MI:SS')) = '05: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);
|
|
|
|
@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);
|
|
|
|
@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
|
|
<if test="type == 1 ">
|
|
t.z from public.st_river_r t
|
|
</if>
|
|
<if test="type == 2">
|
|
t.rz from public.st_rsvr_r t
|
|
</if>
|
|
where t.stcd = #{stcd} and t.tm = #{dateTime}
|
|
</script>
|
|
""")
|
|
BigDecimal oldRz(@Param("stcd") String stcd,@Param("type") Integer type, @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
|
|
max(t.z) from public.st_river_r t
|
|
where t.stcd = #{stcd} and t.tm <![CDATA[>=]]> #{startTime} and t.tm <![CDATA[<=]]> #{endTime}
|
|
</script>
|
|
""")
|
|
BigDecimal queryRiverMaxRz(@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);
|
|
|
|
@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);
|
|
|
|
@Select("""
|
|
<script>
|
|
select t.stcd,t.stnm,t.lgtd as lgtd,
|
|
t.lttd as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z,s.q,sad.adnm,
|
|
srb.warn_water_level as warnWaterLevel,srb.promise_water_level as promiseWaterLevel,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today
|
|
from public.st_stbprp_b t
|
|
left join public.st_river_r_real s on t.stcd = s.stcd
|
|
left join public.st_addvcd_d sad on t.adcd = sad.adcd
|
|
left join public.alarm_set srb on t.stcd = srb.stcd
|
|
left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
|
|
where t.sttp = 'ZZ'
|
|
</script>
|
|
""")
|
|
List<AttRvBaseVo> queryWaterList();
|
|
|
|
@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<AttRvMonitorVo> drp(@Param("obj") DataQueryCommonSo dataQueryCommonSo);
|
|
|
|
@Select("""
|
|
<script>
|
|
select t.stcd,t.tm,t.z,t.q from public.st_river_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<AttRvMonitorVo> rz(@Param("obj") DataQueryCommonSo dataQueryCommonSo);
|
|
|
|
@Select("""
|
|
<script>
|
|
select t.tm,t.z from public.st_river_r_real t
|
|
where t.stcd = #{stcd}
|
|
order by t.TM desc limit 1
|
|
</script>
|
|
""")
|
|
AttRvMonitorVo newRz(@Param("stcd") String stcd);
|
|
|
|
@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>
|
|
""")
|
|
Page<AttResMonitorVo> rzDataPage(Page<AttResMonitorVo> page,@Param("obj") PicQuerySo picQuerySo);
|
|
|
|
@Select("""
|
|
select * from public.dam_brief_r dbr
|
|
where 1=1
|
|
and date=#{todayStr}
|
|
order by date desc
|
|
limit 1;
|
|
""")
|
|
ResBriefVo getBrief(String todayStr);
|
|
|
|
@Select("""
|
|
select * from public.dam_brief_r dbr
|
|
where 1=1
|
|
and date between #{startDate} and #{endDate}
|
|
order by date desc
|
|
""")
|
|
List<ResBriefVo> getBriefList(String startDate, String endDate);
|
|
|
|
|
|
// @Select("""
|
|
// select t.stcd,t.stnm,t.lgtd as lgtd,
|
|
// t.lttd as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z,s.q,sad.adnm,
|
|
// srb.wrz,srb.grz,srb.invrz,srb.invrztm,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today
|
|
// from public.st_stbprp_b t
|
|
// left join public.st_river_r_real s on t.stcd = s.stcd
|
|
// left join public.st_addvcd_d sad on t.adcd = sad.adcd
|
|
// left join public.st_rvfcch_b srb on t.stcd = srb.stcd
|
|
// left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
|
|
// where t.sttp = 'ZZ' and t.stcd = #{stcd}
|
|
//""")
|
|
// List<AttRvBaseVo> queryWaterListByStcd(@Param("stcd") String stcd);
|
|
|
|
@Select("""
|
|
select t.stcd,t.stnm,t.lgtd as lgtd,
|
|
t.lttd as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z as z,s.q,sad.adnm,
|
|
srb.warn_water_level as wrz,srb.promise_water_level as grz,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,sprr.today
|
|
from public.st_stbprp_b t
|
|
left join public.st_river_r_real s on t.stcd = s.stcd
|
|
left join public.st_addvcd_d sad on t.adcd = sad.adcd
|
|
left join public.alarm_set srb on t.stcd = srb.stcd
|
|
left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
|
|
where t.stcd = #{stcd}
|
|
""")
|
|
List<AttRvBaseVo> queryWaterListByStcd(@Param("stcd") String stcd);
|
|
|
|
|
|
@Select("""
|
|
select t.stcd,t.stnm,t.lgtd as lgtd,
|
|
t.lttd as lttd,t.sttp,t.adcd,t.rvnm,t.stlc,t.source,t.esstym,s.tm,s.z as z,s.q,sad.adnm,
|
|
srb.warn_water_level as wrz,srb.promise_water_level as grz,sprr.h1,sprr.h3,sprr.h6,sprr.h12,sprr.h24,
|
|
sprr.today,arb.dead_lev as deadLev
|
|
from public.st_stbprp_b t
|
|
left join public.st_river_r_real s on t.stcd = s.stcd
|
|
left join public.st_addvcd_d sad on t.adcd = sad.adcd
|
|
left join public.alarm_set srb on t.stcd = srb.stcd
|
|
left join public.st_pptn_r_real sprr on t.stcd = sprr.stcd
|
|
left join public.att_res_base arb on 1=1
|
|
left join public.st_stbprp_b_elem stbe on t.stcd = stbe.stcd
|
|
where stbe.elem = 'z'
|
|
""")
|
|
//TODO 站点需要更改
|
|
List<AttRvBaseVo> queryWaterListUpAndLow();
|
|
|
|
@Select("""
|
|
select t1.stcd from st_stbprp_b t1
|
|
join st_stbprp_b_elem t2
|
|
on t1.stcd = t2.stcd
|
|
where t2.elem = 'z'
|
|
""")
|
|
List<String> getRiverStcd();
|
|
|
|
} |