mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
140 lines
5.8 KiB
XML
140 lines
5.8 KiB
XML
<?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> |