parent
6ffce0cd5b
commit
51111726c3
@ -0,0 +1,68 @@ |
||||
package com.cjy.operationdatareport.controller; |
||||
|
||||
import com.cjy.common.groups.DefaultGroup; |
||||
import com.cjy.operationdatareport.dto.AlarmStatisticsDTO; |
||||
import com.cjy.operationdatareport.dto.EventStatisticsDTO; |
||||
import com.cjy.operationdatareport.service.OperationDataReportService; |
||||
import com.ruoyi.common.core.controller.BaseController; |
||||
import com.ruoyi.common.core.domain.AjaxResult; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
@RequestMapping("/operationDataReport") |
||||
@RestController |
||||
public class OperationDataReportController extends BaseController { |
||||
@Autowired |
||||
OperationDataReportService operationDataReportService; |
||||
|
||||
/** |
||||
* 旅游资源统计 |
||||
* |
||||
* @return |
||||
*/ |
||||
@GetMapping("/getTravelResourcesStatistics") |
||||
public AjaxResult getTravelResourcesStatistics(@RequestParam("resourceGrouping") List<String> resourceGrouping, @RequestParam("dataType") List<String> dataType) { |
||||
Map<String, Object> map = operationDataReportService.getTravelResourcesStatistics(getUserOrganCode(), resourceGrouping, dataType); |
||||
return success(map); |
||||
} |
||||
|
||||
/** |
||||
* 物联设备统计 |
||||
* |
||||
* @return |
||||
*/ |
||||
@GetMapping("/getIotDeviceStatistics") |
||||
public AjaxResult getIotDeviceStatistics(@RequestParam("deviceType") List<String> deviceType) { |
||||
return success(operationDataReportService.getIotDeviceStatistics(getUserOrganCode(), deviceType)); |
||||
} |
||||
|
||||
/** |
||||
* 告警统计报表 |
||||
* |
||||
* @return |
||||
*/ |
||||
@PostMapping("/getAlarmStatistics") |
||||
public AjaxResult getAlarmStatistics(@Validated({DefaultGroup.class}) @RequestBody AlarmStatisticsDTO alarmStatisticsDTO) { |
||||
alarmStatisticsDTO.setOrganCode(getUserOrganCode()); |
||||
return success(operationDataReportService.getAlarmStatistics(alarmStatisticsDTO)); |
||||
} |
||||
|
||||
/** |
||||
* 事件统计报表 |
||||
* |
||||
* @return |
||||
*/ |
||||
@PostMapping("/getEventStatistics") |
||||
public AjaxResult getEventStatistics(@Validated({DefaultGroup.class}) @RequestBody EventStatisticsDTO eventStatisticsDTO) { |
||||
eventStatisticsDTO.setOrganCode(getUserOrganCode()); |
||||
return success(operationDataReportService.getEventStatistics(eventStatisticsDTO)); |
||||
} |
||||
} |
@ -0,0 +1,83 @@ |
||||
package com.cjy.operationdatareport.dto; |
||||
|
||||
import com.cjy.common.groups.DefaultGroup; |
||||
|
||||
import javax.validation.constraints.NotBlank; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public class AlarmStatisticsDTO { |
||||
//警源类型
|
||||
private List<String> policeSourceType; |
||||
//警情分组
|
||||
private List<String> policeGroup; |
||||
//警情类型
|
||||
private List<String> policeType; |
||||
//告警状态
|
||||
private List<String> alarmStatus; |
||||
@NotBlank(message = "开始时间不得为空", groups = {DefaultGroup.class }) |
||||
private String startDate; |
||||
@NotBlank(message = "结束时间不得为空", groups = {DefaultGroup.class }) |
||||
private String endDate; |
||||
private Long organCode; |
||||
|
||||
|
||||
public List<String> getPoliceSourceType() { |
||||
return policeSourceType; |
||||
} |
||||
|
||||
public void setPoliceSourceType(List<String> policeSourceType) { |
||||
this.policeSourceType = policeSourceType; |
||||
} |
||||
|
||||
public List<String> getPoliceGroup() { |
||||
return policeGroup; |
||||
} |
||||
|
||||
public void setPoliceGroup(List<String> policeGroup) { |
||||
this.policeGroup = policeGroup; |
||||
} |
||||
|
||||
public List<String> getPoliceType() { |
||||
return policeType; |
||||
} |
||||
|
||||
public void setPoliceType(List<String> policeType) { |
||||
this.policeType = policeType; |
||||
} |
||||
|
||||
public List<String> getAlarmStatus() { |
||||
return alarmStatus; |
||||
} |
||||
|
||||
public void setAlarmStatus(List<String> alarmStatus) { |
||||
this.alarmStatus = alarmStatus; |
||||
} |
||||
|
||||
public String getEndDate() { |
||||
return endDate; |
||||
} |
||||
|
||||
public void setEndDate(String endDate) { |
||||
this.endDate = endDate; |
||||
} |
||||
|
||||
public String getStartDate() { |
||||
return startDate; |
||||
} |
||||
|
||||
public void setStartDate(String startDate) { |
||||
this.startDate = startDate; |
||||
} |
||||
|
||||
public Long getOrganCode() { |
||||
return organCode; |
||||
} |
||||
|
||||
public void setOrganCode(Long organCode) { |
||||
this.organCode = organCode; |
||||
} |
||||
} |
@ -0,0 +1,70 @@ |
||||
package com.cjy.operationdatareport.dto; |
||||
|
||||
import com.cjy.common.groups.DefaultGroup; |
||||
|
||||
import javax.validation.constraints.NotBlank; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public class EventStatisticsDTO { |
||||
private List<String> oneGradeTypeCode; |
||||
private List<String> towGradeTypeCode; |
||||
private List<String> eventLevel; |
||||
|
||||
@NotBlank(message = "开始时间不得为空", groups = {DefaultGroup.class}) |
||||
private String startDate; |
||||
@NotBlank(message = "结束时间不得为空", groups = {DefaultGroup.class}) |
||||
private String endDate; |
||||
private Long organCode; |
||||
|
||||
public List<String> getOneGradeTypeCode() { |
||||
return oneGradeTypeCode; |
||||
} |
||||
|
||||
public void setOneGradeTypeCode(List<String> oneGradeTypeCode) { |
||||
this.oneGradeTypeCode = oneGradeTypeCode; |
||||
} |
||||
|
||||
public List<String> getTowGradeTypeCode() { |
||||
return towGradeTypeCode; |
||||
} |
||||
|
||||
public void setTowGradeTypeCode(List<String> towGradeTypeCode) { |
||||
this.towGradeTypeCode = towGradeTypeCode; |
||||
} |
||||
|
||||
public List<String> getEventLevel() { |
||||
return eventLevel; |
||||
} |
||||
|
||||
public void setEventLevel(List<String> eventLevel) { |
||||
this.eventLevel = eventLevel; |
||||
} |
||||
|
||||
public String getStartDate() { |
||||
return startDate; |
||||
} |
||||
|
||||
public void setStartDate(String startDate) { |
||||
this.startDate = startDate; |
||||
} |
||||
|
||||
public String getEndDate() { |
||||
return endDate; |
||||
} |
||||
|
||||
public void setEndDate(String endDate) { |
||||
this.endDate = endDate; |
||||
} |
||||
|
||||
public Long getOrganCode() { |
||||
return organCode; |
||||
} |
||||
|
||||
public void setOrganCode(Long organCode) { |
||||
this.organCode = organCode; |
||||
} |
||||
} |
@ -0,0 +1,50 @@ |
||||
package com.cjy.operationdatareport.mapper; |
||||
|
||||
import com.cjy.operationdatareport.dto.AlarmStatisticsDTO; |
||||
import com.cjy.operationdatareport.dto.EventStatisticsDTO; |
||||
import com.cjy.operationdatareport.vo.AlarmStatisticsVO; |
||||
import com.cjy.operationdatareport.vo.EventStatisticsVO; |
||||
import com.cjy.operationdatareport.vo.IotDeviceStatistics; |
||||
import org.apache.ibatis.annotations.Param; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public interface OperationDataReportMapper { |
||||
/** |
||||
* 物联设备统计 |
||||
* |
||||
* @param organCode |
||||
* @return |
||||
*/ |
||||
List<IotDeviceStatistics> getIotDeviceStatistics(@Param("organCode") Long organCode, @Param("list") List<String> deviceType); |
||||
|
||||
/** |
||||
* 旅游资源统计 |
||||
* |
||||
* @param organCode |
||||
* @param dictValue |
||||
* @param dataType |
||||
* @return |
||||
*/ |
||||
List<Map<String, Object>> selectBasicResourceCount(@Param("organCode") Long organCode, @Param("dictValue") String dictValue, @Param("list") List<String> dataType); |
||||
|
||||
/** |
||||
* 告警统计报表 |
||||
* |
||||
* @param alarmStatisticsDTO |
||||
* @return |
||||
*/ |
||||
List<AlarmStatisticsVO> getAlarmStatistics(AlarmStatisticsDTO alarmStatisticsDTO); |
||||
|
||||
/** |
||||
* 事件统计报表 |
||||
* @param eventStatisticsDTO |
||||
* @return |
||||
*/ |
||||
List<EventStatisticsVO> getEventStatistics(EventStatisticsDTO eventStatisticsDTO); |
||||
} |
@ -0,0 +1,47 @@ |
||||
package com.cjy.operationdatareport.service; |
||||
|
||||
import com.cjy.operationdatareport.dto.AlarmStatisticsDTO; |
||||
import com.cjy.operationdatareport.dto.EventStatisticsDTO; |
||||
import com.cjy.operationdatareport.vo.AlarmStatisticsVO; |
||||
import com.cjy.operationdatareport.vo.EventStatisticsVO; |
||||
import com.cjy.operationdatareport.vo.IotDeviceStatistics; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public interface OperationDataReportService { |
||||
/** |
||||
* 旅游资源统计 |
||||
* |
||||
* @param organCode |
||||
* @return |
||||
*/ |
||||
Map<String, Object> getTravelResourcesStatistics(Long organCode, List<String> resourceGrouping, List<String> dataType); |
||||
|
||||
/** |
||||
* 物联设备统计 |
||||
* |
||||
* @param organCode |
||||
* @return |
||||
*/ |
||||
List<IotDeviceStatistics> getIotDeviceStatistics(Long organCode, List<String> deviceType); |
||||
|
||||
/** |
||||
* 告警统计报表 |
||||
* |
||||
* @param alarmStatisticsDTO |
||||
* @return |
||||
*/ |
||||
List<AlarmStatisticsVO> getAlarmStatistics(AlarmStatisticsDTO alarmStatisticsDTO); |
||||
|
||||
/** |
||||
* 事件统计报表 |
||||
* @param eventStatisticsDTO |
||||
* @return |
||||
*/ |
||||
List<EventStatisticsVO> getEventStatistics(EventStatisticsDTO eventStatisticsDTO); |
||||
} |
@ -0,0 +1,94 @@ |
||||
package com.cjy.operationdatareport.service.impl; |
||||
|
||||
import com.cjy.operationdatareport.dto.AlarmStatisticsDTO; |
||||
import com.cjy.operationdatareport.dto.EventStatisticsDTO; |
||||
import com.cjy.operationdatareport.mapper.OperationDataReportMapper; |
||||
import com.cjy.operationdatareport.service.OperationDataReportService; |
||||
import com.cjy.operationdatareport.vo.AlarmStatisticsVO; |
||||
import com.cjy.operationdatareport.vo.EventStatisticsVO; |
||||
import com.cjy.operationdatareport.vo.IotDeviceStatistics; |
||||
import com.ruoyi.common.core.domain.entity.SysDictData; |
||||
import com.ruoyi.system.mapper.SysDictDataMapper; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
@Service |
||||
public class OperationDataReportServiceImpl implements OperationDataReportService { |
||||
@Autowired |
||||
private SysDictDataMapper selectDictDataByType; |
||||
@Autowired |
||||
OperationDataReportMapper operationDataReportMapper; |
||||
|
||||
|
||||
/** |
||||
* 旅游资源统计 |
||||
* |
||||
* @param organCode |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public Map<String, Object> getTravelResourcesStatistics(Long organCode, List<String> resourceGrouping, List<String> dataType) { |
||||
List<Map<String, Object>> list = new ArrayList<>(); |
||||
List<SysDictData> dictDatas = new ArrayList<>(); |
||||
if (resourceGrouping.isEmpty()) { |
||||
dictDatas = selectDictDataByType.selectDictDataByType("basic_resources_type"); |
||||
} else { |
||||
dictDatas = selectDictDataByType.selectDictDataByTypeAndDictValue("basic_resources_type", resourceGrouping); |
||||
} |
||||
Map<String, Object> map = null; |
||||
for (SysDictData dictData : dictDatas) { |
||||
map = new HashMap<>(); |
||||
String dictValue = dictData.getDictValue(); |
||||
List<Map<String, Object>> countList = operationDataReportMapper.selectBasicResourceCount(organCode, dictValue, dataType); |
||||
map.put("name", dictData.getDictLabel()); |
||||
map.put("child", countList); |
||||
list.add(map); |
||||
} |
||||
Map<String, Object> resultMap = new HashMap<>(); |
||||
|
||||
resultMap.put("resultList", list); |
||||
return resultMap; |
||||
} |
||||
|
||||
/** |
||||
* 物联设备统计 |
||||
* |
||||
* @param organCode |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public List<IotDeviceStatistics> getIotDeviceStatistics(Long organCode, List<String> deviceType) { |
||||
return operationDataReportMapper.getIotDeviceStatistics(organCode, deviceType); |
||||
} |
||||
|
||||
/** |
||||
* 告警统计报表 |
||||
* |
||||
* @param alarmStatisticsDTO |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public List<AlarmStatisticsVO> getAlarmStatistics(AlarmStatisticsDTO alarmStatisticsDTO) { |
||||
return operationDataReportMapper.getAlarmStatistics(alarmStatisticsDTO); |
||||
} |
||||
|
||||
/** |
||||
* 事件统计报表 |
||||
* |
||||
* @param eventStatisticsDTO |
||||
* @return |
||||
*/ |
||||
@Override |
||||
public List<EventStatisticsVO> getEventStatistics(EventStatisticsDTO eventStatisticsDTO) { |
||||
return operationDataReportMapper.getEventStatistics(eventStatisticsDTO); |
||||
} |
||||
} |
@ -0,0 +1,67 @@ |
||||
package com.cjy.operationdatareport.vo; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public class AlarmStatisticsVO { |
||||
private String total; |
||||
//警情分类
|
||||
private String alertTypeName; |
||||
//警情分组
|
||||
private String policeGroupName; |
||||
//状态
|
||||
private String status; |
||||
//警源类型
|
||||
private String policeSourceTypeName; |
||||
//日期
|
||||
private String date; |
||||
|
||||
public String getTotal() { |
||||
return total; |
||||
} |
||||
|
||||
public void setTotal(String total) { |
||||
this.total = total; |
||||
} |
||||
|
||||
public String getAlertTypeName() { |
||||
return alertTypeName; |
||||
} |
||||
|
||||
public void setAlertTypeName(String alertTypeName) { |
||||
this.alertTypeName = alertTypeName; |
||||
} |
||||
|
||||
public String getPoliceGroupName() { |
||||
return policeGroupName; |
||||
} |
||||
|
||||
public void setPoliceGroupName(String policeGroupName) { |
||||
this.policeGroupName = policeGroupName; |
||||
} |
||||
|
||||
public String getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(String status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
public String getPoliceSourceTypeName() { |
||||
return policeSourceTypeName; |
||||
} |
||||
|
||||
public void setPoliceSourceTypeName(String policeSourceTypeName) { |
||||
this.policeSourceTypeName = policeSourceTypeName; |
||||
} |
||||
|
||||
public String getDate() { |
||||
return date; |
||||
} |
||||
|
||||
public void setDate(String date) { |
||||
this.date = date; |
||||
} |
||||
} |
@ -0,0 +1,53 @@ |
||||
package com.cjy.operationdatareport.vo; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public class EventStatisticsVO { |
||||
private String total; |
||||
private String towGradeTypeName; |
||||
private String oneGradeTypeName; |
||||
private String date; |
||||
private String eventLevel; |
||||
|
||||
public String getTotal() { |
||||
return total; |
||||
} |
||||
|
||||
public void setTotal(String total) { |
||||
this.total = total; |
||||
} |
||||
|
||||
public String getTowGradeTypeName() { |
||||
return towGradeTypeName; |
||||
} |
||||
|
||||
public void setTowGradeTypeName(String towGradeTypeName) { |
||||
this.towGradeTypeName = towGradeTypeName; |
||||
} |
||||
|
||||
public String getOneGradeTypeName() { |
||||
return oneGradeTypeName; |
||||
} |
||||
|
||||
public void setOneGradeTypeName(String oneGradeTypeName) { |
||||
this.oneGradeTypeName = oneGradeTypeName; |
||||
} |
||||
|
||||
public String getDate() { |
||||
return date; |
||||
} |
||||
|
||||
public void setDate(String date) { |
||||
this.date = date; |
||||
} |
||||
|
||||
public String getEventLevel() { |
||||
return eventLevel; |
||||
} |
||||
|
||||
public void setEventLevel(String eventLevel) { |
||||
this.eventLevel = eventLevel; |
||||
} |
||||
} |
@ -0,0 +1,37 @@ |
||||
package com.cjy.operationdatareport.vo; |
||||
|
||||
/** |
||||
* @author liangjiawei |
||||
* @createDate 2023/3/20 |
||||
*/ |
||||
public class IotDeviceStatistics { |
||||
private String name; |
||||
//设备数量
|
||||
private String equipmentNumber; |
||||
//故障数量
|
||||
private String faultNumber; |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getEquipmentNumber() { |
||||
return equipmentNumber; |
||||
} |
||||
|
||||
public void setEquipmentNumber(String equipmentNumber) { |
||||
this.equipmentNumber = equipmentNumber; |
||||
} |
||||
|
||||
public String getFaultNumber() { |
||||
return faultNumber; |
||||
} |
||||
|
||||
public void setFaultNumber(String faultNumber) { |
||||
this.faultNumber = faultNumber; |
||||
} |
||||
} |
@ -0,0 +1,170 @@ |
||||
<?xml version="1.0" encoding="UTF-8" ?> |
||||
<!DOCTYPE mapper |
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
<mapper namespace="com.cjy.operationdatareport.mapper.OperationDataReportMapper"> |
||||
|
||||
|
||||
<select id="getIotDeviceStatistics" resultType="com.cjy.operationdatareport.vo.IotDeviceStatistics"> |
||||
SELECT |
||||
t3.`name` as `name`, |
||||
t4.equipmentNumber, |
||||
t4.faultNumber |
||||
FROM |
||||
( |
||||
SELECT |
||||
t2.type, |
||||
count(*) equipmentNumber, |
||||
ifnull ( SUM( CASE WHEN t2.runStatus = 1 THEN 1 ELSE 0 END ), 0 ) faultNumber |
||||
FROM |
||||
( |
||||
SELECT |
||||
t1.resource_name AS `name`, |
||||
t1.type, |
||||
t1.run_status AS runStatus |
||||
FROM |
||||
b_iot_info t1 |
||||
WHERE |
||||
del_flag != '2' |
||||
AND STATUS != '1' and t1.organ_code=#{organCode} |
||||
<if test="list.size()>0"> |
||||
and t1.type in |
||||
<foreach item="item" collection="list" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
GROUP BY |
||||
t1.type, |
||||
runStatus, |
||||
`name` |
||||
) t2 |
||||
GROUP BY |
||||
t2.type |
||||
ORDER BY |
||||
equipmentNumber DESC |
||||
) t4 |
||||
LEFT JOIN ti_resource_type t3 ON t3.data_type = t4.type |
||||
</select> |
||||
<select id="selectBasicResourceCount" resultType="java.util.Map"> |
||||
SELECT |
||||
t2.`name`, |
||||
t2.data_type, |
||||
t2.classify_icon, |
||||
IFNULL( t3.count, 0 ) count |
||||
FROM |
||||
ti_enterprise_resource_type t1 |
||||
LEFT JOIN ti_resource_type t2 ON t1.resource_type_id = t2.id |
||||
<if test="dictValue == 'A01'"> |
||||
LEFT JOIN ( SELECT type, count( * ) count FROM b_tour_info GROUP BY type ) t3 ON t3.type = t2.data_type |
||||
</if> |
||||
<if test="dictValue == 'A05'"> |
||||
LEFT JOIN ( SELECT type, count( * ) count FROM b_venue_info GROUP BY type ) t3 ON t3.type = t2.data_type |
||||
</if> |
||||
<if test="dictValue == 'A10'"> |
||||
LEFT JOIN ( SELECT type, count( * ) count FROM b_public_service_info GROUP BY type ) t3 ON t3.type = |
||||
t2.data_type |
||||
</if> |
||||
<if test="dictValue == 'A15'"> |
||||
LEFT JOIN ( SELECT type, count( * ) count FROM b_iot_info GROUP BY type ) t3 ON t3.type = t2.data_type |
||||
</if> |
||||
<if test="dictValue == 'A20'"> |
||||
LEFT JOIN ( SELECT type, count( * ) count FROM b_emergency_info GROUP BY type ) t3 ON t3.type = t2.data_type |
||||
</if> |
||||
<if test="dictValue == 'A25'"> |
||||
LEFT JOIN ( SELECT type, count( * ) count FROM b_tourist_info GROUP BY type UNION ALL SELECT type, count( * |
||||
) count FROM b_vehicle_info GROUP BY type UNION ALL SELECT 'guide' as type, count( * ) count FROM |
||||
b_guide_info GROUP BY type ) t3 ON t3.type = t2.data_type |
||||
</if> |
||||
WHERE |
||||
enterprise_id = #{organCode} |
||||
AND t2.dict_value = #{dictValue} |
||||
<if test="list.size()>0"> |
||||
AND t2.data_type in |
||||
<foreach item="item" collection="list" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
ORDER BY |
||||
t2.sort ASC |
||||
</select> |
||||
<select id="getAlarmStatistics" resultType="com.cjy.operationdatareport.vo.AlarmStatisticsVO"> |
||||
SELECT |
||||
count(*) total, |
||||
t2.`name` as alertTypeName, |
||||
t3.`name` as policeGroupName, |
||||
t4.dict_label as `status`, |
||||
t5.`name` as policeSourceTypeName, |
||||
DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) as `date` |
||||
FROM |
||||
ec_alarm_info t1 |
||||
INNER JOIN ec_classification_data_config t2 on t1.classification_data_code= t2.`code` |
||||
INNER JOIN ec_classification_config t3 on t2.classification_code=t3.`code` and t3.type='1' |
||||
INNER JOIN ec_classification_config t5 on t1.alarm_source=t5.`code` and t5.type='3' |
||||
INNER JOIN sys_dict_data t4 on t1.`status`=t4.dict_value and t4.dict_type='alarm_status' |
||||
|
||||
WHERE 1=1 |
||||
and t1.organ_code=#{organCode} |
||||
and ( DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) between #{startDate} and #{endDate}) |
||||
<if test="policeSourceType.size()>0"> |
||||
and t1.alarm_source in |
||||
<foreach item="item" collection="policeSourceType" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
<if test="policeGroup.size()>0"> |
||||
and t2.classification_code in |
||||
<foreach item="item" collection="policeGroup" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
<if test="policeType.size()>0"> |
||||
and t1.classification_data_code in |
||||
<foreach item="item" collection="policeType" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
<if test="alarmStatus.size()>0"> |
||||
and t1.status in |
||||
<foreach item="item" collection="alarmStatus" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
GROUP BY alertTypeName,policeGroupName,policeSourceTypeName,`status`,`date` |
||||
ORDER BY `date` desc |
||||
</select> |
||||
<select id="getEventStatistics" resultType="com.cjy.operationdatareport.vo.EventStatisticsVO"> |
||||
SELECT |
||||
count(*) total, |
||||
t2.`name` as towGradeTypeName, |
||||
t3.`name` as oneGradeTypeName, |
||||
DATE_FORMAT(t1.create_time, '%Y-%m-%d' ) as `date`, |
||||
t4.dict_label as eventLevel |
||||
FROM |
||||
ec_alarm_info t1 |
||||
INNER JOIN ec_classification_data_config t2 on t1.classification_event_code= t2.`code` |
||||
INNER JOIN ec_classification_config t3 on t2.classification_code=t3.`code` and t3.type='2' |
||||
LEFT JOIN sys_dict_data t4 on t1.event_grade_id=t4.dict_value and t4.dict_type='event_grade' |
||||
where 1=1 |
||||
and t1.organ_code=#{organCode} |
||||
and ( DATE_FORMAT( t1.create_time, '%Y-%m-%d' ) between #{startDate} and #{endDate}) |
||||
<if test="oneGradeTypeCode.size()>0"> |
||||
and t2.classification_code in |
||||
<foreach item="item" collection="oneGradeTypeCode" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
<if test="towGradeTypeCode.size()>0"> |
||||
and t1.classification_event_code in |
||||
<foreach item="item" collection="towGradeTypeCode" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
<if test="eventLevel.size()>0"> |
||||
and t1.event_grade_id in |
||||
<foreach item="item" collection="eventLevel" open="(" separator="," close=")"> |
||||
#{item} |
||||
</foreach> |
||||
</if> |
||||
GROUP BY towGradeTypeName,oneGradeTypeName,eventLevel,`date` |
||||
</select> |
||||
</mapper> |
Loading…
Reference in new issue