|
|
|
@ -260,10 +260,28 @@ |
|
|
|
LEFT JOIN resource B ON ewc.site = b.site AND d.objectid = b.resource_id |
|
|
|
LEFT JOIN view_Supplier v ON ps.site = V.Site AND ps.supplier_id = V.SupplierID |
|
|
|
WHERE ps.coreFlag = 'Y' |
|
|
|
<if test="query.site != null and query.site != ''"> |
|
|
|
and ewc.site = #{query.site} |
|
|
|
</if> |
|
|
|
<if test="query.buNo != null and query.buNo != ''"> |
|
|
|
and ewc.bu_no = #{query.buNo} |
|
|
|
</if> |
|
|
|
<if test="query.partNo != null and query.partNo != ''"> |
|
|
|
and ewc.partNo = #{query.partNo} |
|
|
|
</if> |
|
|
|
<if test="query.partDescription != null and query.partDescription != ''"> |
|
|
|
and ps.part_description like '%'+ #{query.partDescription} +'%' |
|
|
|
</if> |
|
|
|
) |
|
|
|
SELECT OrderNo, site, bu_no, partno, part_description, oldSerialNo, newSerialNo, |
|
|
|
created_date, spec, umid, remark, created_by, fault_reason, resource_id, resourceDesc,location_id,est_use_qty,lifespan,SupplierName |
|
|
|
SELECT |
|
|
|
OrderNo, site, bu_no, partno, part_description, oldSerialNo, newSerialNo, |
|
|
|
created_date, spec, umid, remark, created_by, fault_reason, resource_id, resourceDesc, |
|
|
|
location_id, est_use_qty, lifespan, SupplierName |
|
|
|
FROM ( |
|
|
|
SELECT *, |
|
|
|
ROW_NUMBER() OVER (PARTITION BY site,bu_no,partno,oldSerialNo ORDER BY created_date ASC) AS rn2 |
|
|
|
FROM ranked_records |
|
|
|
WHERE rn > 1; |
|
|
|
) AS subquery |
|
|
|
WHERE rn > 1 and rn2 = 1; |
|
|
|
</select> |
|
|
|
</mapper> |