| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?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.PProjecttaskMapper">
- <resultMap id="DaysCountDtoMap" type="com.daju.mix.dto.DaysCountDto"/>
- <!-- 首页 查询最近7日已派工单数量-->
- <select id="selectSevenDaysCount" resultMap="DaysCountDtoMap">
- # SELECT DATE_FORMAT(planstarttime, '%Y-%m-%d') days,
- # count(*) count
- # FROM (SELECT *
- # FROM p_projecttask
- # WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(planstarttime)
- # and executer IS NOT NULL ) as a
- # GROUP BY days;
- 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(planstarttime) as time, count(*) count
- from p_projecttask o
- where executer is not null
- group by date(o.planstarttime)
- ) b on a.timeDay = b.time
- order by days
- </select>
- <!-- 首页 最近7日催办单数量-->
- <select id="selectSevenDaysCountByIsUrge" resultMap="DaysCountDtoMap">
- # SELECT DATE_FORMAT(planstarttime, '%Y-%m-%d') days,
- # count(*) count
- # FROM (SELECT *
- # FROM p_projecttask
- # WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(planstarttime)
- # and executer IS NOT NULL
- # and isUrge = '1') as a
- # GROUP BY days;
- # 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(planstarttime) as time, count(*) count
- # from p_projecttask o
- # where executer is not null
- # and isUrge = '1'
- # group by date(o.planstarttime)
- # ) b on a.timeDay = b.time
- # order by days
- </select>
- <!-- 首页 最近7日预期单数量-->
- <select id="selectSevenDaysCountByIsOverdue" resultMap="DaysCountDtoMap">
- # SELECT DATE_FORMAT(planstarttime, '%Y-%m-%d') days,
- # count(*) count
- # FROM (SELECT *
- # FROM p_projecttask
- # WHERE DATE_SUB(CURDATE(), INTERVAL 7 DAY) <![CDATA[ <= ]]> date(planstarttime)
- # and executer IS NOT NULL
- # and isOverdue = '1') as a
- # GROUP BY days;
- 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 o
- where executer is not null
- and planendtime <![CDATA[ < ]]> now()
- and taskstatus <![CDATA[ <> ]]> 10
- and taskstatus <![CDATA[ <> ]]> 20
- group by date(o.planendtime)
- ) b on a.timeDay = b.time
- order by days
- </select>
- <resultMap id="WarningDetailDtoMap" type="com.daju.mix.dto.WarningDetailDto"/>
- <select id="indexWarningDetail" resultMap="WarningDetailDtoMap">
- select typename type, description content, address area, a.create_date time, a.alarm_level level, status,executer
- from t_s_type
- inner join (select b.id,
- alarm_type_id,
- alarm_type,
- b.description,
- address,
- b.create_date,
- alarm_level,
- status,
- executer
- from p_projecttask a
- left join t_b_car_alarm b on a.sourceid = b.id
- where b.id = #{id}) a
- where typegroupid = a.alarm_type
- and typecode = a.alarm_type_id;
- </select>
- <resultMap id="WarningDTO" type="com.daju.mix.dto.WarningDTO"/>
- <!-- 环境保洁预警-->
- <select id="environmentWarnings" resultMap="WarningDTO">
- select a.name,c.realname,a.taskstatus status ,alarm_type_id alarmTypeId,planendtime endTime
- from p_projecttask a
- left join t_b_car_alarm b on a.sourceid = b.id
- left join t_s_base_user c on a.executer = c.ID
- # where alarm_type_id in (71,72,73,74,75,76,77,20);
- where alarm_type_id in (71,73,74,75,76,77,20);
- </select>
- <select id="securityWarnings" resultMap="WarningDTO">
- select a.name,c.realname,a.taskstatus status ,alarm_type_id alarmTypeId,planendtime endTime
- from p_projecttask a
- left join t_b_car_alarm b on a.sourceid = b.id
- left join t_s_base_user c on a.executer = c.ID
- where alarm_type_id in (79);
- </select>
- </mapper>
|