|
|
|
@ -3112,6 +3112,147 @@ |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- ================================================= SOP清单相关SQL ================================================= --> |
|
|
|
|
|
|
|
<!-- SOP清单查询 --> |
|
|
|
<select id="sopListSearch" resultType="map"> |
|
|
|
SELECT |
|
|
|
ps.site, |
|
|
|
ps.bu_no as buNo, |
|
|
|
ps.part_no as partNo, |
|
|
|
ps.sop_no as sopNo, |
|
|
|
ps.sop_name as sopName, |
|
|
|
ps.sop_url as sopUrl, |
|
|
|
ps.version, |
|
|
|
ps.sop_status as sopStatus, |
|
|
|
ps.phase_in_date as phaseInDate, |
|
|
|
ps.phase_out_date as phaseOutDate, |
|
|
|
ps.created_by as createdBy, |
|
|
|
ps.creation_date as creationDate, |
|
|
|
ps.sop_type as sopType |
|
|
|
FROM part_sop ps |
|
|
|
<where> |
|
|
|
<if test="params.site != null and params.site != ''"> |
|
|
|
AND ps.site = #{params.site} |
|
|
|
</if> |
|
|
|
<if test="params.partNo != null and params.partNo != ''"> |
|
|
|
AND ps.part_no = #{params.partNo} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
ORDER BY ps.creation_date DESC |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 查询可用的SOP文件 --> |
|
|
|
<select id="sopAvailableFiles" resultType="map"> |
|
|
|
SELECT |
|
|
|
A.site, |
|
|
|
A.bu_no as buNo, |
|
|
|
A.file_no as fileNo, |
|
|
|
A.file_name as fileName, |
|
|
|
A.file_type as fileType, |
|
|
|
A.file_suffix as fileSuffix, |
|
|
|
A.sop_rev_no as sopRevNo, |
|
|
|
A.url_add_ress as sopUrl, |
|
|
|
A.sop_type as sopType, |
|
|
|
A.source_system as sourceSystem |
|
|
|
FROM file_management A |
|
|
|
LEFT JOIN part_sop B ON A.SITE = B.SITE AND A.BU_NO = B.BU_NO AND A.FILE_NO = B.sop_no |
|
|
|
<where> |
|
|
|
B.SITE IS NULL |
|
|
|
AND A.status_tb = 0 |
|
|
|
<if test="params.site != null and params.site != ''"> |
|
|
|
AND A.site = #{params.site} |
|
|
|
</if> |
|
|
|
<if test="params.fileNo != null and params.fileNo != ''"> |
|
|
|
AND A.file_no LIKE '%' + #{params.fileNo} + '%' |
|
|
|
</if> |
|
|
|
<if test="params.fileName != null and params.fileName != ''"> |
|
|
|
AND A.file_name LIKE '%' + #{params.fileName} + '%' |
|
|
|
</if> |
|
|
|
<if test="params.fileType != null and params.fileType != ''"> |
|
|
|
AND A.file_type LIKE '%' + #{params.fileType} + '%' |
|
|
|
</if> |
|
|
|
<if test="params.sopRevNo != null and params.sopRevNo != ''"> |
|
|
|
AND A.sop_rev_no LIKE '%' + #{params.sopRevNo} + '%' |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
ORDER BY A.file_no |
|
|
|
</select> |
|
|
|
|
|
|
|
<!-- 插入SOP记录 --> |
|
|
|
<insert id="insertSopRecord"> |
|
|
|
INSERT INTO part_sop ( |
|
|
|
site, |
|
|
|
bu_no, |
|
|
|
part_no, |
|
|
|
sop_no, |
|
|
|
sop_name, |
|
|
|
sop_url, |
|
|
|
sop_type, |
|
|
|
version, |
|
|
|
sop_status, |
|
|
|
phase_in_date, |
|
|
|
phase_out_date, |
|
|
|
created_by, |
|
|
|
creation_date |
|
|
|
) VALUES ( |
|
|
|
#{data.site}, |
|
|
|
#{data.buNo}, |
|
|
|
#{data.partNo}, |
|
|
|
#{data.sopNo}, |
|
|
|
#{data.sopName}, |
|
|
|
#{data.sopUrl}, |
|
|
|
#{data.sopType}, |
|
|
|
#{data.version}, |
|
|
|
#{data.sopStatus}, |
|
|
|
<choose> |
|
|
|
<when test="data.phaseInDate != null and data.phaseInDate != ''"> |
|
|
|
CONVERT(DATE, #{data.phaseInDate}) |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
NULL |
|
|
|
</otherwise> |
|
|
|
</choose>, |
|
|
|
<choose> |
|
|
|
<when test="data.phaseOutDate != null and data.phaseOutDate != ''"> |
|
|
|
CONVERT(DATE, #{data.phaseOutDate}) |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
NULL |
|
|
|
</otherwise> |
|
|
|
</choose>, |
|
|
|
#{data.createdBy}, |
|
|
|
<choose> |
|
|
|
<when test="data.creationDate != null and data.creationDate != ''"> |
|
|
|
CONVERT(DATE, #{data.creationDate}) |
|
|
|
</when> |
|
|
|
<otherwise> |
|
|
|
GETDATE() |
|
|
|
</otherwise> |
|
|
|
</choose> |
|
|
|
) |
|
|
|
</insert> |
|
|
|
|
|
|
|
<!-- 删除SOP记录 --> |
|
|
|
<delete id="deleteSopRecord"> |
|
|
|
DELETE FROM part_sop |
|
|
|
<where> |
|
|
|
<if test="params.site != null and params.site != ''"> |
|
|
|
AND site = #{params.site} |
|
|
|
</if> |
|
|
|
<if test="params.buNo != null and params.buNo != ''"> |
|
|
|
AND bu_no = #{params.buNo} |
|
|
|
</if> |
|
|
|
<if test="params.partNo != null and params.partNo != ''"> |
|
|
|
AND part_no = #{params.partNo} |
|
|
|
</if> |
|
|
|
<if test="params.sopNo != null and params.sopNo != ''"> |
|
|
|
AND sop_no = #{params.sopNo} |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</delete> |
|
|
|
|
|
|
|
</mapper> |
|
|
|
|
|
|
|
|
|
|
|
|