|
@@ -248,21 +248,29 @@
|
|
|
|
|
|
<select id="countDoingByUser" resultType="java.lang.Long" parameterType="cn.com.ty.lift.business.common.CommonRequest">
|
|
|
SELECT
|
|
|
- count(*)
|
|
|
+ count(1)
|
|
|
FROM
|
|
|
annual_inspection ai
|
|
|
+ LEFT JOIN platform_company_lift_relevance pc
|
|
|
+ ON ai.lift_id = pc.lift_id AND pc.lift_company_status !=1 AND ai.mt_company_id = pc.mt_company_id
|
|
|
+ <if test="cond.currentRoleCode == 'REGION_DIRECTOR' or cond.currentRoleCode == 'CLERK' or cond.currentRoleCode == 'ROLEMTWORK' ">
|
|
|
+ LEFT JOIN project_lift_relevance plr ON plr.mt_company_id = pc.mt_company_id AND plr.lift_id = ai.lift_id AND plr.delete_flag = '0'
|
|
|
+ </if>
|
|
|
<if test="cond.currentRoleCode == 'REGION_DIRECTOR' or cond.currentRoleCode == 'CLERK' ">
|
|
|
- LEFT JOIN project_lift_relevance plr ON plr.mt_company_id = ai.mt_company_id AND plr.lift_id = ai.lift_id
|
|
|
- LEFT JOIN project_user pu ON pu.project_id = plr.project_id AND pu.mt_company_id = ai.mt_company_id
|
|
|
+ LEFT JOIN project_user pu ON plr.project_id = pu.project_id AND pu.mt_company_id = plr.mt_company_id
|
|
|
</if>
|
|
|
WHERE
|
|
|
ai.`status` = 0
|
|
|
- <if test="cond.currentRoleCode == 'REGION_DIRECTOR' or cond.currentRoleCode == 'CLERK'">
|
|
|
- AND pu.user_id = #{cond.userId}
|
|
|
- </if>
|
|
|
- <if test="cond.mtCompanyId != null and cond.mtCompanyId > 0">
|
|
|
AND ai.mt_company_id = #{cond.mtCompanyId}
|
|
|
- </if>
|
|
|
+ <choose>
|
|
|
+ <when test="cond.currentRoleCode == 'REGION_DIRECTOR' or cond.currentRoleCode == 'CLERK' ">
|
|
|
+ AND pu.user_id = #{cond.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <when test="cond.currentRoleCode == 'ROLEMTWORK' ">
|
|
|
+ AND plr.worker_id = #{cond.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <otherwise/>
|
|
|
+ </choose>
|
|
|
</select>
|
|
|
|
|
|
<!--app统计年检列表待确认总数 -->
|