| | |
| | | </sql> |
| | | <!--顺风车司机订单行程 type :1待处理的订单,2根据线路、时间,人数综合匹配排序 3按时间排序,4距离最近排序 and r.startTime>=now()--> |
| | | <select id="getOrderTravel" resultType="com.stylefeng.guns.modular.shunfeng.model.vo.OrderRideVo"> |
| | | select r.*,_fnGetDistance(#{lon},#{lat}, r.startLon, r.startLat) as distance,d.totalOrders,u.sex,u.headImg,u.realName as name, |
| | | select r.*,calculate_distance(#{lat},#{lon},r.startLat, r.startLon) as distance,d.totalOrders,u.sex,u.avatar as headImg,u.nickName as name, |
| | | r.id as driverOrderId,i.id as userOrderId |
| | | from app_order_travel r |
| | | left join app_order_ride i on i.travelId=r.id |
| | | left join app_user_info u on u.driverId = r.driverId |
| | | left join t_user u on u.driverId = r.driverId |
| | | left join app_driver_ride d on d.id=r.driverId |
| | | <where> |
| | | <if test="driverId!=null"> |
| | |
| | | order by r.startTime desc |
| | | </if> |
| | | <if test="type==2"> |
| | | order by _fnGetDistance(#{lon},#{lat}, r.startLon, r.startLat) asc,r.startTime desc,(r.num-#{num}) asc |
| | | order by calculate_distance(#{lat},#{lon}, r.startLat,r.startLon) asc,r.startTime desc,(r.num-#{num}) asc |
| | | </if> |
| | | <if test="type==3"> |
| | | order by r.startTime asc |
| | | </if> |
| | | <if test="type==4"> |
| | | order by _fnGetDistance(#{lon},#{lat}, r.startLon, r.startLat) asc |
| | | order by calculate_distance(#{lat},#{lon}, r.startLat,r.startLon) asc |
| | | </if> |
| | | LIMIT #{current},#{size} |
| | | </select> |
| | | <!--根据订单id获取订单详情--> |
| | | <select id="getOrderInfo" resultType="com.stylefeng.guns.modular.shunfeng.model.vo.OrderRideInfoVo"> |
| | | select t.addTime,r.startTime,r.endName,r.startName,r.money,r.id as userOrderId,r.state,t.id as driverOrderId,r.isComplaint,r.num, |
| | | r.userId,r.driverId,u.headImg,u.phone,u.sex,u.realName as name,d.carNum,d.carType,d.totalOrders,IFNULL(format(d.evaluateScore/d.evaluateNum,2),0)as evaluateScore,r.evaluateScoreUser,r.isEvaluate |
| | | r.userId,r.driverId,u.avatar as headImg,u.phone,u.sex,u.nickName as realName as name,d.carNum,d.carType,d.totalOrders,IFNULL(format(d.evaluateScore/d.evaluateNum,2),0)as evaluateScore,r.evaluateScoreUser,r.isEvaluate |
| | | ,r.content |
| | | from (select * from app_order_travel where id= #{driverOrderId}) t |
| | | left join app_order_ride r on t.id=r.travelId |
| | | left join app_driver_ride d on d.id=t.driverId |
| | | left join app_user_info u on d.id=u.driverId |
| | | left join t_user u on d.id=u.driverId |
| | | </select> |
| | | </mapper> |