|
|
@@ -79,7 +79,7 @@
|
|
|
<resultMap type="com.repair.model.vo.MaintenanceTechnicianVo" id="repairRecordTechnicianMap">
|
|
|
<result property="receivingCount" column="receiving_count"/>
|
|
|
<result property="maintenanceCount" column="maintenance_count"/>
|
|
|
- <result property="timeoutCount" column="timeout_count"/>
|
|
|
+ <!--<result property="timeoutCount" column="timeout_count"/>-->
|
|
|
<result property="examineCount" column="examine_count"/>
|
|
|
</resultMap>
|
|
|
|
|
|
@@ -229,8 +229,9 @@
|
|
|
<result property="finishedCount" column="finished_count"/>
|
|
|
<result property="canceledCount" column="canceled_count"/>
|
|
|
<result property="closedCount" column="closed_count"/>
|
|
|
- <result property="timeoutCount" column="timeout_count"/>
|
|
|
+ <!-- <result property="timeoutCount" column="timeout_count"/>-->
|
|
|
<result property="offlineCount" column="offline_count"/>
|
|
|
+ <result property="paidCount" column="paid_count"/>
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="queryManageCount" resultType="com.repair.model.vo.RepairManageCountVo" resultMap="repairManageCountMap">
|
|
|
@@ -240,9 +241,9 @@
|
|
|
and rr.maintenance_state = 1
|
|
|
where rr.deleted = 0 and rr.maintenance_state = 1
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%'
|
|
|
- #{keyWord} '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -260,9 +261,9 @@
|
|
|
rr.maintenance_state = 2
|
|
|
where rr.deleted = 0 and rr.maintenance_state = 2
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%'
|
|
|
- #{keyWord} '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -283,9 +284,9 @@
|
|
|
</if>
|
|
|
where rr.deleted = 0 and rr.maintenance_state = 3
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%' #{keyWord}
|
|
|
- '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -297,8 +298,9 @@
|
|
|
(select Count(*) from repair_record where deleted = 0 and (maintenance_state = 5 or maintenance_state = 6 or
|
|
|
maintenance_state = 11)
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (area_id like '%' #{keyWord} '%' or user_name like '%' #{keyWord} '%' or user_phone like '%' #{keyWord}
|
|
|
- '%')
|
|
|
+ and (area_id like '%' #{keyWord} '%' or address like '%' #{keyWord} '%'
|
|
|
+ or concat(area_id,address) like concat('%',#{keyWord},'%')
|
|
|
+ or user_name like '%' #{keyWord} '%' or user_phone like '%' #{keyWord}'%')
|
|
|
</if>
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
and report_time between #{startTime} and #{endTime}
|
|
|
@@ -312,9 +314,9 @@
|
|
|
(select Count(*) from repair_record rr
|
|
|
where rr.deleted = 0 and rr.maintenance_state = 7
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%' #{keyWord}
|
|
|
- '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -329,8 +331,9 @@
|
|
|
(select Count(*) from repair_record rr
|
|
|
where rr.deleted = 0 and rr.maintenance_state = 8
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%' #{keyWord}
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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 != ''">
|
|
|
@@ -346,8 +349,9 @@
|
|
|
(select Count(*) from repair_record rr
|
|
|
where rr.deleted = 0 and rr.maintenance_state = 9
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%' #{keyWord}
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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 != ''">
|
|
|
@@ -359,41 +363,61 @@
|
|
|
<if test="maintenanceName != null and maintenanceName != ''">
|
|
|
and rr.maintenancer_name like '%' #{maintenanceName} '%'
|
|
|
</if>) as closed_count,
|
|
|
- (SELECT count(*) as cs FROM (
|
|
|
- select rdr.users_id as
|
|
|
- user_id,rr.maintenance_state,rr.article_id,rr.id,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id
|
|
|
- as area_name,rr.address,rr.description,rr.image,rr.maintenancer_name,rr.maintenancer_phone,rr.price from
|
|
|
- repair_record rr
|
|
|
- inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.record_id = rr.id and rdr.is_lose_efficacy = 0
|
|
|
- and ((date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <= NOW() and
|
|
|
- rdr.receiving_time is null) or date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <=
|
|
|
- rdr.receiving_time)
|
|
|
- where rr.is_duty = 0 and rr.maintenance_state <= 7 and rr.deleted = 0
|
|
|
- <if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or 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>
|
|
|
- <if test="schoolId != null and schoolId != ''">
|
|
|
- and rr.school_id = #{schoolId}
|
|
|
- </if>
|
|
|
- UNION
|
|
|
- select
|
|
|
- rdv.user_id,rr.maintenance_state,rr.article_id,rr.id,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id
|
|
|
- as area_name,rr.address,rr.description,rr.image,rr.maintenancer_name,rr.maintenancer_phone,rr.price from
|
|
|
- repair_record rr
|
|
|
- inner join repair_receiving rdv on rdv.deleted = 0 and rdv.record_id = rr.id and rdv.is_lose_efficacy = 0
|
|
|
- and ((date_add(rdv.receiving_time , interval rdv.maintenance_assess_time minute) <= NOW() and
|
|
|
- rdv.maintenance_assess_time is null) or date_add(rdv.receiving_time , interval rdv.maintenance_assess_time
|
|
|
- minute) <= rdv.finish_time)
|
|
|
- where rr.is_duty = 0 and rr.maintenance_state <= 7 and rr.deleted = 0
|
|
|
+<!-- (SELECT count(*) as cs FROM (-->
|
|
|
+<!-- select rdr.users_id as-->
|
|
|
+<!-- user_id,rr.maintenance_state,rr.article_id,rr.id,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id-->
|
|
|
+<!-- as area_name,rr.address,rr.description,rr.image,rr.maintenancer_name,rr.maintenancer_phone,rr.price from-->
|
|
|
+<!-- repair_record rr-->
|
|
|
+<!-- inner join repair_dispatch_record rdr on rdr.deleted = 0 and rdr.record_id = rr.id and rdr.is_lose_efficacy = 0-->
|
|
|
+<!-- and ((date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <= NOW() and-->
|
|
|
+<!-- rdr.receiving_time is null) or date_add(rdr.assigned_time , interval rdr.acceptance_assess_time minute) <=-->
|
|
|
+<!-- rdr.receiving_time)-->
|
|
|
+<!-- where rr.is_duty = 0 and rr.maintenance_state <= 7 and rr.deleted = 0-->
|
|
|
+<!-- <if test="keyWord != null and keyWord != ''">-->
|
|
|
+<!-- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'-->
|
|
|
+<!-- or concat(rr.area_id,rr.address) like concat('%',#{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>-->
|
|
|
+<!-- <if test="schoolId != null and schoolId != ''">-->
|
|
|
+<!-- and rr.school_id = #{schoolId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- UNION-->
|
|
|
+<!-- select-->
|
|
|
+<!-- rdv.user_id,rr.maintenance_state,rr.article_id,rr.id,rr.record_no,rr.report_time,rr.user_name,rr.user_phone,rr.area_id-->
|
|
|
+<!-- as area_name,rr.address,rr.description,rr.image,rr.maintenancer_name,rr.maintenancer_phone,rr.price from-->
|
|
|
+<!-- repair_record rr-->
|
|
|
+<!-- inner join repair_receiving rdv on rdv.deleted = 0 and rdv.record_id = rr.id and rdv.is_lose_efficacy = 0-->
|
|
|
+<!-- and ((date_add(rdv.receiving_time , interval rdv.maintenance_assess_time minute) <= NOW() and-->
|
|
|
+<!-- rdv.maintenance_assess_time is null) or date_add(rdv.receiving_time , interval rdv.maintenance_assess_time-->
|
|
|
+<!-- minute) <= rdv.finish_time)-->
|
|
|
+<!-- where rr.is_duty = 0 and rr.maintenance_state <= 7 and rr.deleted = 0-->
|
|
|
+<!-- <if test="keyWord != null and keyWord != ''">-->
|
|
|
+<!-- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'-->
|
|
|
+<!-- or concat(rr.area_id,rr.address) like concat('%',#{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>-->
|
|
|
+<!-- <if test="schoolId != null and schoolId != ''">-->
|
|
|
+<!-- and rr.school_id = #{schoolId}-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- ) t-->
|
|
|
+<!-- <if test="maintenanceName != null and maintenanceName != ''">-->
|
|
|
+<!-- where t.user_id in (select id from repair_user where user_name like '%' #{maintenanceName} '%' and deleted =-->
|
|
|
+<!-- 0)-->
|
|
|
+<!-- </if>-->
|
|
|
+<!-- ) as timeout_count,-->
|
|
|
+ (select Count(*) from repair_record rr
|
|
|
+ where rr.deleted = 0 and rr.maintenance_state = 10
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%'
|
|
|
- #{keyWord} '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -401,17 +425,16 @@
|
|
|
<if test="schoolId != null and schoolId != ''">
|
|
|
and rr.school_id = #{schoolId}
|
|
|
</if>
|
|
|
- ) t
|
|
|
<if test="maintenanceName != null and maintenanceName != ''">
|
|
|
- where t.user_id in (select id from repair_user where user_name like '%' #{maintenanceName} '%' and deleted =
|
|
|
- 0)
|
|
|
+ and rr.maintenancer_name like '%' #{maintenanceName} '%'
|
|
|
</if>
|
|
|
- ) as timeout_count,
|
|
|
+ ) as offline_count,
|
|
|
(select Count(*) from repair_record rr
|
|
|
- where rr.deleted = 0 and rr.maintenance_state = 10
|
|
|
+ where rr.deleted = 0 and rr.maintenance_state = 4
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like '%' #{keyWord}
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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 != ''">
|
|
|
@@ -423,7 +446,7 @@
|
|
|
<if test="maintenanceName != null and maintenanceName != ''">
|
|
|
and rr.maintenancer_name like '%' #{maintenanceName} '%'
|
|
|
</if>
|
|
|
- ) as offline_count
|
|
|
+ ) as paid_count
|
|
|
</select>
|
|
|
|
|
|
<!--管理端工单分页数据-->
|
|
|
@@ -435,6 +458,7 @@
|
|
|
<result property="userPhone" column="user_phone"/>
|
|
|
<result property="articleName" column="article_name"/>
|
|
|
<result property="areaName" column="area_name"/>
|
|
|
+ <result property="addressName" column="address"/>
|
|
|
<result property="description" column="description"/>
|
|
|
<result property="reportTime" column="report_time"/>
|
|
|
<result property="maintenancerName" column="maintenancer_name"/>
|
|
|
@@ -447,13 +471,13 @@
|
|
|
|
|
|
<!--除已超时外的其他数据获取方式-->
|
|
|
<select id="queryNotTimeout" resultType="com.repair.model.vo.RepairRecordPageVo" resultMap="repairRecordPageMap">
|
|
|
- select * from (select rr.school_id,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,(select user_name from repair_user where
|
|
|
- id = rdv.user_id and deleted = 0) as rdvName,(select user_name from repair_user where id = rdr.users_id and
|
|
|
- deleted = 0) as rdrName,(select user_name from repair_user where id = ror.user_id and
|
|
|
- deleted = 0) as rorName
|
|
|
+ select * from (select rr.school_id,rr.user_id,1 as details,rr.id,rr.record_no,
|
|
|
+ rr.area_id as area_name,rr.address,
|
|
|
+ rr.user_name,rr.user_phone,rat.name as article_name,rr.description,rr.report_time,
|
|
|
+ rr.maintenancer_name,rr.maintenance_state,
|
|
|
+ (select user_name from repair_user where id = rdv.user_id and deleted = 0) as rdvName,
|
|
|
+ (select user_name from repair_user where id = rdr.users_id and deleted = 0) as rdrName,
|
|
|
+ (select user_name from repair_user where id = ror.user_id and deleted = 0) as rorName
|
|
|
from repair_record rr
|
|
|
left join repair_receiving rdv on rdv.deleted = 0 and rdv.record_id = rr.id and rdv.is_lose_efficacy = 0 and
|
|
|
rdv.finish_time is null and rr.maintenance_state = 2
|
|
|
@@ -472,13 +496,16 @@
|
|
|
<if test="stateStr != null and stateStr != ''">
|
|
|
and (rr.maintenance_state ${stateStr}
|
|
|
</if>
|
|
|
- <if test="stateStr == null or stateStr == ''">
|
|
|
- and rr.maintenance_state != 4
|
|
|
- </if>
|
|
|
+<!-- <if test="stateStr == null or stateStr == ''">-->
|
|
|
+<!-- and rr.maintenance_state != 4-->
|
|
|
+<!-- </if>-->
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like
|
|
|
- '%' #{keyWord} '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%'
|
|
|
+ or rr.area_id like '%' #{keyWord} '%'
|
|
|
+ or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -617,7 +644,7 @@
|
|
|
<result property="maintenanceCount" column="maintenance_count"/>
|
|
|
<result property="finishedCount" column="finished_count"/>
|
|
|
<result property="logisticsCount" column="logistics_count"/>
|
|
|
- <result property="timeoutCount" column="timeout_count"/>
|
|
|
+ <!-- <result property="timeoutCount" column="timeout_count"/>-->
|
|
|
<result property="closedCount" column="closed_count"/>
|
|
|
<result property="offlineCount" column="offline_count"/>
|
|
|
</resultMap>
|
|
|
@@ -781,11 +808,16 @@
|
|
|
|
|
|
<!-- 报表导出获取除已超时外的其他数据获取方式-->
|
|
|
<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,
|
|
|
+ select rr.user_id,1 as details,rr.id,rr.record_no,rr.area_id as area_name,rr.address,
|
|
|
+ rr.user_name,rr.user_phone,rat.name as article_name,
|
|
|
+ (select name from repair_article_type where id = rat.parent_id) as repair_type,
|
|
|
+ rc.number,rc.total_price,rpr.is_success as is_paid,rrr.is_success as is_refund,
|
|
|
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
|
|
|
+ left join repair_consumables rc on rc.deleted = 0 and rr.id = rc.record_id
|
|
|
+ left join repair_pay_record rpr on rpr.deleted = 0 and rr.id = rpr.record_id
|
|
|
+ left join repair_refund_record rrr on rrr.deleted = 0 and rr.id = rrr.record_id
|
|
|
<where>
|
|
|
and rr.deleted = 0
|
|
|
<if test="schoolId != null and schoolId != ''">
|
|
|
@@ -795,9 +827,9 @@
|
|
|
and (rr.maintenance_state ${stateStr}
|
|
|
</if>
|
|
|
<if test="keyWord != null and keyWord != ''">
|
|
|
- and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.user_name like '%'
|
|
|
- #{keyWord} '%' or rr.user_phone like
|
|
|
- '%' #{keyWord} '%')
|
|
|
+ and (rr.record_no like '%' #{keyWord} '%' or rr.area_id like '%' #{keyWord} '%' or rr.address like '%' #{keyWord} '%'
|
|
|
+ or concat(rr.area_id,rr.address) like concat('%',#{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}
|
|
|
@@ -870,7 +902,7 @@
|
|
|
<result property="workCount" column="work_count"/>
|
|
|
<result property="processCount" column="process_count"/>
|
|
|
<result property="finishCount" column="finish_count"/>
|
|
|
- <result property="timeoutCount" column="timeout_count"/>
|
|
|
+ <!--<result property="timeoutCount" column="timeout_count"/>-->
|
|
|
<result property="offlineCount" column="offline_count"/>
|
|
|
</resultMap>
|
|
|
<!--说明:-->
|
|
|
@@ -998,8 +1030,16 @@
|
|
|
FROM (SELECT count(rr.area_id) AS orders_total,
|
|
|
rs.`name` AS school_name,
|
|
|
rr.area_id AS area_name,
|
|
|
- SUM(case when rr.price > 0 then 1 else 0 end) AS orders_compensation,
|
|
|
- SUM(case when rr.price IS NULL OR rr.price = 0 then 1 else 0 end) AS orders_gratis,
|
|
|
+ (SELECT COUNT(area_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ WHERE price > 0
|
|
|
+ AND rr.area_id = area_id
|
|
|
+ AND deleted = 0) AS orders_compensation,
|
|
|
+ (SELECT COUNT(area_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ WHERE (price IS NULL OR price = 0)
|
|
|
+ AND rr.area_id = area_id
|
|
|
+ AND deleted = 0) AS orders_gratis,
|
|
|
SUM(rr.price) AS total_price
|
|
|
FROM `repair_record` rr
|
|
|
LEFT JOIN repair_school rs ON rs.deleted = 0
|
|
|
@@ -1013,8 +1053,28 @@
|
|
|
FROM (SELECT count(rr.area_id) AS orders_total,
|
|
|
rs.`name` AS school_name,
|
|
|
rr.area_id AS area_name,
|
|
|
- SUM(case when rr.price > 0 then 1 else 0 end) AS orders_compensation,
|
|
|
- SUM(case when rr.price IS NULL OR rr.price = 0 then 1 else 0 end) AS orders_gratis,
|
|
|
+ (SELECT COUNT(area_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ AND price > 0
|
|
|
+ AND rr.area_id = area_id
|
|
|
+ AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_compensation,
|
|
|
+ (SELECT COUNT(area_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ AND (price IS NULL OR price = 0)
|
|
|
+ AND rr.area_id = area_id
|
|
|
+ AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_gratis,
|
|
|
SUM(rr.price) AS total_price
|
|
|
FROM `repair_record` rr
|
|
|
LEFT JOIN repair_school rs ON rs.deleted = 0
|
|
|
@@ -1022,7 +1082,7 @@
|
|
|
<where>
|
|
|
AND rr.deleted=0
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
- and rr.report_time between #{startTime} and #{endTime}
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
</if>
|
|
|
</where>
|
|
|
GROUP BY rr.area_id) ra
|
|
|
@@ -1032,8 +1092,16 @@
|
|
|
FROM (SELECT rat.`name` AS article_name,
|
|
|
rat.school_id as school_id,
|
|
|
count(rr.article_id) AS orders_total,
|
|
|
- SUM(case when rr.price > 0 then 1 else 0 end) AS orders_compensation,
|
|
|
- SUM(case when rr.price IS NULL OR rr.price = 0 then 1 else 0 end) AS orders_gratis,
|
|
|
+ (SELECT COUNT(article_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ WHERE price > 0
|
|
|
+ AND rr.article_id = article_id
|
|
|
+ AND deleted = 0) AS orders_compensation,
|
|
|
+ (SELECT COUNT(article_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ WHERE (price IS NULL OR price = 0)
|
|
|
+ AND rr.article_id = article_id
|
|
|
+ AND deleted = 0) AS orders_gratis,
|
|
|
SUM(rr.price) AS total_price
|
|
|
FROM `repair_record` rr
|
|
|
LEFT JOIN repair_article_type rat ON rr.article_id = rat.id
|
|
|
@@ -1046,8 +1114,26 @@
|
|
|
FROM (SELECT rat.`name` AS article_name,
|
|
|
rat.school_id as school_id,
|
|
|
count(rr.article_id) AS orders_total,
|
|
|
- SUM(case when rr.price > 0 then 1 else 0 end) AS orders_compensation,
|
|
|
- SUM(case when rr.price IS NULL OR rr.price = 0 then 1 else 0 end) AS orders_gratis,
|
|
|
+ (SELECT COUNT(article_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ and price > 0 AND rr.article_id = article_id AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_compensation,
|
|
|
+ (SELECT COUNT(article_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ and (price IS NULL OR price = 0)
|
|
|
+ AND rr.article_id = article_id
|
|
|
+ AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_gratis,
|
|
|
SUM(rr.price) AS total_price
|
|
|
FROM `repair_record` rr
|
|
|
LEFT JOIN repair_article_type rat ON rr.article_id = rat.id
|
|
|
@@ -1064,8 +1150,28 @@
|
|
|
FROM (SELECT count(rr.area_id) AS orders_total,
|
|
|
rs.`name` AS school_name,
|
|
|
rr.area_id AS area_name,
|
|
|
- SUM(case when rr.price > 0 then 1 else 0 end) AS orders_compensation,
|
|
|
- SUM(case when rr.price IS NULL OR rr.price = 0 then 1 else 0 end) AS orders_gratis,
|
|
|
+ (SELECT COUNT(area_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ AND price > 0
|
|
|
+ AND rr.area_id = area_id
|
|
|
+ AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_compensation,
|
|
|
+ (SELECT COUNT(area_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ AND (price IS NULL OR price = 0)
|
|
|
+ AND rr.area_id = area_id
|
|
|
+ AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_gratis,
|
|
|
SUM(rr.price) AS total_price
|
|
|
FROM `repair_record` rr
|
|
|
LEFT JOIN repair_school rs ON rs.deleted = 0
|
|
|
@@ -1084,8 +1190,26 @@
|
|
|
FROM (SELECT rat.`name` AS article_name,
|
|
|
rat.school_id as school_id,
|
|
|
count(rr.article_id) AS orders_total,
|
|
|
- SUM(case when rr.price > 0 then 1 else 0 end) AS orders_compensation,
|
|
|
- SUM(case when rr.price IS NULL OR rr.price = 0 then 1 else 0 end) AS orders_gratis,
|
|
|
+ (SELECT COUNT(article_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ and price > 0 AND rr.article_id = article_id AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_compensation,
|
|
|
+ (SELECT COUNT(article_id)
|
|
|
+ FROM `repair_record`
|
|
|
+ <where>
|
|
|
+ and (price IS NULL OR price = 0)
|
|
|
+ AND rr.article_id = article_id
|
|
|
+ AND deleted = 0
|
|
|
+ <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
+ and report_time between #{startTime} and #{endTime}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) AS orders_gratis,
|
|
|
SUM(rr.price) AS total_price
|
|
|
FROM `repair_record` rr
|
|
|
LEFT JOIN repair_article_type rat ON rat.deleted = 0
|
|
|
@@ -1362,7 +1486,12 @@
|
|
|
FROM repair_record
|
|
|
where deleted = 0
|
|
|
and maintenance_state = 4)
|
|
|
- as affirm_count
|
|
|
+ as affirm_count,
|
|
|
+ (SELECT COUNT(*)
|
|
|
+ FROM repair_record
|
|
|
+ where deleted =0
|
|
|
+ and maintenance_state = 10)
|
|
|
+ as offlineCount;
|
|
|
</select>
|
|
|
|
|
|
<!--打印-->
|