| | |
| | | WHERE |
| | | cw.type = 2 AND cw.businessType = #{type} AND cw.code = #{code} |
| | | </select> |
| | | <select id="getDataStatisticsIncomeOrCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(r.createTime, '%Y-%m') AS monthTime,COUNT(o.id) AS amount,d.name AS userName |
| | | FROM t_revenue r |
| | | LEFT JOIN t_driver d ON r.userId = d.id |
| | | LEFT JOIN t_order o ON r.orderId = o.id |
| | | <where> |
| | | <if test="agentId != null"> |
| | | AND o.agentId = #{agentId} |
| | | </if> |
| | | <if test="monthDate != null and monthDate != ''"> |
| | | AND date_format(r.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%') |
| | | </if> |
| | | AND r.type = 1 |
| | | AND r.userType = 2 |
| | | </where> |
| | | GROUP BY monthTime,userName |
| | | </select> |
| | | |
| | | <select id="getDataStatisticsCommission" resultType="com.stylefeng.guns.modular.system.controller.resp.PerformanceTableResp"> |
| | | SELECT date_format(r.createTime, '%Y-%m') AS monthTime,SUM(r.amount) AS amount,d.name AS userName |
| | | FROM t_revenue r |
| | | LEFT JOIN t_driver d ON r.userId = d.id |
| | | LEFT JOIN t_order o ON r.orderId = o.id |
| | | <where> |
| | | <if test="agentId != null"> |
| | | AND o.agentId = #{agentId} |
| | | </if> |
| | | <if test="monthDate != null and monthDate != ''"> |
| | | AND date_format(r.createTime, '%Y-%m') LIKE concat('',#{monthDate},'%') |
| | | </if> |
| | | <if test="type != null"> |
| | | AND r.type = #{type} |
| | | </if> |
| | | AND r.userType = 2 |
| | | </where> |
| | | GROUP BY monthTime,userName |
| | | ORDER BY amount DESC |
| | | </select> |
| | | |
| | | </mapper> |