110 lines
4.5 KiB
XML
110 lines
4.5 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.nflg.wms.repository.mapper.WmsQrCodeMasterMapper">
|
|
|
|
<select id="search" resultType="com.nflg.wms.common.pojo.vo.QrCodeItemVO">
|
|
select a.id,
|
|
a.barcode_code,
|
|
a.barcode_type,
|
|
a.process_stage,
|
|
a.material_code,
|
|
a.material_description,
|
|
a.packaging_type,
|
|
a.unit,
|
|
a.batch_no,
|
|
a.serial_no,
|
|
a.supplier_code,
|
|
d.supplier_name,
|
|
a.po_number,
|
|
a.po_line_number,
|
|
a.factory_code,
|
|
b.name as storage_location,
|
|
c.name as bin_location,
|
|
a.last_scan_byname,
|
|
a.last_scan_time,
|
|
a.create_user_name,
|
|
a.create_time,
|
|
a.barcode_uid,
|
|
a.delivery_no,
|
|
a.delivery_line_no,
|
|
<!-- sum(case when a.packaging_type = 0 then a.quantity else f.quantity end) as quantity-->
|
|
a.quantity
|
|
from wms_qr_code_master a
|
|
left join dictionary_item x on a.factory_code=x.code
|
|
left join wms_warehouse b on a.storage_location = b."no" and x.id=b.factory_id
|
|
left join wms_bin c on a.bin_location = c."no"
|
|
left join user_supplier d on a.supplier_id = d."id"
|
|
<!-- left join wms_qr_code_master f on f.parent_barcode_id = a.id and f.process_stage = 6-->
|
|
where a.parent_barcode_id = 0
|
|
<if test="request.barcodeCode !=null and request.barcodeCode !=''">
|
|
and a.barcode_code =#{request.barcodeCode}
|
|
</if>
|
|
<if test="request.materialCode !=null and request.materialCode !=''">
|
|
and a.material_code =#{ request.materialCode}
|
|
</if>
|
|
<if test="request.startDate !=null">
|
|
and a.create_time>= #{request.startDate}
|
|
</if>
|
|
<if test="request.endDate !=null">
|
|
and a.create_time <= #{request.endDate}
|
|
</if>
|
|
<!-- group by a.id, a.barcode_code, a.barcode_type, a.process_stage, a.material_code, a.material_description,-->
|
|
<!-- a.packaging_type, a.unit, a.batch_no, a.serial_no, a.supplier_code, d.supplier_name, a.po_number,-->
|
|
<!-- a.po_line_number,-->
|
|
<!-- a.factory_code, b.name, c.name, a.last_scan_byname, a.last_scan_time, a.create_user_name,-->
|
|
<!-- a.create_time, a.barcode_uid, a.delivery_no, a.delivery_line_no-->
|
|
order by a.id desc
|
|
</select>
|
|
|
|
<select id="getChildrens" resultType="com.nflg.wms.common.pojo.vo.QrCodeItemVO">
|
|
select a.id,
|
|
a.barcode_code,
|
|
a.barcode_type,
|
|
a.process_stage,
|
|
a.material_code,
|
|
a.material_description,
|
|
a.packaging_type,
|
|
a.unit,
|
|
a.batch_no,
|
|
a.serial_no,
|
|
a.supplier_code,
|
|
d.supplier_name,
|
|
a.po_number,
|
|
a.po_line_number,
|
|
a.factory_code,
|
|
b.name as storage_location,
|
|
c.name as bin_location,
|
|
a.last_scan_byname,
|
|
a.last_scan_time,
|
|
a.create_user_name,
|
|
a.create_time,
|
|
a.barcode_uid,
|
|
a.delivery_no,
|
|
a.delivery_line_no,
|
|
a.quantity
|
|
from wms_qr_code_master a
|
|
left join dictionary_item x on a.factory_code = x.code
|
|
left join wms_warehouse b on a.storage_location = b."no" and x.id = b.factory_id
|
|
left join wms_bin c on a.bin_location = c."no"
|
|
left join user_supplier d on a.supplier_id = d."id"
|
|
where a.parent_barcode_id = #{request.id}
|
|
order by a.id desc
|
|
</select>
|
|
|
|
<select id="getChildrenWithParent" resultType="com.nflg.wms.repository.entity.WmsQrCodeMaster">
|
|
WITH RECURSIVE dept_tree AS (
|
|
SELECT *, 0 AS level
|
|
FROM wms_qr_code_master
|
|
WHERE barcode_code in
|
|
<foreach collection="qrCodes" item="code" open="(" close=")" separator=",">
|
|
#{code}
|
|
</foreach>
|
|
UNION ALL
|
|
SELECT d.*, t.level + 1
|
|
FROM wms_qr_code_master d
|
|
INNER JOIN dept_tree t ON d.parent_barcode_id = t.id
|
|
)
|
|
SELECT * FROM dept_tree
|
|
</select>
|
|
</mapper>
|