<!-- 查看门票和线路的订单详细信息 -->
<select id="findTicketOrderById" parameterType="java.lang.String"
resultType="com.zh.bean.admin.Tbmember">
select a.* ,e.itag,e.code,e.logisticsId FROM
(SELECT d.ocode,d.change_process,d.ctag,d.live1,d.name,d.otime,d.payment_tag,d.price,d.psum
,d.refund_process,d.state,d.sum_price,d.telephone,d.tid,d.title,d.type,d.uid,t.send_goods_tag from(
select o.ocode,o.uid,(o.price*o.psum) as sum_price,o.otime,o.payment_tag,o.state,
ti.title,o.price,o.psum,m.name,m.live1,m.telephone,o.refund_process,o.change_process,ti.id as tid,s.type,o.ctag
from tb_member m,tb_order o, tb_spots s ,tb_ticket ti
WHERE o.uid=m.id AND ti.id=o.pcode AND
o.ocode=#{ocode,jdbcType=VARCHAR} and m.state=1 AND ti.spots_id=s.id AND s.type='01'
UNION ALL
select o.ocode,o.uid,(o.price*o.psum) as sum_price,o.otime,o.payment_tag,o.state,
s.title,o.price,o.psum,m.name,m.live1,m.telephone,o.refund_process,o.change_process,s.id as tid,s.type,o.ctag
from tb_member m,tb_order o, tb_spots s
WHERE o.uid=m.id AND s.id=o.pcode AND
o.ocode=#{ocode,jdbcType=VARCHAR} and m.state=1 AND s.type='02'
) d
LEFT JOIN tb_order_transfer t ON t.id=d.ocode)a
LEFT JOIN
(select t.apll,tr.company as apllName,t.logistics_id as logisticsId,tr.itag,tr.code,t.id FROM tb_order_transfer t,tb_transit tr
WHERE t.apll=tr.id)e on a.ocode=e.id
order by a.otime DESC
</select>