127 lines
4.7 KiB
XML
127 lines
4.7 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.WmsStorageMapper">
|
|
|
|
<select id="search" 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"
|
|
FROM wms_storage s
|
|
INNER JOIN wms_bin bin ON s.bin_id = bin.id
|
|
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
|
|
<where>
|
|
<if test="request.warehouseNo!=null and request.warehouseNo!=''">
|
|
and wh.no ilike 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."binNo" like concat('%', #{request.binNo}, '%')
|
|
</if>
|
|
</where>
|
|
order by t.id desc
|
|
</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"
|
|
FROM wms_storage s
|
|
INNER JOIN wms_bin bin ON s.bin_id = bin.id
|
|
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>
|
|
order by s.id desc
|
|
</select>
|
|
|
|
<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"
|
|
FROM wms_storage s
|
|
INNER JOIN wms_bin bin ON s.bin_id = bin.id
|
|
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>
|
|
order by t.id desc
|
|
</select>
|
|
|
|
<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>
|
|
|
|
<select id="getBinNo" resultType="java.lang.String">
|
|
SELECT bin.no
|
|
FROM wms_storage s
|
|
INNER JOIN wms_bin bin ON s.bin_id = bin.id
|
|
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>
|
|
|
|
<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"
|
|
where s.sap_state != 1
|
|
order by s.id desc
|
|
</select>
|
|
|
|
<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"
|
|
FROM wms_storage s
|
|
INNER JOIN wms_bin bin ON s.bin_id = bin.id
|
|
LEFT JOIN wms_warehouse wh ON s.warehouse_id = wh.id
|
|
left join dictionary_item di on wh.factory_id = di."id"
|
|
where s.id = #{id}
|
|
</select>
|
|
|
|
<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>
|
|
</mapper>
|