|
@@ -484,18 +484,21 @@
|
|
(case WHEN(SELECT COUNT(1) from profile_tp where `status`=1 and FIND_IN_SET(g.goods_id,goods_ids) ) >0 then 1 ELSE 0 end) as profile_tp_status
|
|
(case WHEN(SELECT COUNT(1) from profile_tp where `status`=1 and FIND_IN_SET(g.goods_id,goods_ids) ) >0 then 1 ELSE 0 end) as profile_tp_status
|
|
<if test="userId != null and userId != ''">
|
|
<if test="userId != null and userId != ''">
|
|
,
|
|
,
|
|
- (SELECT exam_status from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_exam_status,
|
|
|
|
- (SELECT performance from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_performance,
|
|
|
|
- (SELECT `result` from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_result,
|
|
|
|
- (SELECT subscribe_id from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as subscribe_id,
|
|
|
|
- (SELECT apply_site_start_time from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_apply_site_start_time,
|
|
|
|
- (SELECT apply_site_end_time from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_apply_site_end_time,
|
|
|
|
- (SELECT apply_site_exam_time from user_subscribe where user_id = #{userId} and goods_id = g.goods_id and subscribe_status = 1 ORDER BY subscribe_id desc limit 1)as sub_apply_site_exam_time
|
|
|
|
|
|
+ us.exam_status as sub_exam_status,
|
|
|
|
+ us.performance as sub_performance,
|
|
|
|
+ us.`result` as sub_result,
|
|
|
|
+ us.subscribe_id,
|
|
|
|
+ us.apply_site_start_time as sub_apply_site_start_time,
|
|
|
|
+ us.apply_site_end_time as sub_apply_site_end_time,
|
|
|
|
+ us.apply_site_exam_time as sub_apply_site_exam_time
|
|
</if>
|
|
</if>
|
|
FROM
|
|
FROM
|
|
`order` o
|
|
`order` o
|
|
LEFT JOIN order_goods og ON og.order_sn = o.order_sn
|
|
LEFT JOIN order_goods og ON og.order_sn = o.order_sn
|
|
LEFT JOIN goods g on og.goods_id = g.goods_id
|
|
LEFT JOIN goods g on og.goods_id = g.goods_id
|
|
|
|
+ <if test="userId != null and userId != ''">
|
|
|
|
+ LEFT JOIN (SELECT * from user_subscribe where subscribe_id in (SELECT MAX(subscribe_id) from user_subscribe where user_id = #{userId} and subscribe_status = 1 GROUP BY order_goods_id)) us on us.order_goods_id = og.order_goods_id
|
|
|
|
+ </if>
|
|
where 1=1
|
|
where 1=1
|
|
AND og.`status` = 1
|
|
AND og.`status` = 1
|
|
AND og.refund_status in (0,1,3)
|
|
AND og.refund_status in (0,1,3)
|