| | |
| | | <if test="orderSource != null and orderSource != ''"> |
| | | and o.orderSource = #{orderSource} |
| | | </if> |
| | | <if test="payType != null"> |
| | | and o.payType = #{payType} |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and o.userName LIKE CONCAT('%',#{userName},'%') |
| | | </if> |
| | |
| | | ) as t5 order by t5.successTime desc |
| | | </select> |
| | | |
| | | |
| | | <select id="getDriverPromotionActivity" resultType="com.stylefeng.guns.modular.system.model.DriverRankVo"> |
| | | select * |
| | | from (select aa.id as driverId, |
| | | aa.`name` as driverName, |
| | | COUNT(aa.userId) as userNum, |
| | | SUM(aa.promotionMoney) as money, |
| | | aa.promotionActivityId as activityId |
| | | from (select b.id, b.`name`, a.userId, a.promotionMoney, a.promotionActivityId |
| | | from t_order_private_car a |
| | | left join t_driver b on (a.promotionDriverId = b.id) |
| | | where a.successTime is not null and a.promotionActivityId = #{id} |
| | | <if test="null != driverName and '' != driverName"> |
| | | and b.`name` like concat('%', #{driverName}, '%') |
| | | </if> |
| | | |
| | | UNION ALL |
| | | |
| | | select b.id, b.`name`, a.userId, a.promotionMoney, a.promotionActivityId |
| | | from t_order_taxi a |
| | | left join t_driver b on (a.promotionDriverId = b.id) |
| | | where a.successTime is not null and a.promotionActivityId = #{id} |
| | | <if test="null != driverName and '' != driverName"> |
| | | and b.`name` like concat('%', #{driverName}, '%') |
| | | </if> |
| | | |
| | | UNION ALL |
| | | |
| | | select b.id, b.`name`, a.userId, a.promotionMoney, a.promotionActivityId |
| | | from t_order_cross_city a |
| | | left join t_driver b on (a.promotionDriverId = b.id) |
| | | where a.successTime is not null and a.promotionActivityId = #{id} |
| | | <if test="null != driverName and '' != driverName"> |
| | | and b.`name` like concat('%', #{driverName}, '%') |
| | | </if> |
| | | ) as aa |
| | | group by aa.id) as datas |
| | | order by datas.userNum desc |
| | | </select> |
| | | </mapper> |