|
@@ -50,28 +50,42 @@
|
|
|
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"
|
|
|
+ <!--根据公司id和电梯id项目名称、项目id、电梯位置 -->
|
|
|
+ <select id="findProjectByCompanyId" 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,
|
|
|
- l.device_position AS devicePosition,
|
|
|
- p.project_name AS projectName,
|
|
|
- p.id AS projectId
|
|
|
- FROM maintenance_record mr
|
|
|
- LEFT JOIN project p ON mr.project_id = p.id
|
|
|
- LEFT JOIN lift l ON mr.lift_id = l.id
|
|
|
+ SELECT l.id AS liftId,
|
|
|
+ l.device_position AS devicePosition,
|
|
|
+ p.project_name AS projectName,
|
|
|
+ p.id AS projectId
|
|
|
+ FROM project_lift_relevance plr
|
|
|
+ LEFT JOIN project p ON plr.project_id = p.id
|
|
|
+ LEFT JOIN lift l ON plr.lift_id = l.id
|
|
|
WHERE 1 = 1
|
|
|
<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
|
|
|
- AND mr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ <if test="request.liftId!=null and request.liftId!=''">
|
|
|
+ AND plr.lift_id = #{request.liftId,jdbcType=BIGINT}
|
|
|
</if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <!--根据公司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 work_date AS workDate,
|
|
|
+ type AS type,
|
|
|
+ lift_id AS liftId
|
|
|
+ FROM maintenance_record
|
|
|
+ WHERE 1=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 mr.lift_id = #{request.liftId,jdbcType=BIGINT}
|
|
|
+ AND lift_id = #{request.liftId,jdbcType=BIGINT}
|
|
|
</if>
|
|
|
- AND mr.work_date = (SELECT max(work_date)
|
|
|
- FROM maintenance_record
|
|
|
- WHERE status > 1
|
|
|
+ AND 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>
|