|
|
@@ -504,13 +504,14 @@
|
|
|
LEFT JOIN trade_detail tdl ON td.id = tdl.order_id AND tdl.deleted = 0
|
|
|
LEFT JOIN product_spu ps ON ps.id = tdl.product_id and ps.deleted=0
|
|
|
LEFT JOIN ota_distributor od ON od.id = td.source_id and od.deleted=0
|
|
|
-
|
|
|
+ LEFT JOIN product_voyage pv ON pv.id = td.voyage_id and pv.deleted=0
|
|
|
<if test="vo.categoryIds != null and vo.categoryIds.size() > 0">
|
|
|
INNER JOIN ota_distributor_category_his his
|
|
|
ON his.distributor_id = od.id
|
|
|
AND his.deleted = 0
|
|
|
- AND td.create_time <![CDATA[ >= ]]> his.start_time
|
|
|
- AND td.create_time <![CDATA[ <= ]]> IFNULL(his.end_time, NOW())
|
|
|
+ AND pv.boarding_time <![CDATA[ >= ]]> his.start_time
|
|
|
+ /*AND pv.boarding_time <![CDATA[ <= ]]> IFNULL(his.end_time, NOW())*/
|
|
|
+ AND (his.end_time IS NULL OR pv.boarding_time <![CDATA[ <= ]]> his.end_time)
|
|
|
AND his.ota_category_id IN
|
|
|
<foreach collection="vo.categoryIds" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
</if>
|