mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
#update
/stock/create.jsp /warehouse/create.jsp /stock/list.jsp /warehouse/list.jsp /warehouse/read.jsp StockController.java StockDto.java StockMapper.xml StockMapper.java StockService.java VendorDto.java WarehouseMapper.xml WarehouseController.java #insert /vendor/create.jsp /vendor/list.jsp product_category_company_search.jsp /stock/read.jsp /vendor/read.jsp /stock/update.jsp /vendor/update.jsp VendorController.java VendorMapper.java VendorMapper.xml VendorService.java warehouse_capacity_currentCapacity.jsp
This commit is contained in:
@@ -3,55 +3,188 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.no1.wms.stock.StockMapper">
|
||||
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(*) from stock left join warehouse on stock.warehouse_id = warehouse.id left join product on stock.product_id = product.id left join product_category on product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> stock.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> stock.activation = 1 and product_category.cls_Nm_4 like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by stock.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="java.lang.Integer">
|
||||
select * from stock left join warehouse on stock.warehouse_id = warehouse.id left join product on stock.product_id = product.id left join product_category on product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> stock.activation = 1 and product.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> stock.activation = 1 and product_category.cls_Nm_4 like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
order by stock.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="stockOne" parameterType="String" resultType="com.no1.wms.stock.StockDto">
|
||||
selct * from stock where id = #{id}
|
||||
</select>
|
||||
<!-- select -->
|
||||
|
||||
|
||||
<!-- update -->
|
||||
<update id="updateStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
update stock
|
||||
set quantity = #{dto.quantity}
|
||||
where id = #{dto.id}
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
||||
values (#{dto.id}, #{dto.warehouse_id}, #{dto.product_id}, #{dto.quantity}, 1)
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(s.id)
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteStock" parameterType="String">
|
||||
delete from stock where no = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1">s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2">s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="count2" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(s.id)
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="list2" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> quantity <= 200 and s.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> quantity <= 200 and s.activation = 1 and c.cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> quantity <= 200 and s.activation = 1 and s.quantity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by s.id desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="stockOne" parameterType="Map" resultType="Map">
|
||||
select s.id as id, s.warehouse_id as warehouseId, s.product_id as productId, s.quantity, p.name as productName, p.kan_code, c.cls_nm_4, w.name as warehouseName, p.company_name, w.address, w.capacity, w.current_capacity
|
||||
|
||||
from stock s
|
||||
left join warehouse w on s.warehouse_id = w.id
|
||||
left join product p on s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
|
||||
where s.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="productSelect" parameterType="Map" resultType="Map">
|
||||
SELECT p.id as productId, name, company_name, cls_Nm_4
|
||||
FROM product p
|
||||
LEFT JOIN stock s ON s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and p.activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and p.activation = 1 and cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> s.id IS NULL and p.activation = 1 and company_name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by name desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="productCount" parameterType="Map" resultType="java.lang.Integer">
|
||||
SELECT count(name)
|
||||
FROM product p
|
||||
LEFT JOIN stock s ON s.product_id = p.id
|
||||
left join product_category c on p.kan_code = c.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and p.activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and p.activation = 1 and cls_Nm_4 like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> s.id IS NULL and p.activation = 1 and company_name like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="warehouseSelect" parameterType="Map" resultType="Map">
|
||||
select w.id as warehouseId, w.name as warehouseName, capacity, current_capacity ,address
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by w.name desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="warehouseCount" parameterType="Map" resultType="java.lang.Integer">
|
||||
select count(w.id)
|
||||
from warehouse w
|
||||
left join stock s on s.warehouse_id = w.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> s.id IS NULL and w.activation = 1 and w.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> s.id IS NULL and w.activation = 1 and capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
<!-- select -->
|
||||
|
||||
|
||||
<!-- update -->
|
||||
<update id="updateStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
update stock
|
||||
set warehouse_id = #{warehouseId}, quantity = #{quantityAdjustment}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateWarehousePlus" parameterType="com.no1.wms.stock.StockDto">
|
||||
update warehouse w
|
||||
left join stock s on w.id = s.warehouse_id
|
||||
set w.current_capacity = w.current_capacity + #{quantity}
|
||||
where w.id = #{warehouseId};
|
||||
</update>
|
||||
|
||||
<update id="updateWarehouse" parameterType="com.no1.wms.stock.StockDto">
|
||||
update warehouse w
|
||||
left join stock s on w.id = s.warehouse_id
|
||||
set w.current_capacity = w.current_capacity + (#{quantityAdjustment} - #{quantity})
|
||||
where w.id = #{warehouseId};
|
||||
</update>
|
||||
|
||||
<update id="updateWarehouseDeleteStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
update warehouse
|
||||
set current_capacity = current_capacity - #{quantity}
|
||||
where id = #{warehouseId};
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
insert into stock (id, warehouse_id, product_id, quantity, activation)
|
||||
values (UUID(), #{warehouseId}, #{productId}, #{quantity}, #{activation})
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteStock" parameterType="com.no1.wms.stock.StockDto">
|
||||
delete
|
||||
from stock
|
||||
where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
</mapper>
|
||||
106
src/main/resources/mappers/VendorMapper.xml
Normal file
106
src/main/resources/mappers/VendorMapper.xml
Normal file
@@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTO Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.no1.wms.vendor.VendorMapper">
|
||||
|
||||
|
||||
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
||||
select count(name)
|
||||
|
||||
from vendor
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> activation = 1 and president_telephone like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 2"> activation = 1 and vendor_manager like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3"> activation = 1 and vendor_manager_telephone like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="VendorDto">
|
||||
select id,
|
||||
name,
|
||||
president_name as presidentName,
|
||||
address,
|
||||
registration_number as registrationNumber,
|
||||
email,
|
||||
president_telephone as presidentTelephone,
|
||||
vendor_manager as vendorManager,
|
||||
vendor_manager_telephone as vendorManagerTelephone,
|
||||
main_product as mainProduct,
|
||||
manager_id as managerId,
|
||||
activation
|
||||
|
||||
from vendor
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> activation = 1 and name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> activation = 1 and president_telephone like concat('%',#{search},'%') </when>
|
||||
<when test="searchn == 2"> activation = 1 and vendor_manager like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 3"> activation = 1 and vendor_manager_telephone like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
order by name desc limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="vendorOne" parameterType="String" resultType="VendorDto">
|
||||
select id,
|
||||
name,
|
||||
president_name as presidentName,
|
||||
address,
|
||||
registration_number as registrationNumber,
|
||||
email,
|
||||
president_telephone as presidentTelephone,
|
||||
vendor_manager as vendorManager,
|
||||
vendor_manager_telephone as vendorManagerTelephone,
|
||||
main_product as mainProduct,
|
||||
manager_id as managerId,
|
||||
activation
|
||||
|
||||
from vendor
|
||||
|
||||
where id = #{id}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- select -->
|
||||
|
||||
|
||||
<!-- update -->
|
||||
<update id="updateVendor" parameterType="VendorDto">
|
||||
update vendor
|
||||
set name = #{name},
|
||||
president_name = #{presidentName},
|
||||
address = #{address},
|
||||
registration_number = #{registrationNumber},
|
||||
email = #{email},
|
||||
president_telephone = #{presidentTelephone},
|
||||
vendor_manager = #{vendorManager},
|
||||
vendor_manager_telephone = #{vendorManagerTelephone},
|
||||
main_product = #{mainProduct},
|
||||
manager_id = #{managerId},
|
||||
activation = #{activation}
|
||||
where id = #{id}
|
||||
</update>
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createVendor" parameterType="VendorDto">
|
||||
insert into vendor (id, name, president_name, address, registration_number, email, president_telephone, vendor_manager, vendor_manager_telephone, main_product, manager_id, activation)
|
||||
values (UUID(), #{name}, #{presidentName}, #{address}, #{registrationNumber}, #{email}, #{presidentTelephone}, #{vendorManager}, #{vendorManagerTelephone}, #{mainProduct}, #{managerId}, #{activation})
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
<!-- delete -->
|
||||
<delete id="deleteVendor" parameterType="String">
|
||||
delete from vendor where id = #{id}
|
||||
</delete>
|
||||
<!-- delete -->
|
||||
</mapper>
|
||||
@@ -31,7 +31,15 @@
|
||||
<when test="searchn == 2"> w.activation = 1 and w.current_capacity like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by w.id desc limit #{start}, #{perPage}
|
||||
order by w.name ASC limit #{start}, #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
where w.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="warehouseOne" parameterType="Map" resultType="Map">
|
||||
@@ -43,8 +51,8 @@
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
<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>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
@@ -61,19 +69,12 @@
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> w.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
<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>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="One" parameterType="String" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
where w.id = #{dto.id}
|
||||
</select>
|
||||
|
||||
<!-- select -->
|
||||
|
||||
@@ -84,13 +85,14 @@
|
||||
set capacity = #{capacity}, name = #{name}, address = #{address}
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
||||
insert into warehouse (id, name, capacity, current_capacity as currentCapacity, manager_id as managerId, address, activation)
|
||||
values (UUID(), #{dto.name}, #{dto.capacity}, 0, #{dto.managerId}, #{dto.address}, 1)
|
||||
insert into warehouse (id, name, capacity, current_capacity, manager_id, address, activation)
|
||||
values (UUID(), #{name}, #{capacity}, #{currentCapacity}, #{managerId}, #{address}, #{activation})
|
||||
</insert>
|
||||
<!-- insert -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user