2024-08-15 23:12:50 +08:00
|
|
|
|
<?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">
|
|
|
|
|
|
2024-08-17 01:05:19 +08:00
|
|
|
|
<select id="selectRepairWorkerStatsList" parameterType="com.ics.admin.vo.RepairWorkerStatsVo" resultType="com.ics.admin.vo.RepairWorkerStatsVo">
|
2024-08-15 23:12:50 +08:00
|
|
|
|
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 worker_stats
|
|
|
|
|
<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>
|
|
|
|
|
|
2024-08-17 01:05:19 +08:00
|
|
|
|
<select id="selectRepairFloorStatsVoList" parameterType="com.ics.admin.vo.RepairFloorStatsVo" resultType="com.ics.admin.vo.RepairFloorStatsVo">
|
2024-08-15 23:12:50 +08:00
|
|
|
|
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 floor_stats
|
|
|
|
|
<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>
|
|
|
|
|
|
2024-08-17 01:05:19 +08:00
|
|
|
|
<!-- 第一行 管理员 工单与 通知统计 -->
|
|
|
|
|
<select id="repairAdminStats" resultType="com.ics.admin.vo.RepairAdminStatsVo">
|
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT `wait`,`anew`,0 as newnotice,0 as oldnotice FROM
|
|
|
|
|
(SELECT count(id) as `wait` FROM ics_repair where delete_flag=0 and status=3) as A,
|
|
|
|
|
(SELECT count(DISTINCT repair_id) as `anew` FROM ics_repair_log where delete_flag=0 and node_form=3) as B
|
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 第二、三行 工单统计、工单完成情况、评价情况 -->
|
|
|
|
|
<select id="repairStats" resultType="com.ics.admin.vo.RepairStatsVo">
|
2024-08-15 23:12:50 +08:00
|
|
|
|
<![CDATA[
|
|
|
|
|
SELECT
|
|
|
|
|
count(id) zs,
|
2024-08-17 01:05:19 +08:00
|
|
|
|
sum(case when status < 9 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 predate < end_date and timeout=1 and status>=9 then 1 else 0 end) ltimeout,
|
|
|
|
|
sum(case when predate > end_date and timeout=1 and status>=9 then 1 else 0 end) ntimeout
|
2024-08-15 23:12:50 +08:00
|
|
|
|
FROM
|
|
|
|
|
ics_repair
|
|
|
|
|
WHERE
|
2024-08-17 01:05:19 +08:00
|
|
|
|
delete_flag = 0 and create_time between #{startTime} and #{endTime}
|
2024-08-15 23:12:50 +08:00
|
|
|
|
]]>
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-08-17 15:02:14 +08:00
|
|
|
|
<!-- 第四行 左侧 楼层负责人情况统计 -->
|
|
|
|
|
<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 device.id, device.name, count(rep.id) AS zs, SUM(CASE WHEN rep.STATUS >= 9 THEN 1 ELSE 0 END) AS closed
|
|
|
|
|
FROM ics_repair_device device, ics_repair rep
|
|
|
|
|
WHERE
|
|
|
|
|
device.delete_flag = 0 AND rep.delete_flag = 0 AND device.id = rep.device_id
|
|
|
|
|
and rep.create_time between #{startTime} and #{endTime}
|
|
|
|
|
GROUP BY device.id, device.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>
|
2024-08-15 23:12:50 +08:00
|
|
|
|
</mapper>
|