|
@@ -49,7 +49,6 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
/**
|
|
|
* todo 创建视图
|
|
|
*/
|
|
|
-// @Transactional
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zgmonth as " +
|
|
|
"SELECT i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y-%m') time FROM `dm_order_item` i " +
|
|
@@ -58,7 +57,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
"GROUP BY time,`zg_name` " +
|
|
|
"ORDER BY time DESC,SUM(num) DESC ",nativeQuery = true)
|
|
|
void addZgMonth(String stateDate,String endDate);
|
|
|
-// @Transactional
|
|
|
+
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zdmonth as " +
|
|
|
"SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y-%m') time FROM `dm_order_item` i " +
|
|
@@ -68,7 +67,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
"ORDER BY time DESC,SUM(num) ASC ",nativeQuery = true)
|
|
|
void addZdMonth(String stateDate,String endDate);
|
|
|
|
|
|
-// @Transactional
|
|
|
+
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zgyear as " +
|
|
|
"SELECT i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y') time FROM `dm_order_item` i " +
|
|
@@ -77,7 +76,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
"GROUP BY time,`zg_name` " +
|
|
|
"ORDER BY time DESC,SUM(num) DESC ",nativeQuery = true)
|
|
|
void addZgYear(String stateDate,String endDate);
|
|
|
-// @Transactional
|
|
|
+
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zdyear as " +
|
|
|
"SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y') time FROM `dm_order_item` i " +
|
|
@@ -87,7 +86,6 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
"ORDER BY time DESC,SUM(num) ASC ",nativeQuery = true)
|
|
|
void addZdYear(String stateDate,String endDate);
|
|
|
|
|
|
-// @Transactional
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zgday as " +
|
|
|
"SELECT i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y-%m-%d') time FROM `dm_order_item` i " +
|
|
@@ -96,7 +94,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
"GROUP BY time,`zg_name` " +
|
|
|
"ORDER BY time DESC,SUM(num) DESC ",nativeQuery = true)
|
|
|
void addZgDay(String stateDate,String endDate);
|
|
|
-// @Transactional
|
|
|
+
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zdday as " +
|
|
|
"SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y-%m-%d') time FROM `dm_order_item` i " +
|
|
@@ -110,18 +108,18 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
|
|
|
@Query(value = "CREATE VIEW zgweek as " +
|
|
|
"SELECT i.name as zg_name,SUM(i.num) as zg_num,DATE_FORMAT(create_date,'%Y-%u') week_time FROM `dm_order_item` i " +
|
|
|
"LEFT JOIN `dm_order_record` r ON i.bh = r.bh " +
|
|
|
- "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
|
|
|
- "GROUP BY DATE_FORMAT(create_date,'%u'),`zg_name` " +
|
|
|
- "ORDER BY DATE_FORMAT(create_date,'%u') DESC,SUM(num) DESC ",nativeQuery = true)
|
|
|
+ "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) AND create_date IS NOT NULL AND i.NAME IS NOT NULL " +
|
|
|
+ "GROUP BY week_time,`zg_name` " +
|
|
|
+ "ORDER BY week_time DESC,SUM(num) DESC ",nativeQuery = true)
|
|
|
void addZgWeek(String stateDate,String endDate);
|
|
|
- // @Transactional
|
|
|
+
|
|
|
@Modifying
|
|
|
@Query(value = "CREATE VIEW zdweek as " +
|
|
|
"SELECT i.name as zd_name,SUM(i.num) as zd_num,SUM(i.money) as money,DATE_FORMAT(create_date,'%Y-%u') week_time FROM `dm_order_item` i " +
|
|
|
"LEFT JOIN `dm_order_record` r ON i.bh = r.bh " +
|
|
|
- "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
|
|
|
- "GROUP BY DATE_FORMAT(create_date,'%u'),`zd_name` " +
|
|
|
- "ORDER BY DATE_FORMAT(create_date,'%u') DESC,SUM(num) ASC ",nativeQuery = true)
|
|
|
+ "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) AND create_date IS NOT NULL AND i.NAME IS NOT NULL " +
|
|
|
+ "GROUP BY week_time,`zd_name` " +
|
|
|
+ "ORDER BY week_time DESC,SUM(num) ASC ",nativeQuery = true)
|
|
|
void addZdWeek(String stateDate,String endDate);
|
|
|
|
|
|
/**
|