Browse Source

2025-12-22

调整
master
fengyuan_yang 3 weeks ago
parent
commit
121fa31482
  1. 31
      src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml

31
src/main/resources/mapper/outboundNotification/OutboundNotificationHeadMapper.xml

@ -8,12 +8,16 @@
SELECT SELECT
a.site, a.site,
a.bu_no, a.bu_no,
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
dbo.get_bu_desc(a.site, a.bu_no) AS buDesc,
a.order_no, a.order_no,
a.order_type, a.order_type,
a.order_status, a.order_status,
a.customer_id,
b.customerName,
COALESCE(NULLIF(LTRIM(RTRIM(a.customer_id)), ''), s.SupplierID) AS customer_id,
COALESCE(
NULLIF(LTRIM(RTRIM(b.customerName)), ''),
NULLIF(LTRIM(RTRIM(s.SupplierName)), ''),
''
) AS customerName,
a.related_order_no, a.related_order_no,
a.related_order_line_no, a.related_order_line_no,
a.required_outbound_date, a.required_outbound_date,
@ -41,19 +45,20 @@
a.out_warehouse, a.out_warehouse,
a.customer_order_no, a.customer_order_no,
a.show_in_query_flag a.show_in_query_flag
FROM outbound_notification_head as a
left join Customer as b on a.site = b.site and a.customer_id = b.CustomerID
FROM outbound_notification_head AS a
LEFT JOIN Customer AS b ON a.site = b.site AND LTRIM(RTRIM(a.customer_id)) = b.CustomerID
LEFT JOIN Supplier AS s ON a.site = s.site AND (NULLIF(LTRIM(RTRIM(a.customer_id)), '') IS NULL OR b.CustomerID IS NULL) AND LTRIM(RTRIM(a.customer_id)) = s.SupplierID
<where> <where>
a.site in (select site from AccessSite where userID = #{query.userName})
and a.bu_no in (select bu_no from AccessBu where username = #{query.userName})
a.site IN (SELECT site FROM AccessSite WHERE userID = #{query.userName})
AND a.bu_no IN (SELECT bu_no FROM AccessBu WHERE username = #{query.userName})
<if test="query.orderNo != null and query.orderNo != ''"> <if test="query.orderNo != null and query.orderNo != ''">
AND a.order_no like '%' + #{query.orderNo} + '%'
AND a.order_no LIKE '%' + #{query.orderNo} + '%'
</if> </if>
<if test="query.orderType != null and query.orderType != ''"> <if test="query.orderType != null and query.orderType != ''">
AND a.order_type = #{query.orderType} AND a.order_type = #{query.orderType}
</if> </if>
<if test="query.orderStatus != null and query.orderStatus != ''"> <if test="query.orderStatus != null and query.orderStatus != ''">
AND a.order_status in
AND a.order_status IN
<foreach collection="query.statusArr" close=")" open="(" item="item" separator=","> <foreach collection="query.statusArr" close=")" open="(" item="item" separator=",">
#{item} #{item}
</foreach> </foreach>
@ -65,12 +70,16 @@
AND #{query.endDate} >= a.required_outbound_date AND #{query.endDate} >= a.required_outbound_date
</if> </if>
<if test="query.customerId != null and query.customerId != ''"> <if test="query.customerId != null and query.customerId != ''">
AND a.customer_id like '%' + #{query.customerId} + '%'
AND a.customer_id LIKE '%' + #{query.customerId} + '%'
</if> </if>
<if test="query.customerName != null and query.customerName != ''"> <if test="query.customerName != null and query.customerName != ''">
AND b.customerName like '%' + #{query.customerName} + '%'
AND (
b.customerName LIKE '%' + #{query.customerName} + '%'
OR s.SupplierName LIKE '%' + #{query.customerName} + '%'
)
</if> </if>
</where> </where>
ORDER BY a.created_date DESC;
</select> </select>
<insert id="saveOutboundNotification" parameterType="com.gaotao.modules.outboundNotification.entity.vo.OutboundNotificationHeadVo"> <insert id="saveOutboundNotification" parameterType="com.gaotao.modules.outboundNotification.entity.vo.OutboundNotificationHeadVo">

Loading…
Cancel
Save