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

127 lines
4.7 KiB
XML
Raw Normal View History

2025-07-02 16:59:42 +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.WmsStorageMapper">
<select id="search" resultType="com.nflg.wms.common.pojo.vo.StorageVO">
SELECT *
FROM (
SELECT
s.*,
2025-07-14 11:00:09 +08:00
wh.id AS "warehouseId",
2025-07-02 16:59:42 +08:00
wh.no AS "warehouseNo",
s.bin_id,
bin.no as "binNo"
2025-07-02 16:59:42 +08:00
FROM wms_storage s
INNER JOIN wms_bin bin ON s.bin_id = bin.id
2025-07-02 16:59:42 +08:00
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
<where>
<if test="request.warehouseNo!=null and request.warehouseNo!=''">
2025-09-22 17:47:51 +08:00
and wh.no ilike concat('%', #{request.warehouseNo}, '%')
2025-07-02 16:59:42 +08:00
</if>
<if test="request.materialNo!=null and request.materialNo!=''">
2025-07-16 11:13:56 +08:00
and (s.material_no like concat('%', #{request.materialNo}, '%') or s.material_desc like concat('%',
2025-07-02 16:59:42 +08:00
#{request.materialNo}, '%'))
</if>
</where>
) t
<where>
<if test="request.binNo!=null and request.binNo!=''">
and t."binNo" like concat('%', #{request.binNo}, '%')
2025-07-02 16:59:42 +08:00
</if>
</where>
2025-09-26 18:04:00 +08:00
order by t.id desc
2025-07-02 16:59:42 +08:00
</select>
<select id="getList" resultType="com.nflg.wms.common.pojo.vo.StorageVO">
SELECT
s.*,
wh.no AS "warehouseNo",
s.bin_id,
bin.no as "binNo"
2025-07-02 16:59:42 +08:00
FROM wms_storage s
INNER JOIN wms_bin bin ON s.bin_id = bin.id
2025-07-02 16:59:42 +08:00
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
where s.id in
<foreach item="item" collection="ids" separator="," open="(" close=")">
#{item}
</foreach>
2025-09-26 18:04:00 +08:00
order by s.id desc
2025-07-02 16:59:42 +08:00
</select>
2025-07-16 11:13:56 +08:00
<select id="searchNonPage" resultType="com.nflg.wms.common.pojo.vo.StorageVO">
SELECT *
FROM (
SELECT
s.*,
wh.id AS "warehouseId",
wh.no AS "warehouseNo",
s.bin_id,
bin.no as "binNo"
2025-07-16 11:13:56 +08:00
FROM wms_storage s
INNER JOIN wms_bin bin ON s.bin_id = bin.id
2025-07-16 11:13:56 +08:00
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
<where>
<if test="request.warehouseNo!=null and request.warehouseNo!=''">
and wh.no like concat('%', #{request.warehouseNo}, '%')
</if>
<if test="request.materialNo!=null and request.materialNo!=''">
and (s.material_no like concat('%', #{request.materialNo}, '%') or s.material_desc like concat('%',
#{request.materialNo}, '%'))
</if>
</where>
) t
<where>
<if test="request.binNo!=null and request.binNo!=''">
and t."binNos" like concat('%', #{request.binNo}, '%')
</if>
</where>
2025-09-26 18:04:00 +08:00
order by t.id desc
2025-07-16 11:13:56 +08:00
</select>
2025-07-28 18:37:45 +08:00
<select id="getWarehouseNo" resultType="java.lang.String">
SELECT wh."no"
FROM wms_storage s
INNER JOIN wms_warehouse wh ON s.warehouse_id = wh."id"
INNER JOIN dictionary_item di ON wh.factory_id = di."id"
WHERE s.material_no = #{materialNo} and di."value" = #{factoryNo}
</select>
2025-07-30 18:23:29 +08:00
<select id="getBinNo" resultType="java.lang.String">
SELECT bin.no
2025-07-30 18:23:29 +08:00
FROM wms_storage s
INNER JOIN wms_bin bin ON s.bin_id = bin.id
2025-07-30 18:23:29 +08:00
INNER JOIN wms_warehouse wh ON s.warehouse_id=wh."id"
INNER JOIN dictionary_item di ON wh.factory_id=di."id"
WHERE s.material_no=#{materialNo} AND di."name"=#{factoryNo} AND wh."no"=#{warehouseNo}
</select>
2025-09-22 17:47:51 +08:00
<select id="searchNonSync" resultType="com.nflg.wms.common.pojo.vo.StorageVO">
SELECT s.id,
s.material_no,
di."value" AS "factoryNo",
wh.no AS "warehouseNo",
get_binnos(s.id) AS "binNos"
FROM wms_storage s
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
LEFT JOIN dictionary_item di ON wh.factory_id = di."id"
2025-09-26 18:04:00 +08:00
where s.sap_state != 1
order by s.id desc
2025-09-22 17:47:51 +08:00
</select>
2025-10-21 11:26:08 +08:00
<select id="getInfo" resultType="com.nflg.wms.common.pojo.vo.StorageVO">
SELECT s.*,wh.no AS "warehouseNo",di.code AS "factory_no",bin.no as "binNo"
2025-10-21 11:26:08 +08:00
FROM wms_storage s
INNER JOIN wms_bin bin ON s.bin_id = bin.id
2025-10-21 11:26:08 +08:00
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
2025-10-21 18:10:22 +08:00
left join dictionary_item di on wh.factory_id = di."id"
2025-10-21 11:26:08 +08:00
where s.id = #{id}
</select>
2025-10-22 10:11:53 +08:00
<select id="getBins" resultType="com.nflg.wms.repository.entity.WmsBin">
SELECT b.id,b."no"
FROM wms_storage_bin sb
INNER JOIN wms_bin b ON sb.bin_id=b."id"
WHERE sb.storage_id = #{id}
</select>
2025-07-02 16:59:42 +08:00
</mapper>