mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-23 02:29:35 +08:00
216 lines
11 KiB
XML
216 lines
11 KiB
XML
<?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.ics.admin.mapper.RepairStatsMapper">
|
||
<!-- 人员绩效 维修工 -->
|
||
<select id="selectRepairWorkerStatsList" parameterType="com.ics.admin.vo.RepairWorkerStatsVo" resultType="com.ics.admin.vo.RepairWorkerStatsVo">
|
||
SELECT id, username, mobile, typeid, typename, zs, process, closed, Unresolved, pj,
|
||
case when pj>0 then CONCAT(h,',',ROUND(h/pj*100,1),'%') else '0,0%' end as h,
|
||
case when pj>0 then CONCAT(m,',',ROUND(m/pj*100,1),'%') else '0,0%' end as m,
|
||
case when pj>0 then CONCAT(l,',',ROUND(l/pj*100,1),'%') else '0,0%' end as l
|
||
FROM
|
||
<![CDATA[
|
||
(
|
||
select
|
||
user.id,user.username username,user.mobile,dt.id typeid,dt.name typename,
|
||
count(rep.id) as zs,
|
||
SUM(case when rep.status=5 or rep.status=7 then 1 else 0 end) as process,
|
||
SUM(case when rep.status=9 or rep.status=13 then 1 else 0 end) as closed,
|
||
SUM(case when rep.resolve=0 then 1 else 0 end) as Unresolved,
|
||
count(rep.eval_service) pj,
|
||
SUM(case when rep.eval_service>=4 then 1 else 0 end) as h,
|
||
SUM(case when rep.eval_service=3 then 1 else 0 end) as m,
|
||
SUM(case when rep.eval_service<=2 then 1 else 0 end) as l
|
||
from
|
||
ics_customer_staff user, ics_repair rep, ics_repair_device_type dt
|
||
where
|
||
user.delete_flag=0 and rep.delete_flag=0 and dt.delete_flag=0
|
||
and user.id=rep.repair_user_id and rep.type_id=dt.id
|
||
]]>
|
||
<if test="start != null and end != null">
|
||
and rep.create_time between #{start} and #{end}
|
||
</if>
|
||
<![CDATA[
|
||
and (rep.status=5 or rep.status=7 or rep.status=9 or rep.status=13)
|
||
GROUP BY
|
||
user.id,user.name,user.mobile,dt.id,dt.name
|
||
) tb
|
||
|
||
]]>
|
||
<where>
|
||
<if test="username != null and username != ''">AND username LIKE CONCAT('%', #{username}, '%')</if>
|
||
<if test="mobile != null and mobile != ''">AND mobile LIKE CONCAT('%', #{mobile}, '%')</if>
|
||
<if test="typeid != null">AND typeid = #{typeid}</if>
|
||
</where>
|
||
</select>
|
||
|
||
<!-- 人员绩效 楼层管理员 -->
|
||
<select id="selectRepairFloorStatsVoList" parameterType="com.ics.admin.vo.RepairFloorStatsVo" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||
SELECT id, name, mobile, adr, zs, process, closed, Unresolved, pj,
|
||
case when pj>0 then CONCAT(h,',',ROUND(h/pj*100,1),'%') else '0,0%' end as h,
|
||
case when pj>0 then CONCAT(m,',',ROUND(m/pj*100,1),'%') else '0,0%' end as m,
|
||
case when pj>0 then CONCAT(l,',',ROUND(l/pj*100,1),'%') else '0,0%' end as l
|
||
FROM
|
||
<![CDATA[
|
||
(
|
||
select user.id,user.username name,user.mobile,group_concat(DISTINCT CONCAT(ad.name,'/',floor.name)) adr,
|
||
count(rep.id) as zs,
|
||
SUM(case when rep.status<9 then 1 else 0 end) as process,
|
||
SUM(case when rep.status>=9 then 1 else 0 end) as closed,
|
||
SUM(case when rep.resolve=0 then 1 else 0 end) as Unresolved,
|
||
count(rep.eval_service) pj,
|
||
SUM(case when rep.eval_service>=4 then 1 else 0 end) as h,
|
||
SUM(case when rep.eval_service=3 then 1 else 0 end) as m,
|
||
SUM(case when rep.eval_service<=2 then 1 else 0 end) as l
|
||
from
|
||
ics_customer_staff user, ics_repair_address ad, ics_repair_address_floor floor, ics_repair rep
|
||
where
|
||
user.delete_flag=0 and floor.delete_flag=0 and rep.delete_flag=0 and ad.delete_flag=0
|
||
and user.id=floor.admin_id and floor.address_id=ad.id and floor.id=rep.floor_id
|
||
]]>
|
||
<if test="start != null and end != null">
|
||
and rep.create_time between #{start} and #{end}
|
||
</if>
|
||
<![CDATA[
|
||
GROUP BY
|
||
user.id,user.name,user.mobile
|
||
) tb
|
||
]]>
|
||
<where>
|
||
<if test="name != null and name != ''">AND name LIKE CONCAT('%', #{name}, '%')</if>
|
||
<if test="mobile != null and mobile != ''">AND mobile LIKE CONCAT('%', #{mobile}, '%')</if>
|
||
<if test="adr != null and adr != ''">AND adr LIKE CONCAT('%', #{adr}, '%')</if>
|
||
</where>
|
||
</select>
|
||
|
||
<!-- 楼层管理员自行报修情况 -->
|
||
<select id="getRepairFloorCreateStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||
<![CDATA[
|
||
SELECT id, name, mobile, zs, process, closed, unresolved, pj,
|
||
case when pj>0 then CONCAT(h,',',ROUND(h/pj*100,1),'%') else '0,0%' end as h,
|
||
case when pj>0 then CONCAT(m,',',ROUND(m/pj*100,1),'%') else '0,0%' end as m,
|
||
case when pj>0 then CONCAT(l,',',ROUND(l/pj*100,1),'%') else '0,0%' end as l
|
||
FROM
|
||
(
|
||
select user.id,user.username name,user.mobile,
|
||
count(rep.id) as zs,
|
||
SUM(case when rep.status<9 then 1 else 0 end) as process,
|
||
SUM(case when rep.status>=9 then 1 else 0 end) as closed,
|
||
SUM(case when rep.resolve=0 then 1 else 0 end) as unresolved,
|
||
count(rep.eval_service) pj,
|
||
SUM(case when rep.eval_service>=4 then 1 else 0 end) as h,
|
||
SUM(case when rep.eval_service=3 then 1 else 0 end) as m,
|
||
SUM(case when rep.eval_service<=2 then 1 else 0 end) as l
|
||
from
|
||
ics_customer_staff user, (select admin_id from ics_repair_address_floor where delete_flag=0 group by admin_Id) floor, ics_repair rep
|
||
where
|
||
user.delete_flag=0 and rep.delete_flag=0
|
||
and user.id=floor.admin_id and cast(user.id as char)=rep.create_by
|
||
]]>
|
||
<if test="startTime != null and endTime != null">
|
||
and rep.create_time between #{startTime} and #{endTime}
|
||
</if>
|
||
<if test="keywords != null and keywords != ''">
|
||
and (user.name LIKE CONCAT('%', #{keywords}, '%') or user.mobile like CONCAT('%', #{keywords}, '%'))
|
||
</if>
|
||
<![CDATA[
|
||
GROUP BY
|
||
user.id,user.name,user.mobile
|
||
) tb
|
||
]]>
|
||
</select>
|
||
|
||
<!-- 第一行 管理员 工单与 通知统计 -->
|
||
<select id="repairAdminStats" resultType="com.ics.admin.vo.RepairAdminStatsVo">
|
||
<![CDATA[
|
||
SELECT `wait`,`anew`,newnotice,oldnotice FROM
|
||
(SELECT count(id) as `wait` FROM ics_repair where delete_flag=0 and status=1) as A,
|
||
(SELECT count(id) as `anew` FROM ics_repair where delete_flag=0 and status=3) as B,
|
||
(select count(id) as newnotice from ics_repair_remind where `read`=0 and user_id= #{userId}) C,
|
||
(select count(id) as oldnotice from ics_repair_remind where `read`=1 and user_id= #{userId}) D
|
||
]]>
|
||
</select>
|
||
|
||
<!-- 第二、三行 工单统计、工单完成情况、评价情况 -->
|
||
<select id="repairStats" resultType="com.ics.admin.vo.RepairStatsVo">
|
||
<![CDATA[
|
||
SELECT
|
||
count(id) zs,
|
||
sum(case when status <= 7 then 1 else 0 end) `wait`,
|
||
sum(case when predate is not null and predate < now() and status < 9 then 1 else 0 end) timeout,
|
||
sum(case when eval_service is not null then 1 else 0 end) as pj,
|
||
sum(case when eval_service is not null and eval_service >=4 then 1 else 0 end) as h,
|
||
sum(case when eval_service is not null and eval_service =3 then 1 else 0 end) as m,
|
||
sum(case when eval_service is not null and eval_service <=2 then 1 else 0 end) as l,
|
||
sum(case when status > 7 then 1 else 0 end) wc,
|
||
sum(case when timeout =5 and status>=9 then 1 else 0 end) htimeout,
|
||
sum(case when timeout =3 and status>=9 then 1 else 0 end) mtimeout,
|
||
sum(case when timeout<=1 and status>=9 then 1 else 0 end) ntimeout
|
||
FROM
|
||
ics_repair
|
||
WHERE
|
||
delete_flag = 0 and create_time between #{startTime} and #{endTime}
|
||
]]>
|
||
</select>
|
||
|
||
<!-- 第四行 左侧 楼层负责人情况统计 -->
|
||
<select id="floorStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||
<![CDATA[
|
||
SELECT USER.id, USER.NAME, count( rep.id ) AS zs,
|
||
SUM( CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END ) AS closed
|
||
FROM
|
||
ics_customer_staff USER,ics_repair_address_floor floor,ics_repair rep
|
||
WHERE
|
||
USER.delete_flag = 0 AND floor.delete_flag = 0 AND rep.delete_flag = 0
|
||
AND USER.id = floor.admin_id AND floor.id = rep.floor_id
|
||
and rep.create_time between #{startTime} and #{endTime}
|
||
GROUP BY USER.id,USER.NAME
|
||
order by zs desc
|
||
]]>
|
||
</select>
|
||
<!-- 第四行 右上 设备故障统计 -->
|
||
<select id="deviceStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||
<![CDATA[
|
||
SELECT dt.id, dt.name, count(rep.id) AS zs, SUM(CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END) AS closed
|
||
FROM ics_repair_device_type dt, ics_repair rep
|
||
WHERE
|
||
dt.delete_flag = 0 AND rep.delete_flag = 0 AND dt.id = rep.type_id
|
||
and rep.create_time between #{startTime} and #{endTime}
|
||
GROUP BY dt.id, dt.NAME
|
||
order by zs desc
|
||
]]>
|
||
</select>
|
||
<!-- 第四行 右下 故障类型统计 -->
|
||
<select id="failureStats" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
||
<![CDATA[
|
||
SELECT
|
||
failure.id,failure.name,count( rep.id ) AS zs
|
||
FROM
|
||
ics_repair_failure_type failure,ics_repair rep
|
||
WHERE
|
||
rep.delete_flag = 0 AND failure.delete_flag = 0 and (rep.status=9 or rep.status=13)
|
||
AND failure.id = rep.failure_type_id and rep.create_time between #{startTime} and #{endTime}
|
||
GROUP BY failure.id,failure.NAME order by zs desc
|
||
]]>
|
||
</select>
|
||
<!-- 第五行 设备、品牌、评价 统计 -->
|
||
<select id="deviceTypeStats" resultType="com.ics.admin.vo.RepairDivceTypeStatsVo">
|
||
<![CDATA[
|
||
SELECT dt.id typeid, dt.name typename, device.name devicename, device.brand,
|
||
count(rep.id) AS zs,
|
||
sum(CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END) AS closed,
|
||
sum(case when eval_service is not null then 1 else 0 end) as pj,
|
||
sum(case when eval_service is not null and eval_service >=4 then 1 else 0 end) as h,
|
||
sum(case when eval_service is not null and eval_service =3 then 1 else 0 end) as m,
|
||
sum(case when eval_service is not null and eval_service <=2 then 1 else 0 end) as l
|
||
FROM ics_repair_device_type dt, ics_repair_device device, ics_repair rep
|
||
WHERE
|
||
dt.delete_flag=0 and device.delete_flag = 0 AND rep.delete_flag = 0
|
||
and dt.id=device.type_id AND device.id = rep.device_id
|
||
and rep.create_time between #{startTime} and #{endTime}
|
||
GROUP BY dt.id, dt.name, device.name
|
||
order by zs desc
|
||
]]>
|
||
</select>
|
||
</mapper> |