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

27 lines
1.2 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.WmsInventoryMapper">
<select id="search" resultType="com.nflg.wms.common.pojo.vo.InventoryVO">
SELECT i.*,get_binnos(s.id) AS "bin_nos"
FROM wms_inventory i
LEFT JOIN dictionary_item di ON di."value"=i.factory_no
LEFT JOIN wms_warehouse wh ON wh.factory_id=di."id"
LEFT JOIN wms_storage s ON i.material_no=s.material_no and wh."id"=s.warehouse_id
<where>
<if test="request.materialNo != null and request.materialNo!=''">
AND i.material_no=#{request.materialNo}
</if>
<if test="request.factoryNo != null and request.factoryNo!=''">
AND i.factory_no=#{request.factoryNo}
</if>
<if test="request.warehouseNo != null and request.warehouseNo!=''">
AND i.warehouse_no=#{request.warehouseNo}
</if>
<if test="request.batchNo != null and request.batchNo!=''">
AND i.batch_number= #{request.batchNo}
</if>
</where>
</select>
</mapper>