You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
udi-wms-java/src/main/resources/mybatis/mapper/inout/IoOrderDetailResultDao.xml

156 lines
6.6 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glxp.api.dao.inout.IoOrderDetailResultDao">
<select id="filterList" resultType="com.glxp.api.res.inout.IoOrderDetailResultResponse">
select *
from io_order_detail_result
<where>
<if test="orderIdFk != null and orderIdFk != ''">
AND orderIdFk = #{orderIdFk}
</if>
<if test="nameCode != null and nameCode != ''">
AND nameCode = #{nameCode}
</if>
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="coName != null and coName != ''">
AND coName = #{productName}
</if>
<if test="productName != null and productName != ''">
AND coName like concat('%', #{productName}, '%')
</if>
</where>
</select>
<select id="filterOrderList" resultType="com.glxp.api.res.inout.IoOrderDetailResultResponse">
SELECT a2.*,
2 years ago
a1.mainAction,
a1.auditTime,
2 years ago
b1.NAME AS fromCorpName,
(select name from auth_warehouse aw where aw.code = a1.fromInvCode) as fromInvName,
2 years ago
(SELECT NAME FROM basic_bussiness_type bus WHERE bus.action = a1.action) billTypeName
FROM io_order_detail_result a2
2 years ago
LEFT JOIN io_order a1 ON a1.billNo = a2.orderIdFk
LEFT JOIN basic_corp b1 ON b1.erpId = a1.fromCorp
left join auth_warehouse aw on aw.code = a1.fromInvCode
<where>
2 years ago
a1.status = 7
<if test="orderIdFk != null and orderIdFk != ''">
AND a2.orderIdFk = #{orderIdFk}
</if>
<if test="keyWords != null and keyWords != ''">
AND (aw.name like concat('%', #{keyWords}, '%') or b1.name like concat('%', #{keyWords}, '%'))
</if>
<if test="nameCode != null and nameCode != ''">
AND a2.nameCode = #{nameCode}
</if>
<if test="inoutPrintStatus != null">
AND a2.inoutPrintStatus = #{inoutPrintStatus}
</if>
<if test="action != null and action != ''">
AND a1.action = #{action}
</if>
<if test="mainAction != null and mainAction != ''">
AND a1.mainAction = #{mainAction}
</if>
2 years ago
<if test="invCode != null and invCode != ''">
AND a1.invCode = #{invCode}
</if>
<if test="spec != null and spec != ''">
AND a2.spec like concat('%', #{spec}, '%')
</if>
<if test="fromCorp != null and fromCorp != ''">
AND a1.fromCorp = #{fromCorp}
</if>
<if test="fromCorpName != null and fromCorpName != ''">
AND b1.name = #{fromCorpName}
</if>
<if test="manufacturer != null and manufacturer != ''">
AND a2.manufacturer like concat('%', #{manufacturer}, '%')
</if>
<if test="zczbhhzbapzbh != null and zczbhhzbapzbh != ''">
AND a2.certCode like concat('%', #{zczbhhzbapzbh}, '%')
</if>
<if test="startAduditTime != null and startAduditTime != '' and endAduditTime != null and endAduditTime != ''">
AND date_format(a1.auditTime, '%Y-%m-%d') between date_format(#{startAduditTime}, '%Y-%m-%d') and date_format(#{endAduditTime}, '%Y-%m-%d')
</if>
<if test="batchNo != null and batchNo != ''">
AND a2.batchNo like concat('%', #{batchNo}, '%')
</if>
<if test="coName != null and coName != ''">
AND a2.coName like concat('%', #{coName}, '%')
</if>
<if test="productName != null and productName != ''">
AND a2.coName like concat('%', #{productName}, '%')
</if>
<if test="actions != null and actions.size() != 0">
AND a1.`action` in
<foreach collection="actions" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
2 years ago
<select id="selectStatDataByTime" resultType="com.glxp.api.res.inv.IoOrderDetailStatRsponse">
select orderIdFk,
bindRlFk,
nameCode,
batchNo,
coName,
spec,
price,
reCount,
2 years ago
io_order.deptCode,
io_order.invCode,
bbt.mainAction
from io_order_detail_result
2 years ago
left JOIN io_order on io_order.billNo = io_order_detail_result.orderIdFk
left join basic_bussiness_type bbt on io_order.action = bbt.action
<where>
2 years ago
<if test="list != null and list.size() > 0">
and io_order_detail_result.orderIdFk in
<foreach item="item" index="index" collection="list"
open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
group by io_order_detail_result.id
</select>
<select id="cptTrace" parameterType="com.glxp.api.req.inout.CptTraceRequest"
resultType="com.glxp.api.res.inout.CptTraceOrderResponse">
select io.billNo,
2 years ago
io.createTime,
io.mainAction,
bbt.`name` billType,
basic_corp.`name` fromCorpName,
basic_corp.creditNo,
basic_corp.outType,
basic_corp.corpType,
io.action,
io.fromInvCode
from io_order_detail_result iodr
2 years ago
INNER JOIN io_order io on iodr.orderIdFk = io.billNo
inner join basic_corp on io.fromCorp = basic_corp.erpId
INNER JOIN basic_bussiness_type bbt on io.action = bbt.action
<where>
and bbt.inStock = true
<if test="batchNo != null and batchNo != ''">
AND batchNo = #{batchNo}
</if>
<if test="diList != null and diList.size() != 0">
AND iodr.`nameCode` in
<foreach collection="diList" index="index" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
</select>
</mapper>