mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
95
src/main/resources/mappers/PriceMapper.xml
Normal file
95
src/main/resources/mappers/PriceMapper.xml
Normal file
@@ -0,0 +1,95 @@
|
||||
<?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.price.PriceMapper">
|
||||
<resultMap id="priceResultMap" type="PriceDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="price" property="price" />
|
||||
<result column="registration_date" property="registration_date" />
|
||||
<result column="manager_id" property="manager_id" />
|
||||
<result column="product_id" property="product_id" />
|
||||
<result column="activation" property="activation" />
|
||||
<association property="productDto" javaType="ProductDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="product_name" property="name" />
|
||||
</association>
|
||||
<association property="accountDto" javaType="AccountDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="account_name" property="name" />
|
||||
</association>
|
||||
|
||||
</resultMap>
|
||||
|
||||
<!-- insert -->
|
||||
<insert id="createProcess" parameterType="priceDto">
|
||||
INSERT INTO prices (id, price, registration_date, manager_id, product_id, activation)
|
||||
VALUES (UUID(), #{price}, curdate(), #{manager_id}, #{product_id}, 1)
|
||||
</insert>
|
||||
|
||||
<!-- update -->
|
||||
|
||||
|
||||
<!-- delete -->
|
||||
|
||||
|
||||
<!-- select -->
|
||||
<select id="priceList" resultMap="priceResultMap" parameterType="map" >
|
||||
SELECT
|
||||
p.id, p.price, p.registration_date, p.manager_id, p.product_id, p.activation,
|
||||
p.manager_id, p.activation,
|
||||
pro.name as product_name,
|
||||
a.name as account_name
|
||||
FROM prices as p
|
||||
left join product as pro on p.product_id = pro.id
|
||||
left join account as a on p.manager_id = a.id
|
||||
WHERE p.activation != 0
|
||||
ORDER BY p.registration_date limit #{start} , #{count};
|
||||
</select>
|
||||
|
||||
<!-- 네비게이션바 전용 카운터 -->
|
||||
<select id="count" parameterType="map" resultType="int">
|
||||
select count(*)
|
||||
|
||||
FROM prices as p
|
||||
left join product as pro on p.product_id = pro.id
|
||||
left join account as a on p.manager_id = a.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> p.activation = 1 and pro.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> p.activation = 1 and p.price like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> p.activation = 1 and p.registration_date like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 검색 -->
|
||||
<select id="priceList2" parameterType="map" resultMap="priceResultMap">
|
||||
SELECT
|
||||
p.id, p.price, p.registration_date, p.manager_id, p.product_id, p.activation,
|
||||
p.manager_id, p.activation,
|
||||
pro.name as product_name,
|
||||
a.name as account_name
|
||||
|
||||
FROM prices as p
|
||||
left join product as pro on p.product_id = pro.id
|
||||
left join account as a on p.manager_id = a.id
|
||||
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0"> p.activation = 1 and pro.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> p.activation = 1 and p.price like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 2"> p.activation = 1 and p.registration_date like concat('%',#{search},'%')</when>
|
||||
</choose>
|
||||
</where>
|
||||
order by p.registration_date limit #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -48,6 +48,12 @@
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="deactivateById" parameterType="String">
|
||||
UPDATE product
|
||||
SET activation = 0
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- delete -->
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</select>
|
||||
|
||||
<select id="list" parameterType="map" resultType="com.no1.wms.warehouse.WarehouseDto">
|
||||
select *
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity
|
||||
|
||||
from warehouse w
|
||||
|
||||
@@ -36,18 +36,19 @@
|
||||
|
||||
<select id="warehouseOne" parameterType="Map" resultType="Map">
|
||||
select p.name, s.quantity, w.id
|
||||
|
||||
from warehouse w
|
||||
LEFT JOIN stock s ON w.id = s.warehouse_id
|
||||
LEFT JOIN product p ON s.product_id = p.id
|
||||
|
||||
<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.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> w.activation = 1 and s.quantity like concat('%',#{search},'%') </when>
|
||||
</choose>
|
||||
</where>
|
||||
|
||||
<!-- order by p.id desc limit #{start}, #{perPage}-->
|
||||
<!-- order by p.name desc limit #{start}, #{perPage}-->
|
||||
|
||||
</select>
|
||||
|
||||
@@ -60,14 +61,14 @@
|
||||
|
||||
<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.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
||||
<when test="searchn == 1"> 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 *
|
||||
select w.id, w.name, w.capacity, w.current_capacity as currentCapacity, w.address
|
||||
|
||||
from warehouse w
|
||||
|
||||
@@ -80,16 +81,16 @@
|
||||
<!-- update -->
|
||||
<update id="updateWarehouse" parameterType="com.no1.wms.warehouse.WarehouseDto">
|
||||
update warehouse
|
||||
set capacity = #{dto.capacity}, name = #{dto.name}
|
||||
where id = #{dto.id}
|
||||
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, address, activation)
|
||||
values (UUID(), #{dto.name}, #{dto.capacity}, 0, #{dto.address}, 1)
|
||||
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>
|
||||
<!-- insert -->
|
||||
|
||||
|
||||
Reference in New Issue
Block a user