|
@@ -9,4 +9,56 @@
|
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
|
|
-->
|
|
-->
|
|
|
|
|
|
|
|
-</mapper>
|
|
|
|
|
|
|
+ <select id="getSopPage" resultType="cn.iocoder.yudao.module.iscs.controller.admin.sop.vo.SopRespVO">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ s.*,
|
|
|
|
|
+ ws.workshop_name,
|
|
|
|
|
+ wa.workarea_name,
|
|
|
|
|
+ w.workstation_name,
|
|
|
|
|
+ d.machinery_name,
|
|
|
|
|
+ any_value(di.label) as sopTypeName,
|
|
|
|
|
+ COUNT( p.record_id ) AS pointCount
|
|
|
|
|
+ FROM
|
|
|
|
|
+ isc_sop s
|
|
|
|
|
+ LEFT JOIN isc_workarea wa ON wa.id = s.workarea_id
|
|
|
|
|
+ LEFT JOIN isc_workstation w ON w.id = s.workstation_id
|
|
|
|
|
+ LEFT JOIN system_users u ON u.id = s.creator
|
|
|
|
|
+ LEFT JOIN isc_machinery d ON d.id = s.machinery_id
|
|
|
|
|
+ LEFT JOIN isc_sop_points p ON p.sop_id = s.id
|
|
|
|
|
+ LEFT JOIN system_dict_data di ON di.dict_type = "sop_type" and di.value = s.sop_type
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="dto.sopCode != null and dto.sopCode.trim != ''">
|
|
|
|
|
+ and s.sop_code like concat('%',#{dto.sopCode},'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.sopName != null and dto.sopName.trim != ''">
|
|
|
|
|
+ and s.sop_name like concat('%',#{dto.sopName},'%')
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.sopStatus != null and dto.sopStatus.trim != ''">
|
|
|
|
|
+ and s.sop_status = #{dto.sopStatus}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.workshopId != null">
|
|
|
|
|
+ and s.workshop_id = #{dto.workshopId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.workareaId != null">
|
|
|
|
|
+ and s.workarea_id = #{dto.workareaId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.sopType != null and dto.sopType.trim != ''">
|
|
|
|
|
+ and s.sop_type = #{dto.sopType}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.startTime != null and dto.startTime.trim != ''">
|
|
|
|
|
+ and s.create_time >= #{dto.startTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.endTime != null and dto.endTime.trim != ''">
|
|
|
|
|
+ and s.create_time <= #{dto.endTime}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.workstationId != null">
|
|
|
|
|
+ and s.workstation_id = #{dto.workstationId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="dto.machineryId != null">
|
|
|
|
|
+ and s.machinery_id = #{dto.machineryId}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ GROUP BY s.id
|
|
|
|
|
+ ORDER BY s.sop_index ASC, s.id DESC
|
|
|
|
|
+ </select>
|
|
|
|
|
+</mapper>
|