wms/nflg-wms-repository/src/main/resources/mapper/WmsPackageMapper.xml

72 lines
3.0 KiB
XML
Raw Normal View History

2026-02-27 11:01:07 +08:00
<?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.WmsPackageMapper">
<select id="getPackageContent" resultType="com.nflg.wms.common.pojo.vo.PackingItemPDAVO">
select a.id,
a.barcode_code,
sum(case when b.packaging_type = 0 then b.quantity else c.quantity end) as quantity,
b.material_code,
b.packaging_type,
b.po_number,
b.po_line_number,
b.delivery_no,
b.delivery_line_no,
a.create_user_name,
a.create_time,
b.unit,
b.serial_no,
b.batch_no,
b.material_description
from wms_package_item a
inner join wms_qr_code_master b on a.barcode_code = b.barcode_code and b.process_stage = 1
left join wms_qr_code_master c on b."id" = c.parent_barcode_id and c.process_stage = 1
where a.package_id = #{id}
group by a.id, a.barcode_code, b.material_code, b.packaging_type, b.po_number, b.po_line_number, b.delivery_no,
b.delivery_line_no, a.create_user_name, a.create_time, b.unit, b.serial_no, b.batch_no,
b.material_description
</select>
<select id="search" resultType="com.nflg.wms.common.pojo.vo.PackingVO">
select a.*,b.supplier_code,b.supplier_name from wms_package a
2026-03-03 16:12:55 +08:00
left join user_supplier b on a.supplier_id=b."id"
2026-02-27 11:01:07 +08:00
<where>
<if test="request.packingCode !=null and request.packingCode !=''">
and a.package_code ilike concat('%', #{request.packingCode}, '%')
</if>
<if test="request.packingName !=null and request.packingName !=''">
and a.package_name ilike concat('%', #{request.packingName}, '%')
</if>
<if test="request.supplierId !=null ">
and a.supplier_id = #{request.supplierId}
</if>
<if test="request.startDate !=null">
and a.create_time>= #{request.inStartDate}
</if>
<if test="request.endDate !=null">
and a.create_time &lt;= #{request.inEndDate}
</if>
</where>
order by a.package_type asc, a.create_time desc
</select>
<select id="getChildPackageContent" resultType="com.nflg.wms.common.pojo.vo.PackingItemPDAVO">
select id,
barcode_code,
quantity,
material_code,
packaging_type,
po_number,
po_line_number,
delivery_no,
delivery_line_no ,
create_user_name,
create_time,
unit,
serial_no,
batch_no,
material_description
from wms_qr_code_master
where parent_barcode_id = #{id}
</select>
</mapper>