Browse Source

非机预警日期类型加收费站

develop
wangsixiang 5 months ago
parent
commit
7454654bb1
  1. 10
      zc-business/src/main/java/com/zc/business/domain/DcWarning.java
  2. 20
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

10
zc-business/src/main/java/com/zc/business/domain/DcWarning.java

@ -127,6 +127,16 @@ public class DcWarning extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
private Date currently;
private Long facilityId;
public Long getFacilityId() {
return facilityId;
}
public void setFacilityId(Long facilityId) {
this.facilityId = facilityId;
}
public Date getCurrently() {
return currently;
}

20
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -477,19 +477,21 @@
SELECT 20 UNION ALL SELECT 21 UNION ALL SELECT 22 UNION ALL SELECT 23
) t1
left join
(select HOUR(warning_time) hours,count(*) num from dc_warning
where date_format(warning_time,'%Y-%m-%d') = date_format(#{warningTime},'%Y-%m-%d')
and warning_source=6
(select HOUR(warning_time) hours,count(*) num,dc_warning.stake_mark,facility_name from dc_warning
left join dc_facility on dc_warning.stake_mark=dc_facility.stake_mark and dc_facility.facility_type=1
where date_format(warning_time,'%Y-%m-%d') = date_format('2024-06-25','%Y-%m-%d') and warning_source=6
<if test="facilityId != null "> and dc_facility.id=#{facilityId}</if>
GROUP BY hours) t2
on t1.n = t2.hours
</select>
<select id="selectNonAutomaticWarningMonth" resultType="java.util.HashMap">
SELECT DATE(warning.warning_time) AS day, COUNT(*) AS number
SELECT distinct DATE(warning.warning_time) AS day, COUNT(*) AS number
FROM dc_warning as warning
WHERE DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT(#{warningTime},'%Y-%m')
and warning_source=6
left join dc_facility on warning.stake_mark=dc_facility.stake_mark and dc_facility.facility_type=1
WHERE DATE_FORMAT(warning.warning_time,'%Y-%m') =DATE_FORMAT('2024-06-01','%Y-%m') and warning_source=6
<if test="facilityId != null "> and dc_facility.id=#{facilityId}</if>
GROUP BY day
ORDER BY day
ORDER BY day;
</select>
<select id="selectNonAutomaticWarningYear" resultType="java.util.HashMap">
select t1.n as month,IFNULL(t2.num,0)as number from
@ -499,7 +501,9 @@
SELECT 12
) t1 left join
(select month(warning_time) hours,count(*) num from dc_warning t1
where DATE_FORMAT(t1.warning_time,'%Y')=DATE_FORMAT(#{warningTime},'%Y') and warning_source=6
left join dc_facility on t1.stake_mark=dc_facility.stake_mark and dc_facility.facility_type=1
where DATE_FORMAT(t1.warning_time,'%Y')=DATE_FORMAT('2024-01-01','%Y') and warning_source=6
<if test="facilityId != null "> and dc_facility.id=#{facilityId}</if>
GROUP BY hours) t2
on t1.n = t2.hours
</select>

Loading…
Cancel
Save