Commit ae3be219 authored by lisong's avatar lisong

wl_equipment_specific_alarm_log 添加索引

parent e02ebb42
......@@ -155,9 +155,13 @@ public class EmergencyController extends AbstractBaseController {
@RequestParam(value = "systemType") String systemType)throws Exception {
ArrayList<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> maps = iEmergencyService.selectAlarmAnalysis(startDate, endDate, "0", "", systemType);
if ("week".equals(type)) {
if ("day".equals(type)) {
return iEmergencyService.selectAlarmAnalysis(startDate, endDate, "0", "", systemType);
} else if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.selectAlarmAnalysis(startDate, endDate, "1", date, systemType);
} else if ("week".equals(type)) {
List<Map<String, Object>> maps = iEmergencyService.selectAlarmAnalysis(startDate, endDate, "0", "", systemType);
String beginMonth = startDate.substring(5,7);
String endMonth = endDate.substring(5,7);
List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate));
......@@ -257,11 +261,6 @@ public class EmergencyController extends AbstractBaseController {
}
}
} else if ("day".equals(type)) {
return maps;
} else if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.selectAlarmAnalysis(startDate, endDate, "1", date, systemType);
}
return result;
......@@ -302,10 +301,14 @@ public class EmergencyController extends AbstractBaseController {
@RequestParam(value = "endDate") String endDate,
@RequestParam(value = "type") String type,
@RequestParam(value = "systemType") String systemType) {
ArrayList<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> maps = iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
if ("week".equals(type)) {
if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "1", date, systemType);
} else if ("day".equals(type)) {
return iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
} else if ("week".equals(type)) {
List<Map<String, Object>> maps = iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
String beginMonth = startDate.substring(5,7);
String endMonth = endDate.substring(5,7);
List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate));
......@@ -406,11 +409,6 @@ public class EmergencyController extends AbstractBaseController {
}
}
} else if ("day".equals(type)) {
return maps;
} else if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.waterSystemAlarmAnalysis(startDate, endDate, "1", date, systemType);
}
return result;
......@@ -424,10 +422,14 @@ public class EmergencyController extends AbstractBaseController {
@RequestParam(value = "endDate") String endDate,
@RequestParam(value = "type") String type,
@RequestParam(value = "systemType") String systemType) {
ArrayList<Map<String, Object>> result = new ArrayList<>();
List<Map<String, Object>> maps = iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
if ("week".equals(type)) {
if ("day".equals(type)) {
return iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
} else if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "1", date, systemType);
} else if ("week".equals(type)) {
List<Map<String, Object>> maps = iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "0", "", systemType);
String beginMonth = startDate.substring(5,7);
String endMonth = endDate.substring(5,7);
List<Map<String, String>> weeksMapInterval = DateUtils.getWeeksMapInterval(DateUtils.dateToStringMonth(startDate));
......@@ -541,11 +543,6 @@ public class EmergencyController extends AbstractBaseController {
}
} else if ("day".equals(type)) {
return maps;
} else if ("month".equals(type)) {
String date = startDate.substring(0, 4) + "-01" + "-01";
return iEmergencyService.fireCannonSystemAlarmAnalysis(startDate, endDate, "1", date, systemType);
}
return result;
......
......@@ -3076,4 +3076,14 @@
</preConditions>
<dropTable tableName="idx_width_defect"/>
</changeSet>
<changeSet author="ls" id="20230209-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="wl_equipment_specific_alarm_log" />
</preConditions>
<comment>添加索引 index_equipment_code</comment>
<sql>
create index index_equipment_code on wl_equipment_specific_alarm_log (`equipment_code`);
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -663,7 +663,7 @@
wl_equipment_specific_alarm_log wespa
WHERE
wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_id in (SELECT we.id FROM wl_equipment we WHERE we.category_id = (SELECT wec.id FROM wl_equipment_category wec WHERE wec.code = '92010600' ) )
and wespa.equipment_code LIKE CONCAT('92010600','%')
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
......@@ -675,7 +675,7 @@
wl_equipment_specific_alarm_log wespa
WHERE
wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_id in (SELECT we.id FROM wl_equipment we WHERE we.category_id = (SELECT wec.id FROM wl_equipment_category wec WHERE wec.code = '92010800' ) )
and wespa.equipment_code LIKE CONCAT('92010800','%')
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
......@@ -687,7 +687,7 @@
wl_equipment_specific_alarm_log wespa
WHERE
wespa.create_date LIKE concat(temp.date, '%')
AND wespa.equipment_id in (SELECT we.id FROM wl_equipment we WHERE we.category_id = (SELECT wec.id FROM wl_equipment_category wec WHERE wec.code = '92010500' ) )
and wespa.equipment_code LIKE CONCAT('92010500','%')
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
......@@ -933,7 +933,7 @@
WHERE
wespa.create_date BETWEEN #{startDate}
AND #{endDate}
AND wespa.equipment_id in (SELECT we.id FROM wl_equipment we WHERE we.category_id = (SELECT wec.id FROM wl_equipment_category wec WHERE wec.code = '92010600' ) )
and wespa.equipment_code LIKE CONCAT('92010600','%')
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
......@@ -947,7 +947,7 @@
wl_equipment_specific_alarm_log wespa
WHERE wespa.create_date BETWEEN #{startDate}
AND #{endDate}
AND wespa.equipment_id in (SELECT we.id FROM wl_equipment we WHERE we.category_id = (SELECT wec.id FROM wl_equipment_category wec WHERE wec.code = '92010800' ) )
and wespa.equipment_code LIKE CONCAT('92010800','%')
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
......@@ -962,7 +962,7 @@
WHERE
wespa.create_date BETWEEN #{startDate}
AND #{endDate}
AND wespa.equipment_id in (SELECT we.id FROM wl_equipment we WHERE we.category_id = (SELECT wec.id FROM wl_equipment_category wec WHERE wec.code = '92010500' ) )
and wespa.equipment_code LIKE CONCAT('92010500','%')
<foreach collection="list" open="and (" close=")" item="code" index="index" separator="or">
wespa.system_codes like concat('%',#{code},'%')
</foreach>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment