| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310 |
- <?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.daju.mix.dao.mapper.TBCarAlarmMapper">
- <resultMap id="AlarmCountDtoMap" type="com.daju.mix.dto.AlarmCountDto"/>
- <resultMap id="IndexWarningsDtoMap" type="com.daju.mix.dto.IndexWarningsDto"/>
- <resultMap id="DaysCountDtoMap" type="com.daju.mix.dto.DaysCountDto"/>
- <!-- 查询所有预警及 预警是否处理-->
- <select id="selectAll" resultMap="IndexWarningsDtoMap">
- select id, description content, create_date time, status, create_date
- from t_b_car_alarm a
- </select>
- <select id="selectAlarmByCarId" resultMap="IndexWarningsDtoMap">
- select id, create_date time, description content, status state
- from t_b_car_alarm
- where carid = #{carId};
- </select>
- <!-- 车辆总预警次数 及 当日预警次数-->
- <select id="selectAlarmCountByCarId" resultMap="AlarmCountDtoMap">
- select count(id) totalViolationCount,
- (select count(id)
- from t_b_car_alarm
- where date_format(create_date, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
- and carid = #{carId}) violationCount
- from t_b_car_alarm
- where carid = #{carid};
- </select>
- <!-- 车辆总预警次数 及 当日预警次数-->
- <select id="selectAlarmCountByArchiveType" resultMap="AlarmCountDtoMap">
- select count(id) totalViolationCount,
- (select count(id)
- from t_b_car_alarm
- where date_format(create_date, '%Y-%m-%d') = date_format(now(), '%Y-%m-%d')
- and archive_type = #{type}) violationCount
- from t_b_car_alarm
- where archive_type = #{type};
- </select>
- <!-- 1道班房,2垃圾清运点,3垃圾箱,4清扫点,5干垃圾清运车,6湿垃圾清运车,7洒水车,8道路,9公厕,10治安巡逻车,11保安,12保安打卡点-->
- <!-- 秩序维护(已派)工单数量-->
- <select id="securityWorkOrderCount" resultType="int">
- select count(p.id)
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where executer is not null
- and archive_type = 10
- or archive_type = 11
- or archive_type = 12
- </select>
- <!-- 秩序维护(逾期)工单数量-->
- <select id="securityWorkOrderCountOverdue" resultType="int">
- select count(p.id)
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where executer is not null
- and planendtime <![CDATA[ < ]]> now()
- and archive_type = 10
- or archive_type = 11
- or archive_type = 12
- </select>
- <!-- 秩序维护近七日(已派/ 逾期 / 催办)工单数量列表-->
- <!-- status 1:已派 2:逾期 3:催办 -->
- <select id="securityWorkOrderSevenCount" resultMap="DaysCountDtoMap">
- select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
- from (
- SELECT curdate() as timeDay
- union all
- SELECT date_sub(curdate(), interval 1 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 2 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 3 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 4 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 5 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 6 day) as timeDayA
- ) a
- left join (
- select date(planendtime) as time, count(*) count
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- <where>
- <if test="status == 1">
- executer is not null
- and archive_type = 10
- or archive_type = 11
- or archive_type = 12
- </if>
- <if test="status == 2">
- executer is not null
- and planendtime <![CDATA[ < ]]> now()
- and archive_type = 10
- or archive_type = 11
- or archive_type = 12
- </if>
- </where>
- group by date(p.planendtime)
- ) b on a.timeDay = b.time
- order by days;
- </select>
- <!-- 1道班房,2垃圾清运点,3垃圾箱,4清扫点,5干垃圾清运车,6湿垃圾清运车,7洒水车,8道路,9公厕,10治安巡逻车,11保安,12保安打卡点-->
- <!-- 环境保洁(已派)工单数量-->
- <select id="environmentWorkOrderCount" resultType="int">
- select count(p.id)
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where executer is not null
- and archive_type = 1
- or archive_type = 2
- or archive_type = 3
- or archive_type = 4
- or archive_type = 5
- or archive_type = 6
- or archive_type = 7
- or archive_type = 8
- or archive_type = 9
- </select>
- <!-- 环境保洁(逾期)工单数量-->
- <select id="environmentWorkOrderCountOverdue" resultType="int">
- select count(p.id)
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where executer is not null
- and planendtime <![CDATA[ < ]]> now()
- and archive_type = 1
- or archive_type = 2
- or archive_type = 3
- or archive_type = 4
- or archive_type = 5
- or archive_type = 6
- or archive_type = 7
- or archive_type = 8
- or archive_type = 9
- </select>
- <!-- 秩序维护近七日(已派/ 逾期 / 催办)工单数量列表-->
- <!-- status 1:已派 2:逾期 3:催办 -->
- <select id="environmentWorkOrderSevenCount" resultMap="DaysCountDtoMap">
- select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
- from (
- SELECT curdate() as timeDay
- union all
- SELECT date_sub(curdate(), interval 1 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 2 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 3 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 4 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 5 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 6 day) as timeDayA
- ) a
- left join (
- select date(planendtime) as time, count(*) count
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- <where>
- <if test="status == 1">
- executer is not null
- and archive_type = 1
- or archive_type = 2
- or archive_type = 3
- or archive_type = 4
- or archive_type = 5
- or archive_type = 6
- or archive_type = 7
- or archive_type = 8
- or archive_type = 9
- </if>
- <if test="status == 2">
- executer is not null
- and planendtime <![CDATA[ < ]]> now()
- and archive_type = 1
- or archive_type = 2
- or archive_type = 3
- or archive_type = 4
- or archive_type = 5
- or archive_type = 6
- or archive_type = 7
- or archive_type = 8
- or archive_type = 9
- </if>
- </where>
- group by date(p.planendtime)
- ) b on a.timeDay = b.time
- order by days;
- </select>
- <!-- 1道班房,2垃圾清运点,3垃圾箱,4清扫点,5干垃圾清运车,6湿垃圾清运车,7洒水车,8道路,9公厕,10治安巡逻车,11保安,12保安打卡点-->
- <!-- 清扫点(已派)工单数量-->
- <select id="sweepPointWorkOrderCount" resultType="int">
- select count(p.id)
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where executer is not null
- and archive_id = #{id}
- and archive_type = 4
- </select>
- <!-- 清扫点(逾期)工单数量-->
- <select id="sweepPointWorkOrderCountOverdue" resultType="int">
- select count(p.id)
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where executer is not null
- and archive_id = #{id}
- and planendtime <![CDATA[ < ]]> now()
- and archive_type = 4
- </select>
- <!-- 清扫点近七日(已派)工单数量列表-->
- <select id="sweepPointWorkOrderSevenCount" resultMap="DaysCountDtoMap">
- select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
- from (
- SELECT curdate() as timeDay
- union all
- SELECT date_sub(curdate(), interval 1 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 2 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 3 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 4 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 5 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 6 day) as timeDayA
- ) a
- left join (
- select date(planendtime) as time, count(*) count
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where archive_id = #{archiveId}
- and executer is not null
- and archive_type = 4
- group by date(p.planendtime)
- ) b on a.timeDay = b.time
- order by days;
- </select>
- <!-- 清扫点近七日(逾期)工单数量列表-->
- <select id="sweepPointWorkOrderSevenCount1" resultMap="DaysCountDtoMap">
- select DATE_FORMAT(a.timeDay, '%Y-%m-%d') as days, ifnull(b.count, 0) as count
- from (
- SELECT curdate() as timeDay
- union all
- SELECT date_sub(curdate(), interval 1 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 2 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 3 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 4 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 5 day) as timeDay
- union all
- SELECT date_sub(curdate(), interval 6 day) as timeDayA
- ) a
- left join (
- select date(planendtime) as time, count(*) count
- from p_projecttask p
- left join t_b_car_alarm t on p.sourceid = t.id
- where archive_id = #{archiveId}
- and executer is not null
- and planendtime <![CDATA[ < ]]> now()
- and archive_type = 4
- group by date(p.planendtime)
- ) b on a.timeDay = b.time
- order by days;
- </select>
- <!--指定清扫点当日预警信息-->
- <select id="sweepPointWarningsDays" resultMap="IndexWarningsDtoMap">
- select archive_id id, create_date time, content, a.status state
- from t_b_car_alarm a
- left join t_b_archives_sweep_point b on a.archive_id = b.id
- where TO_DAYS(a.alarm_date) = TO_DAYS(NOW())
- and archive_id = #{archivesId};
- </select>
- <!-- 指定公厕预警信息-->
- <select id="toiletsWarningsById" resultMap="IndexWarningsDtoMap">
- select a.id, a.create_date time, a.content, a.status state
- from t_b_car_alarm a
- left join t_b_archives_toilets b on archive_id = b.id
- where b.id = #{toiletsId}
- </select>
- <!-- 指定道班房预警信息-->
- <select id="DBFWarningsById" resultMap="IndexWarningsDtoMap">
- select id, create_date time, content, status
- from t_b_car_alarm
- where archive_type = 1
- and archive_id = #{id}
- </select>
- </mapper>
|