|
@@ -40,4 +40,41 @@
|
|
|
signature_img2, sparepart, parts_cost, man_cost, safety_confirm
|
|
|
</sql>
|
|
|
|
|
|
+ <!--根据公司id和电梯id获取上次保养信息 -->
|
|
|
+ <select id="findRecordByCompanyId" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.MaintenanceRecordResponse"
|
|
|
+ parameterType="cn.com.ty.lift.business.maintenance.dao.entity.model.request.MaintenanceRecordRequest">
|
|
|
+ SELECT mr.work_date AS workDate,
|
|
|
+ mr.type AS type,
|
|
|
+ mr.lift_id AS liftId,
|
|
|
+ mr.is_regular AS isRegular,
|
|
|
+ mr.safety_confirm AS safetyConfirm,
|
|
|
+ mr.maintenance_option AS maintenanceOption,
|
|
|
+ mr.stop_date AS stopDate,
|
|
|
+ mr.signature_img1 AS signatureImg1,
|
|
|
+ mr.signature_img2 AS signatureImg2,
|
|
|
+ l.device_position AS devicePosition,
|
|
|
+ p.project_name AS projectName,
|
|
|
+ mri.img_url AS imgUrl
|
|
|
+ FROM maintenance_record mr
|
|
|
+ LEFT JOIN mt_record_img mri ON mr.id = mri.mt_record_id
|
|
|
+ LEFT JOIN project p ON mr.project_id = p.id
|
|
|
+ LEFT JOIN lift l ON mr.lift_id = l.id
|
|
|
+ WHERE 1 = 1
|
|
|
+ <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
|
|
|
+ AND mr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ <if test="request.liftId!=null and request.liftId!=''">
|
|
|
+ AND mr.lift_id = #{request.liftId,jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ AND mr.work_date = (SELECT max(work_date)
|
|
|
+ FROM maintenance_record
|
|
|
+ WHERE status > 1
|
|
|
+ <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
|
|
|
+ AND mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ <if test="request.liftId!=null and request.liftId!=''">
|
|
|
+ AND lift_id = #{request.liftId,jdbcType=BIGINT}
|
|
|
+ </if>)
|
|
|
+ </select>
|
|
|
+
|
|
|
</mapper>
|