|
@@ -254,22 +254,36 @@
|
|
|
LEFT JOIN user_info ui ON re.user_id = ui.user_id
|
|
|
LEFT JOIN annual_inspection ai ON ai.lift_id = li.id AND ai.mt_company_id = plr.mt_company_id
|
|
|
AND ai.plan_date = li.annual_inspection_date AND pu.mt_company_id = ai.mt_company_id
|
|
|
- WHERE
|
|
|
- li.annual_inspection_date <= date_add(curdate(), INTERVAL 45 DAY)
|
|
|
- AND li.annual_inspection_date >= curdate() AND isnull(ai.id)
|
|
|
- <if test="request.mtCompanyId != null and request.mtCompanyId > 0">
|
|
|
- AND plr.mt_company_id = #{request.mtCompanyId}
|
|
|
- </if>
|
|
|
- <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 plr.worker_id = #{request.userId,jdbcType=BIGINT}
|
|
|
- </when>
|
|
|
- <otherwise/>
|
|
|
- </choose>
|
|
|
+ <where>
|
|
|
+ li.annual_inspection_date <= date_add(curdate(), INTERVAL 45 DAY)
|
|
|
+ AND li.annual_inspection_date >= curdate() AND isnull(ai.id)
|
|
|
+ <if test="request.mtCompanyId != null and request.mtCompanyId > 0">
|
|
|
+ AND plr.mt_company_id = #{request.mtCompanyId}
|
|
|
+ </if>
|
|
|
+ <if test="request.regionId != null and request.regionId > 0">
|
|
|
+ AND re.id = #{request.regionId}
|
|
|
+ </if>
|
|
|
+ <if test="request.projectId != null and request.projectId > 0">
|
|
|
+ AND plr.project_id = #{request.projectId}
|
|
|
+ </if>
|
|
|
+ <if test="request.workerId != null and request.workerId > 0">
|
|
|
+ AND plr.worker_id = #{request.workerId}
|
|
|
+ </if>
|
|
|
+ <if test="request.registrationCode != null and request.registrationCode !=''">
|
|
|
+ AND li.registration_code = #{request.registrationCode}
|
|
|
+ </if>
|
|
|
+ <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 plr.worker_id = #{request.userId,jdbcType=BIGINT}
|
|
|
+ </when>
|
|
|
+ <otherwise/>
|
|
|
+ </choose>
|
|
|
+ </where>
|
|
|
</select>
|
|
|
+
|
|
|
<select id="groupByRegistrationCode" resultType="cn.com.ty.lift.business.library.dao.entity.Lift">
|
|
|
SELECT
|
|
|
*
|