注意mybatis里面外连接的使用方法

<!-- 查看门票和线路的订单详细信息 -->
<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>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值