fix(firstleg): preserve coload groups in filtered candidates
This commit is contained in:
+20
-16
@@ -113,22 +113,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ba
|
||||
o.process_status IN ('WAIT_MEASURE','MEASURING','MEASURE_PENDING','MEASURE_REJECTED',
|
||||
'WAIT_PRICING','FEE_CONFIRMING','INBOUNDING','WAIT_SPLIT','LOADING')
|
||||
)
|
||||
<if test="query.orderStatuses != null and !query.orderStatuses.isEmpty()">
|
||||
AND (
|
||||
<foreach collection="query.orderStatuses" item="status" separator=" OR ">
|
||||
<choose>
|
||||
<when test="status.name() == 'WAIT_MEASURE'">o.process_status IN ('WAIT_MEASURE','MEASURING','MEASURE_PENDING','MEASURE_REJECTED','WAIT_PRICING','FEE_CONFIRMING','INBOUNDING')</when>
|
||||
<when test="status.name() == 'WAIT_SPLIT'">o.process_status='WAIT_SPLIT'</when>
|
||||
<when test="status.name() == 'LOADING'">o.process_status='LOADING'</when>
|
||||
<otherwise>1=0</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="query.customerId != null">AND o.tenant_id=#{query.customerId}</if>
|
||||
<if test="query.inboundCode != null and query.inboundCode.trim() != ''">AND LOWER(o.inbound_code) LIKE CONCAT('%',LOWER(#{query.inboundCode}),'%')</if>
|
||||
<if test="query.createdStart != null">AND o.created_at>=#{query.createdStart}</if>
|
||||
<if test="query.createdEnd != null">AND o.created_at<DATE_ADD(#{query.createdEnd},INTERVAL 1 DAY)</if>
|
||||
) eligible
|
||||
LEFT JOIN fl_coload_group_member current_member
|
||||
ON current_member.tenant_id=eligible.accountId AND current_member.inbound_id=eligible.inboundId
|
||||
@@ -143,6 +127,26 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ba
|
||||
COUNT(*)=(SELECT COUNT(*) FROM fl_coload_group_member group_member_count
|
||||
WHERE group_member_count.group_id=current_group.id AND group_member_count.active_flag=1)
|
||||
))
|
||||
<if test="query.orderStatuses != null and !query.orderStatuses.isEmpty()">
|
||||
AND MAX(CASE WHEN
|
||||
<foreach collection="query.orderStatuses" item="status" separator=" OR ">
|
||||
<choose>
|
||||
<when test="status.name() == 'WAIT_MEASURE'">eligible.candidateStatus='WAIT_MEASURE'</when>
|
||||
<when test="status.name() == 'WAIT_SPLIT'">eligible.candidateStatus='WAIT_SPLIT'</when>
|
||||
<when test="status.name() == 'LOADING'">eligible.candidateStatus='LOADING'</when>
|
||||
<otherwise>1=0</otherwise>
|
||||
</choose>
|
||||
</foreach>
|
||||
THEN 1 ELSE 0 END)=1
|
||||
</if>
|
||||
<if test="query.customerId != null">
|
||||
AND MAX(CASE WHEN eligible.accountId=#{query.customerId} THEN 1 ELSE 0 END)=1
|
||||
</if>
|
||||
<if test="query.inboundCode != null and query.inboundCode.trim() != ''">
|
||||
AND MAX(CASE WHEN LOWER(eligible.inboundCode) LIKE CONCAT('%',LOWER(#{query.inboundCode}),'%') THEN 1 ELSE 0 END)=1
|
||||
</if>
|
||||
<if test="query.createdStart != null">AND MIN(eligible.createdAt)>=#{query.createdStart}</if>
|
||||
<if test="query.createdEnd != null">AND MIN(eligible.createdAt)<DATE_ADD(#{query.createdEnd},INTERVAL 1 DAY)</if>
|
||||
ORDER BY sortArrivalAt IS NULL,sortArrivalAt,sortInboundId
|
||||
</script>
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user