|
@@ -229,7 +229,8 @@
|
|
|
</select>
|
|
|
|
|
|
<!--lift中的年检时间都是月初, 所以相隔时间(45)-->
|
|
|
- <select id="toConfirmAnnualInspection" parameterType="java.lang.Long" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftAnnualInspectionResponse">
|
|
|
+ <select id="toConfirmAnnualInspection" parameterType="cn.com.ty.lift.business.annualinspection.dto.InspectionRequest"
|
|
|
+ resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftAnnualInspectionResponse">
|
|
|
SELECT DISTINCT
|
|
|
li.id AS lift_id,
|
|
|
li.registration_code,
|
|
@@ -248,16 +249,24 @@
|
|
|
LEFT JOIN project pr ON plr.project_id = pr.id
|
|
|
LEFT JOIN region re ON re.id = pr.region_id
|
|
|
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
|
|
|
+ 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 #{days} DAY)
|
|
|
+ li.annual_inspection_date <= date_add(curdate(), INTERVAL 45 DAY)
|
|
|
AND li.annual_inspection_date >= curdate() AND isnull(ai.id)
|
|
|
- <if test="mtCompanyId != null and mtCompanyId > 0">
|
|
|
- AND plr.mt_company_id = #{mtCompanyId}
|
|
|
+ <if test="request.mtCompanyId != null and request.mtCompanyId > 0">
|
|
|
+ AND plr.mt_company_id = #{request.mtCompanyId}
|
|
|
</if>
|
|
|
- <if test="userId != null and userId > 0">
|
|
|
- AND pu.user_id = #{userId}
|
|
|
+ <if test="request.userId != null and request.userId > 0">
|
|
|
+ <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>
|
|
|
</if>
|
|
|
</select>
|
|
|
<select id="groupByRegistrationCode" resultType="cn.com.ty.lift.business.library.dao.entity.Lift">
|