Browse Source

refactor(warehouse): 优化HandlingUnit标签查询SQL性能

master
常熟吴彦祖 1 month ago
parent
commit
595465249e
  1. 47
      src/main/resources/mapper/warehouse/LabelQueryMapper.xml

47
src/main/resources/mapper/warehouse/LabelQueryMapper.xml

@ -62,45 +62,9 @@
</where> </where>
ORDER BY h.created_date DESC ORDER BY h.created_date DESC
</select> </select>
<!-- rqrq - 分页查询HandlingUnit标签信息(带栈板库位信息)分页解析失败强行改成嵌套sql便于解析 -->
<!-- rqrq - -->
<select id="getHandlingUnitLabelListLocation" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto"> <select id="getHandlingUnitLabelListLocation" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto">
SELECT
t.unitId,
t.site,
t.partNo,
t.partDesc,
t.batchNo,
t.locationId,
t.warehouseId,
t.qty,
t.inStockFlag,
t.status,
t.statusDb,
t.createdDate,
t.createdBy,
t.modifiedDate,
t.modifiedBy,
t.printCount,
t.lastPrintDate,
t.printerName,
t.qrCode,
t.barCode,
t.remark,
t.warehouseName,
t.locationName,
t.pallet_id,
t.station_id,
t.station_area,
t.height,
t.position,
t.layer,
t.calling_flag,
t.lastCountDate,
t.engChgLevel,
t.expiredDate,
t.receiveDate,
t.wdr
FROM (
SELECT SELECT
h.unit_id AS unitId, h.unit_id AS unitId,
h.site, h.site,
@ -143,7 +107,8 @@
LEFT JOIN pallet_detail b ON h.unit_id = b.serial_no AND h.site = b.site LEFT JOIN pallet_detail b ON h.unit_id = b.serial_no AND h.site = b.site
LEFT JOIN pallet p ON b.pallet_id = p.pallet_id AND b.site = p.site LEFT JOIN pallet p ON b.pallet_id = p.pallet_id AND b.site = p.site
LEFT JOIN agv_station s ON p.location_code = s.station_code LEFT JOIN agv_station s ON p.location_code = s.station_code
WHERE p.pallet_id IS NOT NULL
<where>
and p.pallet_id IS NOT NULL
<if test="params.site != null and params.site != ''"> <if test="params.site != null and params.site != ''">
AND h.site = #{params.site} AND h.site = #{params.site}
</if> </if>
@ -171,8 +136,8 @@
<if test="params.stationId != null and params.stationId != ''"> <if test="params.stationId != null and params.stationId != ''">
AND s.station_id LIKE '%' + #{params.stationId} + '%' AND s.station_id LIKE '%' + #{params.stationId} + '%'
</if> </if>
) t
ORDER BY t.createdDate DESC
</where>
ORDER BY h.created_date DESC
</select> </select>
<select id="getHandlingUnitLabelAll" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto"> <select id="getHandlingUnitLabelAll" resultType="com.gaotao.modules.handlingunit.entity.dto.HandlingUnitDto">
SELECT SELECT

Loading…
Cancel
Save