|
|
|
<?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.collect.IoCollectOrderOriginMapper">
|
|
|
|
|
|
|
|
<select id="filterList" parameterType="com.glxp.api.req.collect.CollectOrderRequest"
|
|
|
|
resultType="com.glxp.api.res.collect.IoCollectOrderResponse">
|
|
|
|
SELECT ico.billNo,
|
|
|
|
ico.busType,
|
|
|
|
ico.fromType,
|
|
|
|
ico.fromTypeDesc,
|
|
|
|
ico.fromCorp,
|
|
|
|
ico.billTime,
|
|
|
|
ico.orderCirType,
|
|
|
|
ico.createTime,
|
|
|
|
ico.workPlaceCode,
|
|
|
|
ico.remark,
|
|
|
|
ico.createUser,
|
|
|
|
ico.updateTime,
|
|
|
|
ico.updateUser,
|
|
|
|
ico.tagStatus,
|
|
|
|
ico.splitStatus,
|
|
|
|
ico.invAlert,
|
|
|
|
ico.splitMsg,
|
|
|
|
ico.fromCorpName,
|
|
|
|
ico.tagMsg,
|
|
|
|
sys_workplace_document.busName busTypeName,
|
|
|
|
thr_bustype_origin.name actionName,
|
|
|
|
sw.workplaceName,
|
|
|
|
ico.id,
|
|
|
|
ico.orderTime,
|
|
|
|
ico.uploadStatus,
|
|
|
|
ico.uploadError,
|
|
|
|
ico.errorMsg,
|
|
|
|
ico.shipper,
|
|
|
|
ico.shipperName,
|
|
|
|
row_number()
|
|
|
|
over ( order by case
|
|
|
|
when ico.orderTime is null then ico.createTime
|
|
|
|
else ico.orderTime end desc ) as orderSequence
|
|
|
|
FROM io_collect_order_origin ico
|
|
|
|
left join sys_workplace_document on ico.busType = sys_workplace_document.documentTypeCode
|
|
|
|
left join thr_bustype_origin on sys_workplace_document.documentTypeCode = thr_bustype_origin.action
|
|
|
|
left join basic_corp bc on ico.fromCorp = bc.erpId
|
|
|
|
left join sys_workplace sw on ico.workPlaceCode = sw.workplaceId
|
|
|
|
|
|
|
|
<where>
|
|
|
|
<if test="billNo != '' and billNo != null">
|
|
|
|
AND billNo LIKE concat('%',
|
|
|
|
#{billNo}
|
|
|
|
,
|
|
|
|
'%'
|
|
|
|
)
|
|
|
|
</if>
|
|
|
|
<if test="workplaceName != '' and workplaceName != null">
|
|
|
|
AND workplaceName
|
|
|
|
LIKE
|
|
|
|
concat
|
|
|
|
(
|
|
|
|
'%'
|
|
|
|
,
|
|
|
|
#{workplaceName}
|
|
|
|
,
|
|
|
|
'%'
|
|
|
|
)
|
|
|
|
</if>
|
|
|
|
<if test="busType != null and busType != ''">
|
|
|
|
AND busType
|
|
|
|
=
|
|
|
|
#{busType}
|
|
|
|
</if>
|
|
|
|
<if test="fromCorp != '' and fromCorp != null">
|
|
|
|
AND (
|
|
|
|
fromCorp
|
|
|
|
LIKE
|
|
|
|
concat
|
|
|
|
(
|
|
|
|
'%'
|
|
|
|
,
|
|
|
|
#{fromCorp}
|
|
|
|
,
|
|
|
|
'%'
|
|
|
|
)
|
|
|
|
or
|
|
|
|
fromCorpName
|
|
|
|
LIKE
|
|
|
|
concat
|
|
|
|
(
|
|
|
|
'%'
|
|
|
|
,
|
|
|
|
#{fromCorp}
|
|
|
|
,
|
|
|
|
'%'
|
|
|
|
)
|
|
|
|
)
|
|
|
|
</if>
|
|
|
|
<if test="fromType != '' and fromType != null">
|
|
|
|
AND fromType LIKE concat('%', #{fromType}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="shipperName != '' and shipperName != null">
|
|
|
|
AND ico.shipperName LIKE concat('%', #{shipperName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="fromCorpName != '' and fromCorpName != null">
|
|
|
|
AND ico.fromCorpName LIKE concat('%', #{fromCorpName}, '%')
|
|
|
|
</if>
|
|
|
|
<if test="busType != null and busType != ''">
|
|
|
|
AND busType = #{busType}
|
|
|
|
</if>
|
|
|
|
<if test="tagStatus != null">
|
|
|
|
AND tagStatus = #{tagStatus}
|
|
|
|
</if>
|
|
|
|
<if test="workPlaceCode != null">
|
|
|
|
AND ico.workPlaceCode = #{workPlaceCode}
|
|
|
|
</if>
|
|
|
|
<if test="chargeUser != null">
|
|
|
|
AND sw.chargeUser = #{chargeUser}
|
|
|
|
</if>
|
|
|
|
<if test="unionKey != null">
|
|
|
|
AND (
|
|
|
|
ico.billNo like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.fromCorp like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.fromType like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.fromCorpName like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.backupOrderRemark1 like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.backupOrderRemark2 like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.backupOrderRemark3 like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.backupOrderRemark4 like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.backupOrderRemark5 like concat('%', #{unionKey}, '%')
|
|
|
|
or ico.backupOrderRemark6 like concat('%', #{unionKey}, '%'))
|
|
|
|
</if>
|
|
|
|
<if test="tagStatusList != null and tagStatusList.size() > 0">
|
|
|
|
and tagStatus in
|
|
|
|
<foreach collection="tagStatusList" item="item" index="index" separator="," open="(" close=")">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="workPlaceCodes != null and workPlaceCodes.size() > 0">
|
|
|
|
and ico.workPlaceCode in
|
|
|
|
<foreach collection="workPlaceCodes" item="item" index="index" separator="," open="(" close=")">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="invAlert != null">
|
|
|
|
and ico.invAlert =#{invAlert}
|
|
|
|
</if>
|
|
|
|
<if test="invAlerts != null and invAlerts.size() > 0">
|
|
|
|
and ico.invAlert in
|
|
|
|
<foreach collection="invAlerts" item="item" index="index" separator="," open="(" close=")">
|
|
|
|
#{item}
|
|
|
|
</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="uploadStatus != null">
|
|
|
|
and ico.uploadStatus = #{uploadStatus}
|
|
|
|
</if>
|
|
|
|
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
|
|
|
AND date_format(ico.billTime, '%Y-%m-%d') between date_format(#{startTime}, '%Y-%m-%d') and date_format(#{endTime}, '%Y-%m-%d')
|
|
|
|
</if>
|
|
|
|
<if test="keyWords != null and keyWords != ''">
|
|
|
|
and (ico.billNo like concat('%', #{keyWords}, '%')
|
|
|
|
or ico.fromCorp like concat('%', #{keyWords}, '%')
|
|
|
|
or ico.fromCorpName like concat('%', #{keyWords}, '%')
|
|
|
|
or ico.fromType like concat('%', #{keyWords}, '%'))
|
|
|
|
</if>
|
|
|
|
</where>
|
|
|
|
GROUP BY
|
|
|
|
ico.billNo
|
|
|
|
order by case when ico.orderTime is null then ico.createTime else ico.orderTime end desc
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|