|
@@ -10,7 +10,14 @@
|
|
|
</select>
|
|
|
|
|
|
<select id="userDataSumGroupBy" resultType="com.fdkankan.manage.vo.response.DataGroupBySum">
|
|
|
- SELECT DATE_FORMAT(create_time,#{dateFormat}) AS groupKey, sum(amount) AS count FROM ${tb} WHERE rec_status = 'A'
|
|
|
+ SELECT DATE_FORMAT(create_time,#{dateFormat}) AS groupKey,
|
|
|
+ <if test="tb == t_order">
|
|
|
+ sum(total_amount) AS count
|
|
|
+ </if>
|
|
|
+ <if test="tb != t_order">
|
|
|
+ sum(amount) AS count
|
|
|
+ </if>
|
|
|
+ FROM ${tb} WHERE rec_status = 'A'
|
|
|
and create_time between #{startTime} and #{endTime}
|
|
|
<include refid="tbWhereSql"></include>
|
|
|
GROUP BY groupKey
|
|
@@ -27,7 +34,15 @@
|
|
|
</select>
|
|
|
<select id="userDataSumGroupByWeek" resultType="com.fdkankan.manage.vo.response.DataGroupBySum">
|
|
|
SELECT groupKey ,sum(amount) as count FROM (
|
|
|
- select amount,date_format(date_add(create_time,interval-(weekday(create_time ))day),'%Y-%m-%d') as groupKey
|
|
|
+ select
|
|
|
+
|
|
|
+ <if test="tb == t_order">
|
|
|
+ total_amount as amount
|
|
|
+ </if>
|
|
|
+ <if test="tb != t_order">
|
|
|
+ amount
|
|
|
+ </if>
|
|
|
+ ,date_format(date_add(create_time,interval-(weekday(create_time ))day),'%Y-%m-%d') as groupKey
|
|
|
from ${tb}
|
|
|
WHERE rec_status = 'A'
|
|
|
and create_time between #{startTime} and #{endTime}
|