81 lines
4.0 KiB
XML
Raw Normal View History

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">
<resultMap type="com.ics.admin.domain.RepairWorkerStatsVo" id="RepairWorkerStatsVoResult">
<result property="id" column="id"/>
<result property="username" column="username"/>
<result property="mobile" column="mobile"/>
<result property="typeid" column="typeid"/>
<result property="typename" column="typename"/>
<result property="zs" column="zs"/>
<result property="process" column="process"/>
<result property="closed" column="closed"/>
<result property="unresolved" column="Unresolved"/>
<result property="pj" column="pj"/>
<result property="h" column="h"/>
<result property="m" column="m"/>
<result property="l" column="l"/>
</resultMap>
<select id="selectRepairWorkerStatsList" parameterType="RepairWorkerStatsVo" resultMap="RepairWorkerStatsVoResult">
SELECT id, username, mobile, typeid, typename, zs, process, closed, Unresolved, pj,
case when pj>0 then CONCAT(h,'',ROUND(h/pj*100,1),'%') else '00%' end as h,
case when pj>0 then CONCAT(m,'',ROUND(m/pj*100,1),'%') else '00%' end as m,
case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' 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>
<resultMap type="com.ics.admin.domain.RepairFloorStatsVo" id="RepairFloorStatsVoResult">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="mobile" column="mobile"/>
<result property="adr" column="adr"/>
<result property="zs" column="zs"/>
<result property="process" column="process"/>
<result property="closed" column="closed"/>
<result property="unresolved" column="Unresolved"/>
<result property="pj" column="pj"/>
<result property="h" column="h"/>
<result property="m" column="m"/>
<result property="l" column="l"/>
</resultMap>
<select id="selectRepairFloorStatsVoList" parameterType="RepairFloorStatsVo" resultMap="RepairFloorStatsVoResult">
SELECT id, name, mobile, adr, zs, process, closed, Unresolved, pj,
case when pj>0 then CONCAT(h,'',ROUND(h/pj*100,1),'%') else '00%' end as h,
case when pj>0 then CONCAT(m,'',ROUND(m/pj*100,1),'%') else '00%' end as m,
case when pj>0 then CONCAT(l,'',ROUND(l/pj*100,1),'%') else '00%' 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>
<select id="statsRepairByTime">
<![CDATA[
SELECT
count(id) zs,
sum(case when status < 7 then 1 else 0 end) wait,
sum(case when timeout is not null and timeout < 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
FROM
ics_repair
WHERE
delete_flag = 0 and creat_time between #{startTime} and #{endTime}
]]>
</select>
</mapper>