|
|
|
@ -2,13 +2,13 @@
|
|
|
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
|
|
|
|
|
|
|
|
|
<mapper namespace="com.glxp.api.admin.dao.inventory.InvProductDao">
|
|
|
|
|
|
|
|
|
|
<select id="filterInvProduct" parameterType="com.glxp.api.admin.req.inventory.FilterInvProductRequest"
|
|
|
|
|
resultType="com.glxp.api.admin.entity.inventory.InvProductEntity">
|
|
|
|
|
SELECT * FROM inv_product
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM inv_product
|
|
|
|
|
<where>
|
|
|
|
|
<if test="productsName != '' and productsName != null">
|
|
|
|
|
AND inv_product.productsName like concat('%',#{productsName},'%')
|
|
|
|
|
AND inv_product.productsName like concat('%', #{productsName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nameCode != '' and nameCode != null">
|
|
|
|
|
AND inv_product.nameCode = #{nameCode}
|
|
|
|
@ -17,10 +17,10 @@
|
|
|
|
|
AND inv_product.relIdFk = #{relIdFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ggxh != '' and ggxh != null">
|
|
|
|
|
AND inv_product.ggxh like concat('%',#{ggxh},'%')
|
|
|
|
|
AND inv_product.ggxh like concat('%', #{ggxh}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo != '' and batchNo != null">
|
|
|
|
|
AND inv_product.batchNo like concat('%',#{batchNo},'%')
|
|
|
|
|
AND inv_product.batchNo like concat('%', #{batchNo}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="productionDate != '' and productionDate != null">
|
|
|
|
|
AND inv_product.productionDate = #{productionDate}
|
|
|
|
@ -29,10 +29,10 @@
|
|
|
|
|
AND inv_product.expireDate = #{expireDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
|
|
|
|
|
AND inv_product.ylqxzcrbarmc like concat('%',#{ylqxzcrbarmc},'%')
|
|
|
|
|
AND inv_product.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
|
|
|
|
|
AND inv_product.zczbhhzbapzbh like concat('%',#{zczbhhzbapzbh},'%')
|
|
|
|
|
AND inv_product.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supId != '' and supId != null">
|
|
|
|
|
AND supId = #{supId}
|
|
|
|
@ -56,7 +56,6 @@
|
|
|
|
|
<if test="groupType != '' and groupType != null">
|
|
|
|
|
GROUP BY #{groupType}
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectById" parameterType="Map"
|
|
|
|
@ -64,7 +63,6 @@
|
|
|
|
|
SELECT *
|
|
|
|
|
FROM inv_product
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectByUuid" parameterType="Map"
|
|
|
|
@ -73,14 +71,14 @@
|
|
|
|
|
FROM inv_product
|
|
|
|
|
<where>
|
|
|
|
|
relIdFk = #{relIdFk}
|
|
|
|
|
and invStorageCode = #{invStorageCode}
|
|
|
|
|
and invStorageCode = #{invStorageCode}
|
|
|
|
|
<if test="supId != '' and supId != null">
|
|
|
|
|
AND supId = #{supId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supId == null">
|
|
|
|
|
AND supId is NULL
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo!='empty'">
|
|
|
|
|
<if test="batchNo != '' and batchNo != null and batchNo != 'empty'">
|
|
|
|
|
AND batchNo = #{batchNo}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo == 'empty'">
|
|
|
|
@ -96,7 +94,6 @@
|
|
|
|
|
AND invWarehouseCode is NULL
|
|
|
|
|
</if>
|
|
|
|
|
</where>
|
|
|
|
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -112,29 +109,44 @@
|
|
|
|
|
|
|
|
|
|
<select id="filterJoinInvProduct" parameterType="com.glxp.api.admin.req.inventory.FilterInvProductRequest"
|
|
|
|
|
resultType="com.glxp.api.admin.res.inventory.InvProductResponse">
|
|
|
|
|
SELECT
|
|
|
|
|
inv_product.id,
|
|
|
|
|
basic_products.cpmctymc,basic_products.nameCode,inv_product.relIdFk,basic_products.ggxh,
|
|
|
|
|
inv_product.batchNo
|
|
|
|
|
,inv_product.productionDate,inv_product.expireDate,
|
|
|
|
|
basic_products.ylqxzcrbarmc,basic_products.zczbhhzbapzbh,
|
|
|
|
|
inv_product.inCount,inv_product.outCount
|
|
|
|
|
,inv_product.reCount,inv_product.customerId,basic_corp.name companyName,inv_product.unitFk,inv_product.supId
|
|
|
|
|
,inv_warehouse.name invStorageName,inv_product.invStorageCode,inv_product.price,
|
|
|
|
|
inv_warehouse_sub.name invSubStorageName,inv_product.invWarehouseCode
|
|
|
|
|
SELECT inv_product.id,
|
|
|
|
|
basic_products.cpmctymc,
|
|
|
|
|
basic_products.nameCode,
|
|
|
|
|
inv_product.relIdFk,
|
|
|
|
|
basic_products.ggxh,
|
|
|
|
|
inv_product.batchNo
|
|
|
|
|
,
|
|
|
|
|
inv_product.productionDate,
|
|
|
|
|
inv_product.expireDate,
|
|
|
|
|
basic_products.ylqxzcrbarmc,
|
|
|
|
|
basic_products.zczbhhzbapzbh,
|
|
|
|
|
inv_product.inCount,
|
|
|
|
|
inv_product.outCount
|
|
|
|
|
,
|
|
|
|
|
inv_product.reCount,
|
|
|
|
|
inv_product.customerId,
|
|
|
|
|
basic_corp.name companyName,
|
|
|
|
|
inv_product.unitFk,
|
|
|
|
|
inv_product.supId
|
|
|
|
|
,
|
|
|
|
|
inv_warehouse.name invStorageName,
|
|
|
|
|
inv_product.invStorageCode,
|
|
|
|
|
inv_product.price,
|
|
|
|
|
inv_warehouse_sub.name invSubStorageName,
|
|
|
|
|
inv_product.invWarehouseCode
|
|
|
|
|
FROM inv_product
|
|
|
|
|
inner join basic_udirel on inv_product.relIdFk = basic_udirel.id
|
|
|
|
|
inner join basic_products on basic_udirel.uuid = basic_products.uuid
|
|
|
|
|
left join basic_corp on inv_product.supId=basic_corp.erpId
|
|
|
|
|
left join inv_warehouse on inv_warehouse.code=inv_product.invStorageCode
|
|
|
|
|
left join inv_warehouse_sub on inv_warehouse_sub.code = inv_product.invWarehouseCode
|
|
|
|
|
inner join basic_udirel on inv_product.relIdFk = basic_udirel.id
|
|
|
|
|
inner join basic_products on basic_udirel.uuid = basic_products.uuid
|
|
|
|
|
left join basic_corp on inv_product.supId = basic_corp.erpId
|
|
|
|
|
left join inv_warehouse on inv_warehouse.code = inv_product.invStorageCode
|
|
|
|
|
left join inv_warehouse_sub on inv_warehouse_sub.code = inv_product.invWarehouseCode
|
|
|
|
|
<where>
|
|
|
|
|
basic_products.diType=1
|
|
|
|
|
basic_products.diType = 1
|
|
|
|
|
<if test="cpmctymc != null and cpmctymc != ''">
|
|
|
|
|
AND basic_products.cpmctymc like concat('%',#{cpmctymc},'%')
|
|
|
|
|
AND basic_products.cpmctymc like concat('%', #{cpmctymc}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="productsName != '' and productsName != null">
|
|
|
|
|
AND inv_product.productsName like concat('%',#{productsName},'%')
|
|
|
|
|
AND inv_product.productsName like concat('%', #{productsName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nameCode != '' and nameCode != null">
|
|
|
|
|
AND basic_products.nameCode like concat('%', #{nameCode}, '%')
|
|
|
|
@ -143,10 +155,10 @@
|
|
|
|
|
AND inv_product.relIdFk = #{relIdFk}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ggxh != '' and ggxh != null">
|
|
|
|
|
AND inv_product.ggxh like concat('%',#{ggxh},'%')
|
|
|
|
|
AND inv_product.ggxh like concat('%', #{ggxh}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo != '' and batchNo != null">
|
|
|
|
|
AND inv_product.batchNo like concat('%',#{batchNo},'%')
|
|
|
|
|
AND inv_product.batchNo like concat('%', #{batchNo}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="productionDate != '' and productionDate != null">
|
|
|
|
|
AND inv_product.productionDate = #{productionDate}
|
|
|
|
@ -155,10 +167,10 @@
|
|
|
|
|
AND inv_product.expireDate = #{expireDate}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ylqxzcrbarmc != '' and ylqxzcrbarmc != null">
|
|
|
|
|
AND inv_product.ylqxzcrbarmc like concat('%',#{ylqxzcrbarmc},'%')
|
|
|
|
|
AND inv_product.ylqxzcrbarmc like concat('%', #{ylqxzcrbarmc}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="zczbhhzbapzbh != '' and zczbhhzbapzbh != null">
|
|
|
|
|
AND inv_product.zczbhhzbapzbh like concat('%',#{zczbhhzbapzbh},'%')
|
|
|
|
|
AND inv_product.zczbhhzbapzbh like concat('%', #{zczbhhzbapzbh}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="customerId != '' and customerId != null">
|
|
|
|
|
AND inv_product.customerId = #{customerId}
|
|
|
|
@ -182,7 +194,6 @@
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
|
|
|
|
|
</where>
|
|
|
|
|
<if test="groupType != '' and groupType != null">
|
|
|
|
|
GROUP BY #{groupType}
|
|
|
|
@ -194,27 +205,28 @@
|
|
|
|
|
<select id="stockStatistics" resultType="com.glxp.api.admin.res.inventory.InvProductResponse"
|
|
|
|
|
parameterType="com.glxp.api.admin.req.inventory.FilterInvProductRequest">
|
|
|
|
|
select bp.cpmctymc,
|
|
|
|
|
bp.nameCode,
|
|
|
|
|
ip.relIdFk,
|
|
|
|
|
bp.ggxh,
|
|
|
|
|
ip.batchNo,
|
|
|
|
|
ip.productionDate,
|
|
|
|
|
ip.expireDate,
|
|
|
|
|
bp.ylqxzcrbarmc,
|
|
|
|
|
bp.zczbhhzbapzbh,
|
|
|
|
|
ip.reCount,
|
|
|
|
|
ip.customerId,
|
|
|
|
|
bc.name companyName,
|
|
|
|
|
ip.unitFk,
|
|
|
|
|
ip.supId,ip.price,
|
|
|
|
|
iw.name invStorageName,
|
|
|
|
|
inCount,
|
|
|
|
|
outCount
|
|
|
|
|
bp.nameCode,
|
|
|
|
|
ip.relIdFk,
|
|
|
|
|
bp.ggxh,
|
|
|
|
|
ip.batchNo,
|
|
|
|
|
ip.productionDate,
|
|
|
|
|
ip.expireDate,
|
|
|
|
|
bp.ylqxzcrbarmc,
|
|
|
|
|
bp.zczbhhzbapzbh,
|
|
|
|
|
ip.reCount,
|
|
|
|
|
ip.customerId,
|
|
|
|
|
bc.name companyName,
|
|
|
|
|
ip.unitFk,
|
|
|
|
|
ip.supId,
|
|
|
|
|
ip.price,
|
|
|
|
|
iw.name invStorageName,
|
|
|
|
|
inCount,
|
|
|
|
|
outCount
|
|
|
|
|
from inv_product ip
|
|
|
|
|
inner join basic_udirel bu on ip.relIdFk = bu.id
|
|
|
|
|
inner join basic_products bp on bu.uuid = bp.uuid
|
|
|
|
|
left join basic_corp bc on ip.supId = bc.erpId
|
|
|
|
|
left join inv_warehouse iw on iw.code = ip.invStorageCode
|
|
|
|
|
inner join basic_udirel bu on ip.relIdFk = bu.id
|
|
|
|
|
inner join basic_products bp on bu.uuid = bp.uuid
|
|
|
|
|
left join basic_corp bc on ip.supId = bc.erpId
|
|
|
|
|
left join inv_warehouse iw on iw.code = ip.invStorageCode
|
|
|
|
|
<where>
|
|
|
|
|
bp.diType = 1
|
|
|
|
|
<if test="cpmctymc != null and cpmctymc != ''">
|
|
|
|
@ -253,13 +265,13 @@
|
|
|
|
|
insert INTO inv_product
|
|
|
|
|
(productsName, nameCode, relIdFk, ggxh, batchNo,
|
|
|
|
|
productionDate, expireDate, ylqxzcrbarmc, zczbhhzbapzbh,
|
|
|
|
|
inCount, outCount, reCount, customerId, unitFk, supId, invStorageCode, invWarehouseCode,price,updateTime)
|
|
|
|
|
inCount, outCount, reCount, customerId, unitFk, supId, invStorageCode, invWarehouseCode, price, updateTime)
|
|
|
|
|
values (#{productsName}, #{nameCode},
|
|
|
|
|
#{relIdFk}, #{ggxh}, #{batchNo},
|
|
|
|
|
#{productionDate}, #{expireDate},
|
|
|
|
|
#{ylqxzcrbarmc}, #{zczbhhzbapzbh},
|
|
|
|
|
#{inCount}, #{outCount}, #{reCount}, #{customerId}, #{unitFk}, #{supId}
|
|
|
|
|
, #{invStorageCode}, #{invWarehouseCode},#{price},#{updateTime})
|
|
|
|
|
, #{invStorageCode}, #{invWarehouseCode}, #{price}, #{updateTime})
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -272,32 +284,70 @@
|
|
|
|
|
<update id="updateInvProduct" parameterType="com.glxp.api.admin.entity.inventory.InvProductEntity">
|
|
|
|
|
UPDATE inv_product
|
|
|
|
|
<trim prefix="set" suffixOverrides=",">
|
|
|
|
|
<if test="productsName != null">productsName=#{productsName},</if>
|
|
|
|
|
<if test="nameCode != null">nameCode=#{nameCode},</if>
|
|
|
|
|
<if test="relIdFk != null">relIdFk=#{relIdFk},</if>
|
|
|
|
|
<if test="ggxh != null">ggxh=#{ggxh},</if>
|
|
|
|
|
<if test="batchNo != null">batchNo=#{batchNo},</if>
|
|
|
|
|
<if test="productionDate != null">productionDate=#{productionDate},</if>
|
|
|
|
|
<if test="expireDate != null">expireDate=#{expireDate},</if>
|
|
|
|
|
<if test="ylqxzcrbarmc != null">ylqxzcrbarmc=#{ylqxzcrbarmc},</if>
|
|
|
|
|
<if test="zczbhhzbapzbh != null">zczbhhzbapzbh=#{zczbhhzbapzbh},</if>
|
|
|
|
|
<if test="inCount != null">inCount=#{inCount},</if>
|
|
|
|
|
<if test="outCount != null">outCount=#{outCount},</if>
|
|
|
|
|
<if test="reCount != null">reCount=#{reCount},</if>
|
|
|
|
|
<if test="customerId != null">customerId=#{customerId},</if>
|
|
|
|
|
<if test="unitFk != null">unitFk=#{unitFk},</if>
|
|
|
|
|
<if test="supId != null">supId=#{supId},</if>
|
|
|
|
|
<if test="invStorageCode != null">invStorageCode=#{invStorageCode},</if>
|
|
|
|
|
<if test="invWarehouseCode != null">invWarehouseCode=#{invWarehouseCode},</if>
|
|
|
|
|
<if test="price != null">price=#{price},</if>
|
|
|
|
|
<if test="updateTime != null">updateTime=#{updateTime},</if>
|
|
|
|
|
|
|
|
|
|
<if test="productsName != null">
|
|
|
|
|
productsName=#{productsName},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="nameCode != null">
|
|
|
|
|
nameCode=#{nameCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="relIdFk != null">
|
|
|
|
|
relIdFk=#{relIdFk},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ggxh != null">
|
|
|
|
|
ggxh=#{ggxh},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="batchNo != null">
|
|
|
|
|
batchNo=#{batchNo},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="productionDate != null">
|
|
|
|
|
productionDate=#{productionDate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="expireDate != null">
|
|
|
|
|
expireDate=#{expireDate},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="ylqxzcrbarmc != null">
|
|
|
|
|
ylqxzcrbarmc=#{ylqxzcrbarmc},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="zczbhhzbapzbh != null">
|
|
|
|
|
zczbhhzbapzbh=#{zczbhhzbapzbh},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="inCount != null">
|
|
|
|
|
inCount=#{inCount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="outCount != null">
|
|
|
|
|
outCount=#{outCount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="reCount != null">
|
|
|
|
|
reCount=#{reCount},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="customerId != null">
|
|
|
|
|
customerId=#{customerId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="unitFk != null">
|
|
|
|
|
unitFk=#{unitFk},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="supId != null">
|
|
|
|
|
supId=#{supId},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invStorageCode != null">
|
|
|
|
|
invStorageCode=#{invStorageCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="invWarehouseCode != null">
|
|
|
|
|
invWarehouseCode=#{invWarehouseCode},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="price != null">
|
|
|
|
|
price=#{price},
|
|
|
|
|
</if>
|
|
|
|
|
<if test="updateTime != null">
|
|
|
|
|
updateTime=#{updateTime},
|
|
|
|
|
</if>
|
|
|
|
|
</trim>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="countByWarehouseCode" resultType="java.lang.Integer">
|
|
|
|
|
select count(*) from inv_product
|
|
|
|
|
select count(*)
|
|
|
|
|
from inv_product
|
|
|
|
|
<where>
|
|
|
|
|
<if test="warehouseCode != null and warehouseCode != ''">
|
|
|
|
|
AND invStorageCode = #{warehouseCode}
|
|
|
|
@ -308,4 +358,12 @@
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectProductInfo" resultType="com.glxp.api.admin.entity.inventory.InvProductEntity">
|
|
|
|
|
select *
|
|
|
|
|
from inv_product
|
|
|
|
|
where relIdFk = #{productId}
|
|
|
|
|
and batchNo = #{batchNo}
|
|
|
|
|
and invStorageCode = #{invStorageCode}
|
|
|
|
|
and invWarehouseCode = #{invWarehouseCode}
|
|
|
|
|
</select>
|
|
|
|
|
</mapper>
|