王先生 2 gadi atpakaļ
vecāks
revīzija
e01e045fda

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/statement/repository/DmHaveDinnerRepository.java

@@ -295,10 +295,10 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     @Query(nativeQuery = true,value = "create view `DAY_DINING_STATEMENTS_TOP` as SELECT item.pid,item.name,COUNT(item.pid) as countPid,sum(item.price) as price,rec.create_date,item.seq FROM dm_order_record rec LEFT JOIN  dm_order_item item on rec.seq = item.seq WHERE item.pid is not NULL and rec.create_date BETWEEN ?1  AND ?2  GROUP BY item.pid ORDER BY countPid desc LIMIT 0,3 ")
     void createDayDiningStatementsTopThreeView(@Param("startTime") String startTime,@Param("nowTime") String nowTime,@Param("viewName") String viewName);
 
-    @Query(nativeQuery = true, value = "SELECT item.pid,item.name,COUNT(item.pid) as countPid,sum(item.price) as price,rec.create_date,item.seq FROM dm_order_record rec LEFT JOIN  dm_order_item item on rec.seq = item.seq WHERE item.pid is not NULL and rec.create_date BETWEEN ?1  AND ?2  GROUP BY item.pid ORDER BY countPid desc LIMIT 0,3")
+    @Query(nativeQuery = true, value = "SELECT rec.create_date,item.pid,item.name,COUNT(item.pid) as countPid,sum(item.price) as price,item.seq FROM (SELECT create_date,seq FROM dm_order_record WHERE create_date BETWEEN ?1 AND ?2) rec left join  dm_order_item item on rec.seq = item.seq WHERE item.pid is not NULL GROUP BY item.pid ORDER BY countPid DESC LIMIT 0,3")
     Page<List<Map<String,Object>>> selectTop(String startTime, String nowTime,Pageable pageable);
 
-    @Query(nativeQuery = true, value = "SELECT item.pid,item.name,COUNT(item.pid) as countPid,sum(item.price) as price,rec.create_date,item.seq FROM dm_order_record rec LEFT JOIN  dm_order_item item on rec.seq = item.seq WHERE item.pid is not NULL and rec.create_date BETWEEN ?1  AND ?2  GROUP BY item.pid ORDER BY countPid ASC LIMIT 0,3")
+    @Query(nativeQuery = true, value = "SELECT rec.create_date,item.pid,item.name,COUNT(item.pid) as countPid,sum(item.price) as price,item.seq FROM (SELECT create_date,seq FROM dm_order_record WHERE create_date BETWEEN ?1 AND ?2) rec left join  dm_order_item item on rec.seq = item.seq WHERE item.pid is not NULL GROUP BY item.pid ORDER BY countPid ASC LIMIT 0,3")
     Page<List<Map<String,Object>>> selectStop(String startTime, String nowTime,Pageable pageable);
     /**
      * 创建后三日视图