|
@@ -24,7 +24,6 @@
|
|
|
<result property="id" column="id"/>
|
|
<result property="id" column="id"/>
|
|
|
<result property="recordNo" column="record_no"/>
|
|
<result property="recordNo" column="record_no"/>
|
|
|
<result property="reportTime" column="report_time"/>
|
|
<result property="reportTime" column="report_time"/>
|
|
|
- <result property="dispatchTime" column="dispatch_time"/>
|
|
|
|
|
<result property="userName" column="user_name"/>
|
|
<result property="userName" column="user_name"/>
|
|
|
<result property="userPhone" column="user_phone"/>
|
|
<result property="userPhone" column="user_phone"/>
|
|
|
<result property="areaName" column="area_name"/>
|
|
<result property="areaName" column="area_name"/>
|
|
@@ -47,7 +46,7 @@
|
|
|
else null end as timeout_disp_str,
|
|
else null end as timeout_disp_str,
|
|
|
case date_add(rdv.receiving_time, interval rdv.maintenance_assess_time minute) <= NOW() and rr.is_duty = 0 when true then '维修超时'
|
|
case date_add(rdv.receiving_time, interval rdv.maintenance_assess_time minute) <= NOW() and rr.is_duty = 0 when true then '维修超时'
|
|
|
else null end as timeout_rece_str,
|
|
else null end as timeout_rece_str,
|
|
|
- rr.id,rr.price,rr.maintenancer_name,rr.maintenancer_phone,rr.record_no,rr.report_time,rr.dispatch_time,rr.user_name,rr.user_phone,rr.area_id
|
|
|
|
|
|
|
+ rr.id,rr.price,rr.maintenancer_name,rr.maintenancer_phone,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id
|
|
|
as area_name,rr.address,rr.description,rat.name as article_name,rr.image,rr.maintenance_state as state_id from
|
|
as area_name,rr.address,rr.description,rat.name as article_name,rr.image,rr.maintenance_state as state_id from
|
|
|
repair_record rr
|
|
repair_record rr
|
|
|
left join repair_article_type rat on rat.id = rr.article_id
|
|
left join repair_article_type rat on rat.id = rr.article_id
|
|
@@ -74,10 +73,9 @@
|
|
|
|
|
|
|
|
<select id="queryRepairTechnicianCount" resultType="com.repair.model.vo.MaintenanceTechnicianVo"
|
|
<select id="queryRepairTechnicianCount" resultType="com.repair.model.vo.MaintenanceTechnicianVo"
|
|
|
resultMap="repairRecordTechnicianMap">
|
|
resultMap="repairRecordTechnicianMap">
|
|
|
- select (select Count(*) from repair_record rr1
|
|
|
|
|
- inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.users_id = #{userId} and rdr.record_id = rr1.id and
|
|
|
|
|
- rdr.is_lose_efficacy = 0
|
|
|
|
|
- where rr1.maintenance_state = 1 and rr1.deleted = 0) as receiving_count ,(select Count(*) from repair_record rr2
|
|
|
|
|
|
|
+ select (select Count(*) from repair_record rr
|
|
|
|
|
+ inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.is_lose_efficacy = 0 and rdr.record_id = rr.id and rdr.users_id = #{userId}
|
|
|
|
|
+ where rr.deleted = 0) as receiving_count ,(select Count(*) from repair_record rr2
|
|
|
inner join repair_receiving rdv on rdv.deleted = 0 and rdv.user_id = #{userId} and rdv.record_id = rr2.id and
|
|
inner join repair_receiving rdv on rdv.deleted = 0 and rdv.user_id = #{userId} and rdv.record_id = rr2.id and
|
|
|
rdv.is_lose_efficacy = 0
|
|
rdv.is_lose_efficacy = 0
|
|
|
where rr2.maintenance_state = 2 and rr2.deleted = 0) as maintenance_count,(select Count(*) as cs from (select rr3.*
|
|
where rr2.maintenance_state = 2 and rr2.deleted = 0) as maintenance_count,(select Count(*) as cs from (select rr3.*
|
|
@@ -123,9 +121,9 @@
|
|
|
resultMap="repairRecordTechnicianDataMap">
|
|
resultMap="repairRecordTechnicianDataMap">
|
|
|
select case date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <= #{dateNow} and rr.is_duty = 0 when true then '超时未接' else null end as timeout_str,rr.id,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id as area_name,rr.address,rat.name as article_name,rr.description,rr.image,'待接单' as state
|
|
select case date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <= #{dateNow} and rr.is_duty = 0 when true then '超时未接' else null end as timeout_str,rr.id,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id as area_name,rr.address,rat.name as article_name,rr.description,rr.image,'待接单' as state
|
|
|
from repair_record rr
|
|
from repair_record rr
|
|
|
- inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.users_id = #{userId} and rdr.record_id = rr.id and rdr.is_lose_efficacy = 0
|
|
|
|
|
|
|
+ inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.users_id = #{userId} and rdr.record_id = rr.id and rdr.is_lose_efficacy = 0 and rdr.receiving_time is null
|
|
|
left join repair_article_type rat on rat.deleted = 0 and rat.id = rr.article_id
|
|
left join repair_article_type rat on rat.deleted = 0 and rat.id = rr.article_id
|
|
|
- where rr.maintenance_state = 1 and rr.deleted = 0
|
|
|
|
|
|
|
+ where (rr.maintenance_state = 1 or rr.maintenance_state = 2) and rr.deleted = 0
|
|
|
order by rr.report_time DESC
|
|
order by rr.report_time DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
@@ -264,7 +262,7 @@
|
|
|
<where>
|
|
<where>
|
|
|
and rr.deleted = 0
|
|
and rr.deleted = 0
|
|
|
<if test="schoolId != null and schoolId != ''">
|
|
<if test="schoolId != null and schoolId != ''">
|
|
|
- and rr.schoolId = #{schoolId}
|
|
|
|
|
|
|
+ and rr.school_id = #{schoolId}
|
|
|
</if>
|
|
</if>
|
|
|
<if test="stateStr != null and stateStr != ''">
|
|
<if test="stateStr != null and stateStr != ''">
|
|
|
and (rr.maintenance_state ${stateStr}
|
|
and (rr.maintenance_state ${stateStr}
|
|
@@ -348,7 +346,7 @@
|
|
|
</resultMap>
|
|
</resultMap>
|
|
|
|
|
|
|
|
<select id="queryPendingOrder" resultType="com.repair.model.vo.pendingOrderVo" resultMap="repairPendingOrderMap">
|
|
<select id="queryPendingOrder" resultType="com.repair.model.vo.pendingOrderVo" resultMap="repairPendingOrderMap">
|
|
|
- select * from (select (select Count(*) from repair_dispatch_record where is_lose_efficacy = 0 and record_id = rr.id and users_id = #{userId}) as disp_count,rr.id,rr.record_no,
|
|
|
|
|
|
|
+ select * from (select (select Count(*) from repair_dispatch_record where is_lose_efficacy = 0 and record_id = rr.id and receiving_time is null and users_id = #{userId}) as disp_count,rr.id,rr.record_no,
|
|
|
rr.report_time,rr.user_name,rr.user_phone,rr.area_id as area_name,rr.address,rat.name as article_name,rr.description,rr.image,'待接单' as state
|
|
rr.report_time,rr.user_name,rr.user_phone,rr.area_id as area_name,rr.address,rat.name as article_name,rr.description,rr.image,'待接单' as state
|
|
|
from repair_record rr
|
|
from repair_record rr
|
|
|
left join repair_article_type rat on rat.id = rr.article_id
|
|
left join repair_article_type rat on rat.id = rr.article_id
|
|
@@ -489,4 +487,84 @@
|
|
|
where rr.deleted = 0 and rr.school_id = #{schoolId} and rr.maintenance_state = 9
|
|
where rr.deleted = 0 and rr.school_id = #{schoolId} and rr.maintenance_state = 9
|
|
|
order by rr.report_time DESC
|
|
order by rr.report_time DESC
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+<!-- 报表导出获取除已超时外的其他数据获取方式-->
|
|
|
|
|
+ <select id="queryNotTimeoutReportExport" resultType="com.repair.model.vo.ReportExportVo">
|
|
|
|
|
+ select rr.user_id,1 as details,rr.id,rr.record_no,rr.area_id as area_name,rr.user_name,rr.user_phone,rat.name as
|
|
|
|
|
+ article_name,
|
|
|
|
|
+ rr.description,rr.report_time,rr.maintenancer_name,rr.maintenance_state
|
|
|
|
|
+ from repair_record rr
|
|
|
|
|
+ left join repair_article_type rat on rat.deleted = 0 and rat.id = rr.article_id
|
|
|
|
|
+ <where>
|
|
|
|
|
+ and rr.deleted = 0
|
|
|
|
|
+ <if test="schoolId != null and schoolId != ''">
|
|
|
|
|
+ and rr.school_id = #{schoolId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="stateStr != null and stateStr != ''">
|
|
|
|
|
+ and (rr.maintenance_state ${stateStr}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="keyWord != null and keyWord != ''">
|
|
|
|
|
+ and (rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%' #{keyWord} '%' or rr.user_phone like
|
|
|
|
|
+ '%' #{keyWord} '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
+ and rr.report_time between #{startTime} and #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ order by rr.report_time desc
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+ <!-- 报表导出获取除已超时数据获取方式-->
|
|
|
|
|
+ <select id="queryTimeoutReportExport" resultType="com.repair.model.vo.ReportExportVo">
|
|
|
|
|
+ SELECT * FROM (
|
|
|
|
|
+ select rr3.user_id,1 as details,rr3.id,rr3.record_no,rr3.area_id as
|
|
|
|
|
+ area_name,rr3.user_name,rr3.user_phone,rat.name as article_name,
|
|
|
|
|
+ rr3.description,rr3.report_time,rr3.maintenancer_name,rr3.maintenance_state
|
|
|
|
|
+ from repair_record rr3
|
|
|
|
|
+ left join repair_article_type rat on rat.deleted = 0 and rat.id = rr3.article_id
|
|
|
|
|
+ inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.record_id = rr3.id and
|
|
|
|
|
+ rdr.is_lose_efficacy = 0
|
|
|
|
|
+ and date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <= NOW()
|
|
|
|
|
+ <where>
|
|
|
|
|
+ and rr3.maintenance_state = 1 and rr3.deleted = 0 and rr3.is_duty = 0
|
|
|
|
|
+ <if test="keyWord != null and keyWord != ''">
|
|
|
|
|
+ and (rr3.area_id like '%' #{keyWord} '%' or rr3.user_name like '%' #{keyWord} '%' or rr3.user_phone like
|
|
|
|
|
+ '%' #{keyWord} '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
+ and rr3.report_time between #{startTime} and #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="schoolId != null and schoolId != ''">
|
|
|
|
|
+ and rr3.school_id = #{schoolId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ UNION ALL
|
|
|
|
|
+ select rr4.user_id,1 as details,rr4.id,rr4.record_no,rr4.area_id as
|
|
|
|
|
+ area_name,rr4.user_name,rr4.user_phone,rat.name as
|
|
|
|
|
+ article_name,
|
|
|
|
|
+ rr4.description,rr4.report_time,rr4.maintenancer_name,rr4.maintenance_state
|
|
|
|
|
+ from repair_record rr4
|
|
|
|
|
+ left join repair_article_type rat on rat.deleted = 0 and rat.id = rr4.article_id
|
|
|
|
|
+ inner join repair_receiving rdv on rdv.deleted = 0 and rdv.record_id = rr4.id and
|
|
|
|
|
+ rdv.is_lose_efficacy = 0
|
|
|
|
|
+ and date_add(rdv.receiving_time , interval rdv.maintenance_assess_time minute) <= NOW()
|
|
|
|
|
+ <where>
|
|
|
|
|
+ and rr4.maintenance_state = 2 and rr4.deleted = 0 and rr4.is_duty = 0
|
|
|
|
|
+ <if test="keyWord != null and keyWord != ''">
|
|
|
|
|
+ and (rr4.area_id like '%' #{keyWord} '%' or rr4.user_name like '%' #{keyWord} '%' or rr4.user_phone like
|
|
|
|
|
+ '%' #{keyWord} '%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
|
+ and rr4.report_time between #{startTime} and #{endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="schoolId != null and schoolId != ''">
|
|
|
|
|
+ and rr4.school_id = #{schoolId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ ) t
|
|
|
|
|
+ order by t.report_time desc
|
|
|
|
|
+ </select>
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
</mapper>
|
|
</mapper>
|