bug调整

This commit is contained in:
2024-01-18 11:03:38 +08:00
parent d09d4e7533
commit bd08389a05
2 changed files with 58 additions and 44 deletions

View File

@@ -24,33 +24,41 @@
select count(ed.event_id) "count", select count(ed.event_id) "count",
ed.measurement_point_id "id" ed.measurement_point_id "id"
from r_mp_event_detail ed from r_mp_event_detail ed
where <where>
<if test="lineIds != null and lineIds.size()>0" >
ed.measurement_point_id in ed.measurement_point_id in
<foreach collection="lineIds" item="item" open="(" close=")" separator=","> <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
</where>
group by ed.measurement_point_id group by ed.measurement_point_id
</select> </select>
<select id="getTimeCount" resultType="java.util.Map"> <select id="getTimeCount" resultType="java.util.Map">
select select
date(ed.start_time) "day", count(*) "count" date(ed.start_time) "day", count(*) "count"
from r_mp_event_detail ed where ed.measurement_point_id in from r_mp_event_detail ed
<where>
<if test="lineIds != null and lineIds.size()>0" >
ed.measurement_point_id in
<foreach collection="lineIds" item="item" open="(" close=")" separator=","> <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
</where>
group by day group by day
</select> </select>
@@ -75,17 +83,20 @@
count(ed.event_id) "count" count(ed.event_id) "count"
from r_mp_event_detail ed from r_mp_event_detail ed
left join sys_dict_data sdd on ed.event_type = sdd.id and sdd.code = 'Voltage_Dip' left join sys_dict_data sdd on ed.event_type = sdd.id and sdd.code = 'Voltage_Dip'
where <where>
<if test="lineIds != null and lineIds.size()>0" >
ed.measurement_point_id in ed.measurement_point_id in
<foreach collection="lineIds" item="item" open="(" close=")" separator=","> <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
</where>
</select> </select>
<select id="getMiddleDown" resultType="com.njcn.device.pq.pojo.vo.EventVO"> <select id="getMiddleDown" resultType="com.njcn.device.pq.pojo.vo.EventVO">
@@ -98,17 +109,20 @@
ed.duration ed.duration
from r_mp_event_detail ed from r_mp_event_detail ed
left join pq_line pl on pl.id = ed.measurement_point_id left join pq_line pl on pl.id = ed.measurement_point_id
where <where>
<if test="lineIds != null and lineIds.size()>0" >
ed.measurement_point_id in ed.measurement_point_id in
<foreach collection="lineIds" item="item" open="(" close=")" separator=","> <foreach collection="lineIds" item="item" open="(" close=")" separator=",">
#{item} #{item}
</foreach> </foreach>
</if>
<if test="startTime != null and startTime != ''"> <if test="startTime != null and startTime != ''">
and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &gt;= date_format(#{startTime},'%y%m%d')
</if> </if>
<if test="endTime != null and endTime != ''"> <if test="endTime != null and endTime != ''">
and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d') and date_format(ed.start_time,'%y%m%d') &lt;= date_format(#{endTime},'%y%m%d')
</if> </if>
</where>
order by ed.start_time desc order by ed.start_time desc
</select> </select>

View File

@@ -232,7 +232,7 @@ public class LargeScreenServiceImpl implements LargeScreenService {
} }
} }
// 输出返回结果的Map集合中的每一个键值对 // 输出返回结果的Map集合中的每一个键值对
resultMap.entrySet().forEach(System.out::println); // resultMap.entrySet().forEach(System.out::println);
for (LocalDate s : resultMap.keySet()) { for (LocalDate s : resultMap.keySet()) {
DownTimeVO downTimeVO = new DownTimeVO(); DownTimeVO downTimeVO = new DownTimeVO();
downTimeVO.setTime(s.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); downTimeVO.setTime(s.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));