其实这种sql就不应该存在吧。。。
<select id="queryServiceOrderList" resultMap="BaseVoResultMap"> SELECT ai.`name`, sp.shop_name, so.car_no, so.service_date, so.service_time, so.real_amount, so.id, so.remarks, so.cupoon, si.services_name, si.id serviceInfoId, sd.service_id, sd.service_order_id, sd.quantity, si.price service_price, sd.amount detail_amount FROM service_order so,service_detail sd,services_info si,shop_info sp,admin_info ai WHERE so.shop_user_id = ai.id AND sd.service_order_id = so.id AND so.shop_id = sp.id AND sd.service_id = si.id AND so.shop_id =#{shopId} ORDER BY so.service_date DESC,so.service_time DESC </select>
1、从管理员表(admin_info)中根据商户id查找商户表(shop_info),获得商户的店名。
2、根据商户id查找订单表(service_order) 和订单详情(service_detail)。
3、根据服务id查找服务的名称。