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

52 lines
1.9 KiB
Java
Raw Normal View History

2024-07-08 14:47:19 +08:00
package com.gunshi.project.xyt.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gunshi.project.xyt.model.StPptnR;
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;
@Mapper
public interface StPptnRMapper extends BaseMapper<StPptnR> {
int updateBatch(List<StPptnR> list);
int updateBatchSelective(List<StPptnR> list);
int batchInsert(@Param("list") List<StPptnR> list);
int insertOrUpdate(StPptnR record);
int insertOrUpdateSelective(StPptnR record);
@Select("""
<script>
with m1 as (
select stcd,drp from qx.st_pptn_r qxt WHERE
tm &gt; #{startTime} and tm &lt;= #{endTime} and exists(select 1 from public.st_stbprp_b stb where stb.stcd=qxt.stcd and source='QX')
union ALL
select stcd,drp from sh.st_pptn_r sht WHERE
tm &gt; #{startTime} and tm &lt;= #{endTime} and exists(select 1 from public.st_stbprp_b stb where stb.stcd=sht.stcd and source='SH')
union ALL
select stcd,drp from sk.st_pptn_r skt WHERE
tm &gt; #{startTime} and tm &lt;= #{endTime} and exists(select 1 from public.st_stbprp_b stb where stb.stcd=skt.stcd and source='SK')
union ALL
select stcd,drp from sw.st_pptn_r swt WHERE
tm &gt; #{startTime} and tm &lt;= #{endTime} and exists(select 1 from public.st_stbprp_b stb where stb.stcd=swt.stcd and source='SW'))
select SUM(m1.drp) as sumdrp FROM m1
GROUP BY m1.stcd
HAVING m1.stcd = #{stcd}
</script>
""")
BigDecimal queryStPptnTimeQuantumByStcdAndTime(@Param("stcd") String stcd, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
}