3/7 优化2.0

dev_2.5_ocean
wangwei 4 months ago
parent 5b743e664f
commit 41b6587e23

@ -2,36 +2,51 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.inv.InvPlaceOrderDao">
<select id="filterList" resultType="com.glxp.api.res.inv.InvPlaceOrderResponse">
select t.recordId,
t.type,
t.orderId,
t2.invCode,
t2.invSpaceCode,
t.createUser,
t2.count as count,
(select employeeName from auth_user where id = t.createUser) operatorName,
(select name from auth_warehouse where code = t2.invCode) invName,
(select name from auth_space where code = t2.invSpaceCode) invSpaceName,
(select name from auth_space where code = t2.topInvSpaceCode) topInvSpaceName,
t.createTime,
t2.code,
t2.batchNo,
t2.relId,
bp.cpmctymc productName,
bp.ggxh,
t2.produceDate productionDate,
t2.expireDate,
bp.nameCode,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
(select name from basic_corp where erpId = t2.supId) supName,
t2.serialNo,
bp.manufactory,
bp.measname
from inv_place_order t
right join inv_place_order_detail t2 on t.recordId = t2.recordId
left join basic_udirel bu on bu.id = t2.relId
left join basic_products bp on bp.uuid = bu.uuid
SELECT
t.recordId,
t.type,
t.orderId,
t2.invCode,
t2.invSpaceCode,
t.createUser,
t2.count AS detailCount,
au.employeeName AS operatorName,
aw.name AS invName,
as1.name AS invSpaceName,
as2.name AS topInvSpaceName,
t.createTime,
t2.code,
t2.batchNo,
t2.relId,
bp.cpmctymc AS productName,
bp.ggxh,
t2.produceDate AS productionDate,
t2.expireDate,
bp.nameCode,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bc.name AS supName,
t2.serialNo,
bp.manufactory,
bp.measname
FROM
inv_place_order_detail t2
LEFT JOIN
inv_place_order t ON t.recordId = t2.recordId
LEFT JOIN
basic_udirel bu ON bu.id = t2.relId
LEFT JOIN
basic_products bp ON bp.uuid = bu.uuid
LEFT JOIN
auth_user au ON au.id = t.createUser
LEFT JOIN
auth_warehouse aw ON aw.code = t2.invCode
LEFT JOIN
auth_space as1 ON as1.code = t2.invSpaceCode
LEFT JOIN
auth_space as2 ON as2.code = t2.topInvSpaceCode
LEFT JOIN
basic_corp bc ON bc.erpId = t2.supId
<where>
<if test="recordId != null and recordId != ''">
and t.recordId like concat('%', #{recordId}, '%')

@ -16,12 +16,13 @@
bp.manufactory,
asp.NAME AS invSpaceName,
bp.nameCode,
( SELECT NAME FROM basic_corp WHERE erpId = a1.supId ) supName
bc.namw as supName
FROM
inv_place_order_detail a1
LEFT JOIN basic_udirel bu ON bu.id = a1.relId
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
LEFT JOIN auth_space asp ON a1.invSpaceCode = asp.`code`
LEFT JOIN basic_corp bc ON bc.erpId = a1.supId
<where>
<if test="recordId != null and recordId != ''">
AND a1.recordId = #{recordId}
@ -31,4 +32,4 @@
</select>
</mapper>
</mapper>

@ -151,17 +151,24 @@
</select>
<select id="getInvPlaceOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select ipd.orderId billNo,
(select name from basic_bussiness_type where action = o.action) billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
(select employeeName from auth_user where id = o.reviewUser) reviewUserName
from inv_prein_product_detail ipd
left join io_order o on ipd.orderId = o.billNo
SELECT
ipd.orderId AS billNo,
bbt.name AS billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
au.employeeName AS reviewUserName
FROM
inv_prein_product_detail ipd
LEFT JOIN
io_order o ON ipd.orderId = o.billNo
LEFT JOIN
basic_bussiness_type bbt ON bbt.action = o.action
LEFT JOIN
auth_user au ON au.id = o.reviewUser
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
@ -182,25 +189,37 @@
</select>
<select id="filterSpaceList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
SELECT t1.nameCode,
t1.relId,
(SELECT NAME FROM auth_dept WHERE auth_dept.`code` = t1.deptCode) AS deptName,
(SELECT NAME FROM auth_warehouse WHERE auth_warehouse.`code` = t1.invCode) AS invName,
(SELECT NAME FROM auth_space WHERE auth_space.`code` = t1.invSpaceCode) AS invSpaceName,
SUM(t1.reCount) as count,
bp.cpmctymc as productName,
bp.ggxh,
t1.batchNo,
t1.produceDate as productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
(SELECT `name` FROM basic_corp WHERE erpId = t1.supId) supName
FROM inv_prein_product_detail t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relId
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
SELECT
t1.nameCode,
t1.relId,
ad.NAME AS deptName,
aw.NAME AS invName,
asp.NAME AS invSpaceName,
SUM(t1.reCount) AS count,
bp.cpmctymc AS productName,
bp.ggxh,
t1.batchNo,
t1.produceDate AS productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
bc.NAME AS supName
FROM
inv_prein_product_detail t1
LEFT JOIN
basic_udirel bu ON bu.id = t1.relId
LEFT JOIN
basic_products bp ON bp.uuid = bu.uuid
LEFT JOIN
auth_dept ad ON ad.code = t1.deptCode
LEFT JOIN
auth_warehouse aw ON aw.code = t1.invCode
LEFT JOIN
auth_space asp ON asp.code = t1.invSpaceCode
LEFT JOIN
basic_corp bc ON bc.erpId = t1.supId
<where>
<if test="code != null and code != ''">
AND t1.code = #{code}
@ -211,8 +230,8 @@
AND t1.invSpaceCode = #{invSpaceCode}
</if>
</where>
GROUP BY CODE,
invSpaceCode
GROUP BY t1.CODE,
t1.invSpaceCode
</select>

@ -173,17 +173,24 @@
</delete>
<select id="getInvPlaceOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select ipd.orderId billNo,
(select name from basic_bussiness_type where action = o.action) billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
(select employeeName from auth_user where id = o.reviewUser) reviewUserName
from inv_pre_product_detail ipd
left join io_order o on ipd.orderId = o.billNo
SELECT
ipd.orderId AS billNo,
bbt.NAME AS billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
au.employeeName AS reviewUserName
FROM
inv_pre_product_detail ipd
LEFT JOIN
io_order o ON ipd.orderId = o.billNo
LEFT JOIN
basic_bussiness_type bbt ON bbt.action = o.action
LEFT JOIN
auth_user au ON au.id = o.reviewUser
<where>
<if test="invCode != null and invCode != ''">
AND ipd.invCode = #{invCode}
@ -204,25 +211,37 @@
</select>
<select id="filterSpaceList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
SELECT t1.nameCode,
t1.relId,
(SELECT NAME FROM auth_dept WHERE auth_dept.`code` = t1.deptCode) AS deptName,
(SELECT NAME FROM auth_warehouse WHERE auth_warehouse.`code` = t1.invCode) AS invName,
(SELECT NAME FROM auth_space WHERE auth_space.`code` = t1.invSpaceCode) AS invSpaceName,
SUM(t1.reCount) as count,
bp.cpmctymc as productName,
bp.ggxh,
t1.batchNo,
t1.produceDate as productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
(SELECT `name` FROM basic_corp WHERE erpId = t1.supId) supName
FROM inv_pre_product_detail t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relId
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
SELECT
t1.nameCode,
t1.relId,
ad.NAME AS deptName,
aw.NAME AS invName,
asp.NAME AS invSpaceName,
SUM(t1.reCount) AS count,
bp.cpmctymc AS productName,
bp.ggxh,
t1.batchNo,
t1.produceDate AS productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
bc.NAME AS supName
FROM
inv_pre_product_detail t1
LEFT JOIN
basic_udirel bu ON bu.id = t1.relId
LEFT JOIN
basic_products bp ON bp.uuid = bu.uuid
LEFT JOIN
auth_dept ad ON ad.code = t1.deptCode
LEFT JOIN
auth_warehouse aw ON aw.code = t1.invCode
LEFT JOIN
auth_space asp ON asp.code = t1.invSpaceCode
LEFT JOIN
basic_corp bc ON bc.erpId = t1.supId
<where>
<if test="code != null and code != ''">
AND t1.code = #{code}
@ -231,8 +250,8 @@
AND t1.invSpaceCode = #{invSpaceCode}
</if>
</where>
GROUP BY CODE,
invSpaceCode
GROUP BY t1.CODE,
t1.invSpaceCode
</select>

@ -3,32 +3,50 @@
<mapper namespace="com.glxp.api.dao.inv.InvPreinOrderDao">
<select id="filterList" parameterType="com.glxp.api.req.inv.FilterInvPreinRequest"
resultType="com.glxp.api.res.inv.InvPreinOrderResponse">
select io.*,
(select name from basic_bussiness_type bus where bus.action = io.action) billTypeName,
(select name from auth_dept ad where ad.code = io.deptCode) deptName,
(select name from auth_warehouse aw where aw.code = io.invCode) invName,
( SELECT fromType FROM io_order ior WHERE ior.billNo = io.billNo ) orderFromType,
(select employeeName from auth_user au where au.id = io.createUser) createUserName,
(select employeeName from auth_user au2 where au2.id = io.updateUser) updateUserName,
(select employeeName from auth_user au3 where au3.id = io.reviewUser) reviewUserName,
(select name from basic_corp bc where bc.erpId = io.fromCorp) fromCorpName
from inv_prein_order as io
SELECT
io.*,
bus.name AS billTypeName,
ad.name AS deptName,
aw.name AS invName,
ior.fromType AS orderFromType,
au.employeeName AS createUserName,
au2.employeeName AS updateUserName,
au3.employeeName AS reviewUserName,
bc.name AS fromCorpName
FROM
inv_prein_order AS io
LEFT JOIN
basic_bussiness_type AS bus ON bus.action = io.action
LEFT JOIN
auth_dept AS ad ON ad.code = io.deptCode
LEFT JOIN
auth_warehouse AS aw ON aw.code = io.invCode
LEFT JOIN
io_order AS ior ON ior.billNo = io.billNo
LEFT JOIN
auth_user AS au ON au.id = io.createUser
LEFT JOIN
auth_user AS au2 ON au2.id = io.updateUser
LEFT JOIN
auth_user AS au3 ON au3.id = io.reviewUser
LEFT JOIN
basic_corp AS bc ON bc.erpId = io.fromCorp
<where>
<if test="billNo != null and billNo != ''">
AND billNo like concat('%', #{billNo}, '%')
AND io.billNo like concat('%', #{billNo}, '%')
</if>
<if test="fromCorp != null and fromCorp != ''">
AND fromCorp = #{fromCorp}
AND io.fromCorp = #{fromCorp}
</if>
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
AND date_format(createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and
AND date_format(io.createTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and
date_format(#{endTime}, '%Y-%m-%d')
</if>
<if test="startTime != null and startTime != '' and (endTime == null or endTime == '')">
AND date_format(createTime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d')
AND date_format(io.createTime, '%Y-%m-%d') >= date_format(#{startTime}, '%Y-%m-%d')
</if>
<if test="endTime != null and endTime != '' and (startTime == null or startTime == '')">
AND date_format(createTime, '%Y-%m-%d') &lt;= date_format(#{endTime}, '%Y-%m-%d')
AND date_format(io.createTime, '%Y-%m-%d') &lt;= date_format(#{endTime}, '%Y-%m-%d')
</if>
</where>
</select>

@ -131,15 +131,6 @@
select *
from inv_product
<where>
<!-- <if test="code != null and code != ''">-->
<!-- AND code like concat('%', #{code}, '%')-->
<!-- </if>-->
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<!-- <if test="action != null and action != ''">-->
<!-- AND action = #{action}-->
<!-- </if>-->
<if test="supId != null and supId != ''">
and supId = #{supId}
</if>
@ -149,9 +140,6 @@
<if test="nameCode != null and nameCode != ''">
AND nameCode like concat('%', #{nameCode}, '%')
</if>
<!-- <if test="orderId != null and orderId != ''">-->
<!-- AND orderId = #{orderId}-->
<!-- </if>-->
<if test="deptCode != null and deptCode != ''">
AND deptCode = #{deptCode}
</if>
@ -300,17 +288,24 @@
</select>
<select id="getInvPlaceOrderList" resultType="com.glxp.api.res.inout.IoOrderResponse">
select odr.orderIdFk billNo,
(select name from basic_bussiness_type where action = o.action) billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
(select employeeName from auth_user where id = o.reviewUser) reviewUserName
from io_order_detail_biz odr
left join io_order o on o.billNo = odr.orderIdFk
SELECT
odr.orderIdFk AS billNo,
bbt.NAME AS billTypeName,
o.mainAction,
o.fromCorp,
o.corpOrderId,
o.fromType,
o.createTime,
o.auditTime,
au.employeeName AS reviewUserName
FROM
io_order_detail_biz odr
LEFT JOIN
io_order o ON o.billNo = odr.orderIdFk
LEFT JOIN
basic_bussiness_type bbt ON bbt.action = o.action
LEFT JOIN
auth_user au ON au.id = o.reviewUser
<where>
<if test="invCode != null and invCode != ''">
@ -331,34 +326,37 @@
</select>
<select id="filterSpaceList" resultType="com.glxp.api.res.inv.InvPlaceDetailResponse">
SELECT t1.nameCode,
t1.relIdFk as relId,
(SELECT NAME FROM auth_dept WHERE auth_dept.`code` = t1.deptCode) AS deptName,
(SELECT NAME FROM auth_warehouse WHERE auth_warehouse.`code` = t1.invCode) AS invName,
(SELECT NAME FROM auth_space WHERE auth_space.`code` = t1.invSpaceCode) AS invSpaceName,
<include refid="inOrOutcount"/> as count,
bp.cpmctymc as productName,
bp.ggxh,
t1.batchNo,
t1.productionDate as produceDate as productionDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
(SELECT `name` FROM basic_corp WHERE erpId = t1.supId) supName
FROM inv_product t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relIdFk
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
SELECT
t1.nameCode,
t1.relIdFk AS relId,
dept.NAME AS deptName,
warehouse.NAME AS invName,
space.NAME AS invSpaceName,
<include refid="inOrOutcount"/> AS count,
bp.cpmctymc AS productName,
bp.ggxh,
t1.batchNo,
t1.productionDate AS produceDate,
t1.expireDate,
bp.measname,
bp.zczbhhzbapzbh,
bp.ylqxzcrbarmc,
bp.manufactory,
corp.name AS supName
FROM
inv_product t1
LEFT JOIN basic_udirel bu ON bu.id = t1.relIdFk
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
LEFT JOIN auth_dept dept ON dept.code = t1.deptCode
LEFT JOIN auth_warehouse warehouse ON warehouse.code = t1.invCode
LEFT JOIN auth_space space ON space.code = t1.invSpaceCode
LEFT JOIN basic_corp corp ON corp.erpId = t1.supId
<where>
<!-- <if test="code != null and code != ''">-->
<!-- AND t1.code = #{code}-->
<!-- </if>-->
<if test="invSpaceCode != null and invSpaceCode != ''">
AND t1.invSpaceCode = #{invSpaceCode}
</if>
</where>
GROUP BY invSpaceCode
GROUP BY t1.invSpaceCode
</select>
@ -372,9 +370,6 @@
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
@ -395,9 +390,6 @@
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
@ -424,9 +416,6 @@
<if test="inBatchNo != null and inBatchNo != ''">
AND inBatchNo = #{inBatchNo}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
@ -448,9 +437,6 @@
<if test="invCode != null and invCode != ''">
AND invCode = #{invCode}
</if>
<!-- <if test="mainAction != null and mainAction != ''">-->
<!-- AND mainAction = #{mainAction}-->
<!-- </if>-->
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>

@ -23,12 +23,15 @@
bp.manufactory,
bp.zczbhhzbapzbh,
bp.cpmctymc productName,
(select `name` from auth_warehouse where `code` = irm.invCode) invName,
(select `name` from auth_space where `code` = irm.invSpaceCode and invCode = irm.invCode) invSpaceName,
(select `name` from basic_corp where erpId = irm.supId) supName
aw.name invName,
asp.name invSpaceName,
bc.name supName
from inv_remind_msg irm
left join basic_udirel bu on bu.id = irm.relId
left join basic_products bp on bp.uuid = bu.uuid
left join auth_warehouse aw on aw.code = irm.invCode
left join auth_space asp on asp.code = irm.invSpaceCode and asp.invCode = irm.invCode
left join basic_corp bc on bc.erpId = irm.supId
<where>
<if test="relId != null and relId != ''">
AND irm.relId = #{relId}

@ -20,11 +20,13 @@
bu.isDateBy,
bp.cpmctymc productName,
bp.ggxh,
(select `name` from auth_warehouse where `code` = irs.invCode) invName,
(select `name` from auth_space where `code` = irs.invSpaceCode and invCode = irs.invCode) invSpaceName
aw.name invName,
asp.name invSpaceName
from inv_remind_set irs
left join basic_udirel bu on bu.id = irs.relId
left join basic_products bp on bp.uuid = bu.uuid
left join auth_warehouse aw on aw.code = irs.invCode
left join auth_space asp on asp.code = irs.invSpaceCode and asp.invCode = irs.invCode
<where>
<if test="relId != null and relId != ''">
AND irs.relId = #{relId}
@ -50,24 +52,30 @@
</select>
<select id="selectInfoByInvId" resultType="com.glxp.api.res.inv.InvRemindSetResponse">
select ip.relIdFk relId,
ip.deptCode,
ip.invCode,
ipd.invSpaceCode,
(select `name` from auth_warehouse where code = ip.invCode) invName,
(select `name`
from auth_space
where code = ipd.invSpaceCode
and invWarehouseCode = ip.invCode) invSpaceName,
bp.ggxh,
bp.cpmctymc productName
from inv_product ip
left join basic_udirel bu on ip.relIdFk = bu.id
left join basic_products bp on bu.uuid = bp.uuid
left join inv_product_detail ipd
on ip.relIdFk = ipd.relId and IFNULL(ip.batchNo, 'empty') = ifnull(ipd.batchNo, 'empty')
and ip.invCode = ipd.invCode
where ip.id = #{invId}
group by ip.id
SELECT
ip.relIdFk AS relId,
ip.deptCode,
ip.invCode,
ipd.invSpaceCode,
warehouse.name AS invName,
space.name AS invSpaceName,
bp.ggxh,
bp.cpmctymc AS productName
FROM
inv_product ip
LEFT JOIN basic_udirel bu ON ip.relIdFk = bu.id
LEFT JOIN basic_products bp ON bu.uuid = bp.uuid
LEFT JOIN inv_product_detail ipd
ON ip.relIdFk = ipd.relId
AND IFNULL(ip.batchNo, 'empty') = IFNULL(ipd.batchNo, 'empty')
AND ip.invCode = ipd.invCode
LEFT JOIN auth_warehouse warehouse ON warehouse.code = ip.invCode
LEFT JOIN auth_space space
ON space.code = ipd.invSpaceCode
AND space.invWarehouseCode = ip.invCode
WHERE
ip.id = #{invId}
GROUP BY
ip.id
</select>
</mapper>

Loading…
Cancel
Save