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"> <!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"> <mapper namespace="com.glxp.api.dao.inv.InvPlaceOrderDao">
<select id="filterList" resultType="com.glxp.api.res.inv.InvPlaceOrderResponse"> <select id="filterList" resultType="com.glxp.api.res.inv.InvPlaceOrderResponse">
select t.recordId, SELECT
t.type, t.recordId,
t.orderId, t.type,
t2.invCode, t.orderId,
t2.invSpaceCode, t2.invCode,
t.createUser, t2.invSpaceCode,
t2.count as count, t.createUser,
(select employeeName from auth_user where id = t.createUser) operatorName, t2.count AS detailCount,
(select name from auth_warehouse where code = t2.invCode) invName, au.employeeName AS operatorName,
(select name from auth_space where code = t2.invSpaceCode) invSpaceName, aw.name AS invName,
(select name from auth_space where code = t2.topInvSpaceCode) topInvSpaceName, as1.name AS invSpaceName,
t.createTime, as2.name AS topInvSpaceName,
t2.code, t.createTime,
t2.batchNo, t2.code,
t2.relId, t2.batchNo,
bp.cpmctymc productName, t2.relId,
bp.ggxh, bp.cpmctymc AS productName,
t2.produceDate productionDate, bp.ggxh,
t2.expireDate, t2.produceDate AS productionDate,
bp.nameCode, t2.expireDate,
bp.zczbhhzbapzbh, bp.nameCode,
bp.ylqxzcrbarmc, bp.zczbhhzbapzbh,
(select name from basic_corp where erpId = t2.supId) supName, bp.ylqxzcrbarmc,
t2.serialNo, bc.name AS supName,
bp.manufactory, t2.serialNo,
bp.measname bp.manufactory,
from inv_place_order t bp.measname
right join inv_place_order_detail t2 on t.recordId = t2.recordId FROM
left join basic_udirel bu on bu.id = t2.relId inv_place_order_detail t2
left join basic_products bp on bp.uuid = bu.uuid 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> <where>
<if test="recordId != null and recordId != ''"> <if test="recordId != null and recordId != ''">
and t.recordId like concat('%', #{recordId}, '%') and t.recordId like concat('%', #{recordId}, '%')

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

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

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

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

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

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

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

Loading…
Cancel
Save