select o.user_mobile as 'mobile',o.order_code as 'orderId',(o.number-refund_number) as 'number',o.created_at as 'createTime' from kylin_order_tickets as o
select o.user_mobile as 'mobile',o.order_tickets_id as 'orderId',(o.number-refund_number) as 'number',o.created_at as 'createTime' from kylin_order_tickets as o
LEFT JOIN kylin_order_ticket_status as s ON o.order_tickets_id=s.order_id
LEFT JOIN kylin_order_ticket_status as s ON o.order_tickets_id=s.order_id
LEFT JOIN kylin_order_ticket_relations as r on o.order_tickets_id=r.order_id
LEFT JOIN kylin_order_ticket_relations as r on o.order_tickets_id=r.order_id
where r.agent_id=#{agentId} and s.pay_status='1' and r.ticket_id=#{ticketId} and (o.number-refund_number)>0
where r.agent_id=#{agentId} and s.pay_status='1' and r.ticket_id=#{ticketId} and (o.number-refund_number)>0