mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 19:53:26 +09:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
140
src/main/resources/mappers/InMapper.xml
Normal file
140
src/main/resources/mappers/InMapper.xml
Normal file
@@ -0,0 +1,140 @@
|
||||
<?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.in.InMapper">
|
||||
<resultMap id="inResultMap" type="InDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="group_number" property="group_number" />
|
||||
<result column="product_id" property="product_id" />
|
||||
<result column="in_date" property="in_date" />
|
||||
<result column="quantity" property="quantity" />
|
||||
<result column="warehouse_id" property="warehouse_id" />
|
||||
<result column="manager_id" property="manager_id" />
|
||||
<result column="note" property="note" />
|
||||
<result column="activation" property="activation" />
|
||||
<result column="latest_price" property="latest_price" />
|
||||
<!-- join -->
|
||||
<association property="planInDto" javaType="PlanInDto">
|
||||
<id column="groupNumber" property="groupNumber" />
|
||||
<id column="productId" property="productId" />
|
||||
<result column="view_group_number" property="viewGroupNumber" />
|
||||
</association>
|
||||
<association property="productDto" javaType="ProductDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="product_name" property="name" />
|
||||
</association>
|
||||
<association property="warehouseDto" javaType="WarehouseDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="warehouse_name" property="name" />
|
||||
</association>
|
||||
<association property="accountDto" javaType="AccountDto">
|
||||
<id column="id" property="id" />
|
||||
<result column="account_name" property="name" />
|
||||
</association>
|
||||
|
||||
</resultMap>
|
||||
|
||||
|
||||
<!-- insert -->
|
||||
|
||||
<!-- update -->
|
||||
|
||||
<!-- delete -->
|
||||
|
||||
<!-- select -->
|
||||
<select id="count" parameterType="map" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
|
||||
FROM
|
||||
product_in as proin
|
||||
left join plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||
left join product as pro on proin.product_id = pro.id
|
||||
left join warehouse as w on proin.warehouse_id = w.id
|
||||
left join account as a on proin.manager_id = a.id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">
|
||||
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 1">
|
||||
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
<when test="searchn == 2">
|
||||
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 3">
|
||||
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="inList2" parameterType="map" resultMap="inResultMap">
|
||||
SELECT
|
||||
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
|
||||
pro.name as product_name,
|
||||
w.name as warehouse_name,
|
||||
a.name as account_name
|
||||
|
||||
FROM
|
||||
product_in as proin
|
||||
left join plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||
left join product as pro on proin.product_id = pro.id
|
||||
left join warehouse as w on proin.warehouse_id = w.id
|
||||
left join account as a on proin.manager_id = a.id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">
|
||||
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 1">
|
||||
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
<when test="searchn == 2">
|
||||
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 3">
|
||||
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY proin.in_date LIMIT #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="inList" parameterType="map" resultMap="inResultMap">
|
||||
SELECT
|
||||
proin.id, proin.group_number, proin.product_id, proin.in_date, proin.quantity, proin.warehouse_id, proin.manager_id, proin.note, proin.activation,
|
||||
planin.view_group_number,
|
||||
pro.name as product_name,
|
||||
w.name as warehouse_name,
|
||||
a.name as account_name,
|
||||
(SELECT price FROM prices WHERE product_id = proin.product_id ORDER BY registration_date DESC LIMIT 1) as latest_price
|
||||
FROM
|
||||
product_in as proin
|
||||
LEFT JOIN plan_In as planin on proin.group_number = planin.group_number and proin.product_id = planin.product_id
|
||||
LEFT JOIN product as pro on proin.product_id = pro.id
|
||||
LEFT JOIN warehouse as w on proin.warehouse_id = w.id
|
||||
LEFT JOIN account as a on proin.manager_id = a.id
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 0">
|
||||
proin.activation = 1 and proin.product_id IN (SELECT id FROM product WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 1">
|
||||
proin.activation = 1 AND proin.in_date LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
<when test="searchn == 2">
|
||||
proin.activation = 1 AND proin.manager_id IN (SELECT id FROM account WHERE name LIKE CONCAT('%',#{search},'%'))
|
||||
</when>
|
||||
<when test="searchn == 3">
|
||||
proin.activation = 1 AND proin.group_number LIKE CONCAT('%',#{search},'%')
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY proin.in_date LIMIT #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -7,7 +7,6 @@
|
||||
<id column="product_id" property="productId" />
|
||||
<result column="quantity" property="quantity"/>
|
||||
<result column="date" property="date"/>
|
||||
<result column="vendor_id" property="vendorId"/>
|
||||
<result column="manager_id" property="managerId"/>
|
||||
<result column="warehouse_id" property="warehouseId"/>
|
||||
<result column="qr_hash" property="qrHash"/>
|
||||
@@ -37,24 +36,24 @@
|
||||
</resultMap>
|
||||
<select id="selectById" resultMap="planInResultMap" parameterType="planInDto">
|
||||
SELECT
|
||||
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.vendor_id, plan.manager_id,
|
||||
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.manager_id,
|
||||
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
||||
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
||||
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
||||
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
||||
on plan.product_id = product.id and plan.vendor_id = vendor.id and plan.manager_id = acc.id
|
||||
on plan.product_id = product.id and product.vendor_id = vendor.id and plan.manager_id = acc.id
|
||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||
where plan.group_number = #{groupNumber}
|
||||
</select>
|
||||
<select id="selectAll" resultMap="planInResultMap" parameterType="map">
|
||||
SELECT
|
||||
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.vendor_id, plan.manager_id,
|
||||
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
||||
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
||||
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
||||
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
||||
on plan.product_id = product.id and plan.vendor_id = vendor.id and plan.manager_id = acc.id
|
||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||
plan.group_number, plan.product_id, plan.quantity, plan.date, plan.manager_id,
|
||||
plan.warehouse_id, plan.qr_hash, plan.url, plan.clear, plan.vendor_date, plan.other, plan.activation, plan.view_group_number,
|
||||
product.id p_id, product.name p_name, acc.id acc_id, acc.name acc_name, vendor.id v_id, vendor.name v_name,
|
||||
warehouse.id w_id, warehouse.name w_name, product_category.kan_code p_kan, product_category.cls_Nm_4 ca_name
|
||||
from plan_In plan join account acc join vendor join warehouse join product join product_category
|
||||
on plan.product_id = product.id and product.vendor_id = vendor.id and plan.manager_id = acc.id
|
||||
and plan.warehouse_id = warehouse.id and product.kan_code = product_category.kan_code
|
||||
<where>
|
||||
<choose>
|
||||
<when test="searchn == 1"> plan.activation = 1 and pn like concat('%',#{search},'%')</when>
|
||||
@@ -68,13 +67,13 @@
|
||||
insert into plan_In
|
||||
(
|
||||
group_number, product_id, quantity, date,
|
||||
vendor_id, manager_id, warehouse_id, qr_hash,
|
||||
manager_id, warehouse_id, qr_hash,
|
||||
url, clear, vendor_date, other, activation, view_group_number
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
UUID(), #{productId}, #{quantity},
|
||||
#{date}, #{vendorId},
|
||||
#{date},
|
||||
#{managerId},#{warehouseId},#{qrHash},
|
||||
#{url},#{clear}, #{vendor_date},
|
||||
#{other},#{activation}, (select MAX(c.group_number)+1 as cnt
|
||||
@@ -87,7 +86,6 @@
|
||||
update plan_In SET
|
||||
quantity = #{quantity},
|
||||
date = #{date},
|
||||
vendor_id = #{vendorId},
|
||||
manager_id = #{managerId},
|
||||
warehouse_id = #{warehouseId},
|
||||
qr_hash = #{qrHash},
|
||||
@@ -116,4 +114,7 @@
|
||||
</where>
|
||||
) t
|
||||
</select>
|
||||
<delete id="deleteById" parameterType="planInDto">
|
||||
delete from plan_In WHERE group_number = #{groupNumber}
|
||||
</delete>
|
||||
</mapper>
|
||||
@@ -32,7 +32,7 @@
|
||||
<!-- update -->
|
||||
<update id="updateById" parameterType="PriceDto">
|
||||
UPDATE prices
|
||||
SET price = #{price}, registration_date = CURDATE()
|
||||
SET price = #{price}, manager_id = #{manager_id}, registration_date = CURDATE()
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
</when>
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY p.registration_date LIMIT #{start} , #{perPage}
|
||||
ORDER BY p.registration_date desc LIMIT #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
<select id="count2" parameterType="map" resultType="int">
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
|
||||
</choose>
|
||||
</where>
|
||||
ORDER BY p.registration_date LIMIT #{start} , #{perPage}
|
||||
ORDER BY p.registration_date desc LIMIT #{start} , #{perPage}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user