mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-04 19:54:00 +09:00
120 lines
6.4 KiB
XML
120 lines
6.4 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.planin.PlanInMapper">
|
|
<resultMap id="planInResultMap" type="planInDto">
|
|
<id column="group_number" property="groupNumber"/>
|
|
<id column="product_id" property="productId" />
|
|
<result column="quantity" property="quantity"/>
|
|
<result column="date" property="date"/>
|
|
<result column="manager_id" property="managerId"/>
|
|
<result column="warehouse_id" property="warehouseId"/>
|
|
<result column="qr_hash" property="qrHash"/>
|
|
<result column="url" property="url"/>
|
|
<result column="clear" property="clear"/>
|
|
<result column="vendor_date" property="vendorDate" />
|
|
<result column="other" property="other" />
|
|
<result column="activation" property="activation" />
|
|
<result column="view_group_number" property="viewGroupNumber" />
|
|
<result column="ca_name" property="caName" />
|
|
<association property="productDto" javaType="productDto">
|
|
<id column="p_id" property="id" />
|
|
<result column="p_name" property="name" />
|
|
</association>
|
|
<association property="accountDto" javaType="accountDto">
|
|
<id column="acc_id" property="id" />
|
|
<result column="acc_name" property="name" />
|
|
</association>
|
|
<association property="vendorDto" javaType="vendorDto">
|
|
<id column="v_id" property="id" />
|
|
<result column="v_name" property="name" />
|
|
</association>
|
|
<association property="warehouseDto" javaType="warehouseDto">
|
|
<id column="w_id" property="id" />
|
|
<result column="w_name" property="name" />
|
|
</association>
|
|
</resultMap>
|
|
<select id="selectById" resultMap="planInResultMap" parameterType="planInDto">
|
|
SELECT
|
|
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 plan.group_number = #{groupNumber}
|
|
</select>
|
|
<select id="selectAll" resultMap="planInResultMap" parameterType="map">
|
|
SELECT
|
|
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>
|
|
<when test="searchn == 0"> plan.activation = 1 and plan.group_number like concat('%',#{search},'%') </when>
|
|
</choose>
|
|
</where>
|
|
order by plan.group_number desc limit #{start}, #{perPage}
|
|
|
|
</select>
|
|
<insert id="insert" parameterType="planInDto">
|
|
insert into plan_In
|
|
(
|
|
group_number, product_id, quantity, date,
|
|
manager_id, warehouse_id, qr_hash,
|
|
url, clear, vendor_date, other, activation, view_group_number
|
|
)
|
|
VALUES
|
|
(
|
|
UUID(), #{productId}, #{quantity},
|
|
#{date},
|
|
#{managerId},#{warehouseId},#{qrHash},
|
|
#{url},#{clear}, #{vendor_date},
|
|
#{other},#{activation}, (select MAX(c.group_number)+1 as cnt
|
|
from ( select group_number,MAX(group_number) from plan_In group by group_number ) as c)
|
|
)
|
|
</insert>
|
|
|
|
|
|
<update id="update" parameterType="planInDto">
|
|
update plan_In SET
|
|
quantity = #{quantity},
|
|
date = #{date},
|
|
manager_id = #{managerId},
|
|
warehouse_id = #{warehouseId},
|
|
qr_hash = #{qrHash},
|
|
url = #{url},
|
|
clear = #{clear},
|
|
vendor_date = #{vendorDate},
|
|
other = #{other},
|
|
activation = #{activation},
|
|
product_id = #{productId}
|
|
WHERE group_number = #{groupNumber} and product_id = #{oldProductId}
|
|
</update>
|
|
|
|
<update id="delete" parameterType="planInDto">
|
|
update plan_In SET activation = false WHERE group_number = #{groupNumber}
|
|
</update>
|
|
<update id="deleteProduct" parameterType="planInDto">
|
|
update plan_In SET activation = false WHERE group_number = #{groupNumber} and product_id = #{productId}
|
|
</update>
|
|
<select id="count" parameterType="map" resultType="java.lang.Integer">
|
|
select count(*) from ( SELECT 1 from plan_In i join product p
|
|
<where>
|
|
<choose>
|
|
<when test="searchn == 1"> i.product_id = p.id and i.activation = 1 and p.name like concat('%',#{search},'%')</when>
|
|
<when test="searchn == 0"> i.product_id = p.id and i.activation = 1 and i.group_number like concat('%',#{search},'%') </when>
|
|
</choose>
|
|
</where>
|
|
) t
|
|
</select>
|
|
<delete id="deleteById" parameterType="planInDto">
|
|
delete from plan_In WHERE group_number = #{groupNumber}
|
|
</delete>
|
|
</mapper> |