<select id="queryOrderById" resultType="java.util.HashMap">
select o.id,
o.order_no,
o.address
case
when o.state =1 then '已支付'
when o.state =0 then '未支付'
end status,sum(od.sum) total
from t_customer_order o
left join t_order_details od
on o.id = od.order_id
where
o.is_valid =1
and o.id = #{orderId}
and od.is_valid =1</select>