重复数据优化
This commit is contained in:
@@ -840,10 +840,19 @@
|
||||
</select>
|
||||
|
||||
<select id="getNewDeviceFlowStatistics" resultType="LineFlowMealDetailVO">
|
||||
select t.*,
|
||||
(t.statisValue)/t.flowMeal flowProportion
|
||||
SELECT
|
||||
ANY_VALUE(t.ID) id,
|
||||
ANY_VALUE(t.name) name,
|
||||
ANY_VALUE(t.substation) substation,
|
||||
ANY_VALUE(t.updateTime) updateTime,
|
||||
ANY_VALUE(t.runFlag) runFlag,
|
||||
ANY_VALUE(t.comFlag) comFlag,
|
||||
ANY_VALUE(t.flowMeal) flowMeal,
|
||||
SUM(t.statisValue) statisValue,
|
||||
ROUND(SUM(t.statisValue)/flowMeal,2) flowProportion
|
||||
from (
|
||||
SELECT
|
||||
device.id id,
|
||||
device.Name name,
|
||||
sub.Name substation,
|
||||
device.Update_Time updateTime,
|
||||
@@ -866,7 +875,9 @@
|
||||
m.Time_Id between #{startTime} and #{endTime}
|
||||
and
|
||||
b.Run_Flag != 2
|
||||
) t ORDER BY flowProportion DESC
|
||||
) t
|
||||
GROUP BY t.id
|
||||
ORDER BY flowProportion DESC
|
||||
</select>
|
||||
|
||||
<select id="getFlowLineInfoByTableList" resultType="LineFlowMealDetailVO">
|
||||
|
||||
@@ -379,10 +379,9 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
@Override
|
||||
public Page<LineFlowMealDetailVO> getNewDeviceRunStatistics(PqsParam deviceInfoParam) {
|
||||
List<String> deviceIndexes = new ArrayList<>();
|
||||
Page<LineFlowMealDetailVO> page = new Page();
|
||||
List<GeneralDeviceDTO> deviceInfoList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||
deviceInfoList.stream().map(GeneralDeviceDTO::getDeviceIndexes).forEach(deviceIndexes::addAll);
|
||||
page = lineMapper.getNewDeviceFlowStatistics(
|
||||
Page<LineFlowMealDetailVO> page = lineMapper.getNewDeviceFlowStatistics(
|
||||
new Page(deviceInfoParam.getPageNum(), deviceInfoParam.getPageSize()),
|
||||
deviceIndexes,
|
||||
DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())),
|
||||
@@ -392,12 +391,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
||||
|
||||
@Override
|
||||
public Page<TopMsgPO> dailyDeviceAbnormalStatistics(PqsParam param) {
|
||||
long start = System.currentTimeMillis();
|
||||
Page topMsg = topMsgMapper.getTopMsg(new Page(param.getPageNum(), param.getPageSize()), param.getLineGrade(), DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),
|
||||
DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())));
|
||||
long end = System.currentTimeMillis();
|
||||
System.out.println("====================================");
|
||||
System.out.println(end-start);
|
||||
return topMsg;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user