lyhzzz 2 jaren geleden
bovenliggende
commit
b40623b582

+ 3 - 1
src/main/java/com/fdkankan/manage/service/impl/OperLogServiceImpl.java

@@ -47,7 +47,9 @@ public class OperLogServiceImpl extends MongodbBaseServiceImpl<OperLog> implemen
         if(Objects.nonNull(param.getEndTime())){
             createTimeCri.lte(param.getEndTime());
         }
-
+        if(createTimeCri != null){
+            query.addCriteria(createTimeCri);
+        }
         //默认按操作时间降序排序
         param.setOrderBy("createTime");
 

+ 17 - 2
src/main/resources/mapper/manage/DataMapper.xml

@@ -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}