This commit is contained in:
sungsu
2024-01-28 16:42:10 +09:00
parent 5fcf22e5e8
commit 6827285122
3 changed files with 13 additions and 13 deletions

View File

@@ -43,7 +43,7 @@
left join warehouse w on o.warehouse_id = w.id
left join stock s on o.product_id = s.product_id and o.warehouse_id = s.warehouse_id
where o.id = #{id}
where o.id = #{id} and s.activation = 1
</select>
<select id="stockSelect" parameterType="Map" resultType="Map">
@@ -55,8 +55,8 @@
<where>
<choose>
<when test="searchn == 0"> o.id IS NULL and p.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> o.id IS NULL and p.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 0"> o.id IS NULL and p.activation = 1 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> o.id IS NULL and p.activation = 1 and s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose>
</where>
order by p.name desc limit #{start}, #{perPage}
@@ -71,8 +71,8 @@
<where>
<choose>
<when test="searchn == 0"> o.id IS NULL and p.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> o.id IS NULL and p.activation = 1 and w.name like concat('%',#{search},'%')</when>
<when test="searchn == 0"> o.id IS NULL and p.activation = 1 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> o.id IS NULL and p.activation = 1 and s.activation = 1 and w.name like concat('%',#{search},'%')</when>
</choose>
</where>
</select>

View File

@@ -107,7 +107,7 @@
p.company_name,
w.address,
w.capacity,
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id and s.activation = 1) AS current_capacity
from stock s
left join warehouse w on s.warehouse_id = w.id

View File

@@ -23,7 +23,7 @@
SELECT w.id,
w.name,
w.capacity,
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity
(SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id and s.activation = 1) AS current_capacity
FROM warehouse w
<where>
@@ -33,11 +33,11 @@
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
</choose>
</where>
order by w.name ASC limit #{start}, #{perPage}
order by w.name deSC limit #{start}, #{perPage}
</select>
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
select w.id, w.name, w.capacity, (SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id) AS current_capacity, w.address
select w.id, w.name, w.capacity, (SELECT SUM(s.quantity) FROM stock s WHERE s.warehouse_id = w.id and s.activation = 1) AS current_capacity, w.address
from warehouse w
@@ -53,8 +53,8 @@
<where>
<choose>
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
</choose>
</where>
@@ -71,8 +71,8 @@
<where>
<choose>
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
<when test="searchn == 0"> w.id = #{id} and w.activation = 1 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
<when test="searchn == 1"> w.id = #{id} and w.activation = 1 and s.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
</choose>
</where>
</select>