|
@@ -302,7 +302,7 @@
|
|
|
count(1)
|
|
|
FROM
|
|
|
emergency_repair er
|
|
|
- <if test="cond.currentRoleCode == 'REGION_DIRECTOR'">
|
|
|
+ <if test="cond.currentRoleCode == 'REGION_DIRECTOR' or cond.currentRoleCode == 'CLERK' ">
|
|
|
LEFT JOIN project_user pu ON er.project_id = pu.project_id AND er.mt_company_id = pu.mt_company_id
|
|
|
</if>
|
|
|
WHERE er.status = 1
|
|
@@ -310,13 +310,45 @@
|
|
|
AND er.mt_company_id = #{cond.mtCompanyId}
|
|
|
</if>
|
|
|
<choose>
|
|
|
- <when test="cond.userId != null and cond.currentRoleCode == 'REGION_DIRECTOR' ">
|
|
|
+ <when test="cond.currentRoleCode == 'REGION_DIRECTOR' or cond.currentRoleCode == 'CLERK' ">
|
|
|
AND pu.user_id = #{cond.userId,jdbcType=BIGINT}
|
|
|
</when>
|
|
|
- <when test="cond.userId != null and cond.currentRoleCode == 'ROLEMTWORK' ">
|
|
|
+ <when test="cond.currentRoleCode == 'ROLEMTWORK' ">
|
|
|
AND er.worker_id1 = #{cond.userId,jdbcType=BIGINT}
|
|
|
</when>
|
|
|
<otherwise/>
|
|
|
</choose>
|
|
|
</select>
|
|
|
+
|
|
|
+ <!--app统计急修列表待修理、执行中和已完成总数 -->
|
|
|
+ <select id="countEmergencyByUserId" resultType="cn.com.ty.lift.business.emergency.dto.EmergencyCount"
|
|
|
+ parameterType="cn.com.ty.lift.business.emergency.dto.RepairRequest">
|
|
|
+ SELECT MAX(CASE t.status WHEN '0' THEN t.total ELSE 0 END) toRepair,
|
|
|
+ MAX(CASE t.status WHEN '1' THEN t.total ELSE 0 END) processing,
|
|
|
+ MAX(CASE t.status WHEN '2' THEN t.total ELSE 0 END) complete
|
|
|
+ FROM (
|
|
|
+ SELECT count(1) total,
|
|
|
+ status
|
|
|
+ FROM emergency_repair e
|
|
|
+ LEFT JOIN platform_company_lift_relevance pc
|
|
|
+ ON e.lift_id = pc.lift_id AND pc.lift_company_status !=1 AND e.mt_company_id = pc.mt_company_id
|
|
|
+ <if test="request.currentRoleCode == 'REGION_DIRECTOR' or request.currentRoleCode == 'CLERK' ">
|
|
|
+ LEFT JOIN project_lift_relevance pl ON pl.mt_company_id = pc.mt_company_id AND pl.lift_id = e.lift_id
|
|
|
+ </if>
|
|
|
+ <if test="request.currentRoleCode == 'REGION_DIRECTOR' or request.currentRoleCode == 'CLERK' ">
|
|
|
+ LEFT JOIN project_user pu ON pl.project_id = pu.project_id AND pu.mt_company_id = pl.mt_company_id
|
|
|
+ </if>
|
|
|
+ WHERE e.mt_company_id = #{request.mtCompanyId}
|
|
|
+ AND e.status != -1 and e.`status` != 3
|
|
|
+ <choose>
|
|
|
+ <when test="request.currentRoleCode == 'REGION_DIRECTOR' or request.currentRoleCode == 'CLERK' ">
|
|
|
+ AND pu.user_id = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <when test="request.currentRoleCode == 'ROLEMTWORK' ">
|
|
|
+ AND e.worker_id1 = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <otherwise/>
|
|
|
+ </choose>
|
|
|
+ GROUP BY status) t
|
|
|
+ </select>
|
|
|
</mapper>
|