select b.bill_id,b.create_time,b.remark,b.price,count(o.bill_order_id) order_counts,sum(o.order_total_amount) order_total_amount from pmt_bill b right join pmt_bill_order o on b.bill_id = o.bill_id and o.order_status = 1
select b.bill_id,b.status,b.currency,DATE_FORMAT(b.create_time,'%Y-%c-%e') create_date, DATE_FORMAT(b.create_time,'%H:%m:%s') create_time,b.remark,b.price,count(o.bill_order_id) order_counts,sum(o.order_total_amount) order_total_amount from pmt_bill b right join pmt_bill_order o on b.bill_id = o.bill_id and o.order_status = 1
<where>
<iftest="param.status != null">
and o.status = #{param.status}
</if>
</where>
group by b.bill_id,b.create_time,b.remark,b.price
group by b.bill_id,create_time,create_date,b.remark,b.price,b.status,b.currency