|
@@ -101,6 +101,7 @@
|
|
|
<if test="request.registrationCode!=null and request.registrationCode!=''">
|
|
|
AND l.registration_code LIKE #{request.registrationCode,jdbcType=VARCHAR}
|
|
|
</if>
|
|
|
+ ORDER BY plan_date
|
|
|
</select>
|
|
|
|
|
|
<select id="queryPlanListByIds" parameterType="java.util.Map" resultMap="BaseResultMap">
|
|
@@ -135,13 +136,20 @@
|
|
|
mp.status AS status
|
|
|
FROM maintenance_plan mp
|
|
|
LEFT JOIN project p ON mp.project_id = p.id
|
|
|
- LEFT JOIN project_user pu ON p.id = pu.project_id
|
|
|
+ <if test="request.currentRoleCode == REGION_DIRECTOR ">
|
|
|
+ LEFT JOIN project_user pu ON p.id = pu.project_id
|
|
|
+ </if>
|
|
|
LEFT JOIN lift l ON mp.lift_id = l.id
|
|
|
LEFT JOIN user_info ui ON mp.worker_id = ui.user_id
|
|
|
- WHERE mp.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
- <if test="request.userId!=null">
|
|
|
- AND pu.user_id = #{request.userId,jdbcType=BIGINT}
|
|
|
- </if>
|
|
|
+ WHERE mp.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ <choose>
|
|
|
+ <when test="request.userId > 0 and request.currentRoleCode == REGION_DIRECTOR ">
|
|
|
+ AND pu.user_id = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND mp.worker_id = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
<if test="request.status!=null and request.status!=''">
|
|
|
AND mp.status = #{request.status,jdbcType=VARCHAR}
|
|
|
</if>
|
|
@@ -168,13 +176,20 @@
|
|
|
count(1) total
|
|
|
FROM maintenance_plan mp
|
|
|
LEFT JOIN project p ON mp.project_id = p.id
|
|
|
- LEFT JOIN project_user pu ON p.id = pu.project_id
|
|
|
+ <if test="request.currentRoleCode == REGION_DIRECTOR ">
|
|
|
+ LEFT JOIN project_user pu ON p.id = pu.project_id
|
|
|
+ </if>
|
|
|
LEFT JOIN lift l ON mp.lift_id = l.id
|
|
|
LEFT JOIN user_info ui ON mp.worker_id = ui.user_id
|
|
|
WHERE mp.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
- <if test="request.userId!=null">
|
|
|
- AND pu.user_id = #{request.userId,jdbcType=BIGINT}
|
|
|
- </if>
|
|
|
+ <choose>
|
|
|
+ <when test="request.userId > 0 and request.currentRoleCode == REGION_DIRECTOR ">
|
|
|
+ AND pu.user_id = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND mp.worker_id = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
<if test="request.beginTime!=null">
|
|
|
AND <![CDATA[ mp.plan_date >= #{request.beginTime}]]>
|
|
|
</if>
|