| | |
| | | GROUP BY `month` |
| | | </select> |
| | | <select id="getDataStatisticsOrderCount" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(o.payTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.userName |
| | | FROM t_order o |
| | | LEFT JOIN (SELECT id,name AS userName from t_driver) d ON o.driverId = d.id |
| | | <where> |
| | | select * from ( |
| | | select |
| | | aa.monthTime, |
| | | aa.userName, |
| | | count(1) as amount |
| | | from ( |
| | | select |
| | | DATE_FORMAT(a.startTime, '%Y-%m') as monthTime, |
| | | ifnull(b.`name`, b.phone) as userName |
| | | from t_order a |
| | | left join t_driver b on (a.driverId = b.id) |
| | | where a.state in (107, 108, 109) and a.status = 1 |
| | | <if test="agentId != null"> |
| | | AND o.agentId = #{agentId} |
| | | and a.agentId = #{agentId} |
| | | </if> |
| | | <if test="monthDate != null and monthDate != ''"> |
| | | AND date_format(o.payTime, '%Y-%m') LIKE concat('',#{monthDate},'%') |
| | | and DATE_FORMAT(a.startTime, '%Y-%m') = #{monthDate} |
| | | </if> |
| | | AND (o.`state` = 107 OR o.`state` = 108 OR o.`state` = 109) |
| | | AND d.userName is not null |
| | | </where> |
| | | GROUP BY monthTime,userName |
| | | ORDER BY amount DESC |
| | | LIMIT 10 |
| | | ) as aa group by aa.monthTime,aa.userName |
| | | ) as aaa order by aaa.amount desc limit 10 |
| | | </select> |
| | | <select id="getDataStatisticsCount" resultType="java.lang.Integer"> |
| | | SELECT COUNT(id) |