|
|
|
<?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.*,
|
|
|
|
a1.mainAction,
|
|
|
|
bu.isStack,
|
|
|
|
bp.bzgg,
|
|
|
|
bp.prepnSpec,
|
|
|
|
GROUP_CONCAT( ioi.invoiceEncode ORDER BY ioi.invoiceEncode SEPARATOR ',' ) AS invoiceCodes,
|
|
|
|
b1.NAME AS fromCorpName
|
|
|
|
,basic_bussiness_type.name billTypeName
|
|
|
|
FROM
|
|
|
|
io_order_detail_result a2
|
|
|
|
LEFT JOIN io_order a1 ON a1.billNo = a2.orderIdFk
|
|
|
|
LEFT JOIN basic_corp b1 ON b1.erpId = a1.fromCorp
|
|
|
|
LEFT JOIN basic_udirel bu ON a2.bindRlFk = bu.id
|
|
|
|
LEFT JOIN basic_products bp ON bp.uuid = bu.uuid
|
|
|
|
left join basic_bussiness_type on a1.action = basic_bussiness_type.action
|
|
|
|
LEFT JOIN io_order_invoice ioi ON a1.billNo = ioi.orderIdFk
|
|
|
|
<where>
|
|
|
|
a1.status = 7
|
|
|
|
<if test="orderIdFk != null and orderIdFk != ''">
|
|
|
|
AND a2.orderIdFk = #{orderIdFk}
|
|
|
|
</if>
|
|
|
|
<if test="supId != null and supId != ''">
|
|
|
|
AND a2.supId = #{supId}
|
|
|
|
</if>
|
|
|
|
<if test="nameCode != null and nameCode != ''">
|
|
|
|
AND a2.nameCode = #{nameCode}
|
|
|
|
</if>
|
|
|
|
<if test="isStack != null">
|
|
|
|
AND bu.isStack = #{isStack}
|
|
|
|
</if>
|
|
|
|
<if test="invCode != null and invCode != ''">
|
|
|
|
AND a1.invCode = #{invCode}
|
|
|
|
</if>
|
|
|
|
<if test="invoiceEncode != null and invoiceEncode != ''">
|
|
|
|
AND ioi.invoiceEncode = #{invoiceEncode}
|
|
|
|
</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>
|
|
|
|
group by a2.id
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="cptTrace" parameterType="com.glxp.api.req.inout.CptTraceRequest"
|
|
|
|
resultType="com.glxp.api.res.inout.CptTraceOrderResponse">
|
|
|
|
select io.billNo,
|
|
|
|
io.createTime,
|
|
|
|
io.mainAction,
|
|
|
|
bbt.`name` billType,
|
|
|
|
basic_corp.`name` fromCorpName,
|
|
|
|
basic_corp.creditNo,
|
|
|
|
io.action,
|
|
|
|
io.fromInvCode,
|
|
|
|
bbt.corpType,
|
|
|
|
iodr.reCount count
|
|
|
|
from io_order_detail_result iodr
|
|
|
|
INNER JOIN io_order io on iodr.orderIdFk = io.billNo
|
|
|
|
left 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>
|
|
|
|
<select id="cptCodeTrace" parameterType="com.glxp.api.req.inout.CptTraceRequest"
|
|
|
|
resultType="com.glxp.api.res.inout.CptTraceOrderResponse">
|
|
|
|
select io.billNo,
|
|
|
|
io.createTime,
|
|
|
|
io.mainAction,
|
|
|
|
bbt.`name` billType,
|
|
|
|
basic_corp.`name` fromCorpName,
|
|
|
|
basic_corp.creditNo,
|
|
|
|
io.action,
|
|
|
|
io.fromInvCode,
|
|
|
|
bbt.corpType,
|
|
|
|
iodr.reCount count
|
|
|
|
from io_code iodr
|
|
|
|
INNER JOIN io_order io on iodr.orderId = io.billNo
|
|
|
|
left 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 iodr.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>
|
|
|
|
<if test="serialNo != null and serialNo != ''">
|
|
|
|
AND iodr.serialNo = #{serialNo}
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
</select>
|
|
|
|
</mapper>
|