Browse Source

迁移数据库

王先生 2 years ago
parent
commit
6a7d30d9b1

+ 2 - 2
eladmin-common/src/main/java/me/zhengjie/config/SwaggerConfig.java

@@ -82,8 +82,8 @@ public class SwaggerConfig {
 
     private ApiInfo apiInfo() {
         return new ApiInfoBuilder()
-                .description("一个简单且易上手的 Spring boot 后台管理框架")
-                .title("EL-ADMIN 接口文档")
+                .description("接口管理框架")
+                .title("智慧餐饮 接口文档")
                 .version("2.4")
                 .build();
     }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/camera/repository/DmCameraRepository.java

@@ -28,6 +28,6 @@ import org.springframework.data.repository.query.Param;
 **/
 public interface DmCameraRepository extends JpaRepository<DmCamera, Long>, JpaSpecificationExecutor<DmCamera> {
 
-    @Query(value = "select count(*) from dm_camera where code =:code and if((!ISNULL(:id) and :id!=''),id!= :id,1=1)",nativeQuery = true)
+    @Query(value = "select count(*) from dm_camera where code =:code and if( :id is not null ,id= :id,1=1)",nativeQuery = true)
     int checkCode(@Param("code") String code, @Param("id") Long id);
 }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/device/repository/DmDeviceRepository.java

@@ -27,6 +27,6 @@ import org.springframework.data.repository.query.Param;
 * @date 2021-04-20
 **/
 public interface DmDeviceRepository extends JpaRepository<DmDevice, Long>, JpaSpecificationExecutor<DmDevice> {
-   @Query(value = "select count(*) from dm_device where code =:code and if((!ISNULL(:id) and :id!=''),id!= :id,1=1)",nativeQuery = true)
+   @Query(value = "select count(*) from dm_device where code =:code and if(:id is not null,id!= :id,1=1)",nativeQuery = true)
     int checkCode(@Param("code") String code, @Param("id") Long id);
 }

+ 1 - 0
eladmin-system/src/main/java/me/zhengjie/modules/dm/order/service/impl/DmOrderRecordServiceImpl.java

@@ -15,6 +15,7 @@
 */
 package me.zhengjie.modules.dm.order.service.impl;
 
+import cn.hutool.core.util.ObjectUtil;
 import me.zhengjie.modules.dm.daypc.repository.DmDayPcRepository;
 import me.zhengjie.modules.dm.order.domain.DmOrderItem;
 import me.zhengjie.modules.dm.order.domain.DmOrderRecord;

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

@@ -14,6 +14,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     @Modifying
     @Query(value = "DROP VIEW IF \\EXISTS `zgmonth`",nativeQuery = true)
     void dropByZgMonth();
+
     @Transactional
     @Modifying
     @Query(value = "DROP VIEW IF \\EXISTS `zdmonth`",nativeQuery = true)
@@ -23,6 +24,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     @Modifying
     @Query(value = "DROP VIEW IF \\EXISTS zgyear",nativeQuery = true)
     void dropByZgYear();
+
     @Transactional
     @Modifying
     @Query(value = "DROP VIEW  IF \\EXISTS zdyear",nativeQuery = true)
@@ -32,6 +34,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     @Modifying
     @Query(value = "DROP VIEW  IF \\EXISTS `zgday`",nativeQuery = true)
     void dropByZgDay();
+
     @Transactional
     @Modifying
     @Query(value = "DROP VIEW IF \\EXISTS `zdday`",nativeQuery = true)
@@ -41,6 +44,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     @Modifying
     @Query(value = "DROP VIEW IF \\EXISTS `zgweek`",nativeQuery = true)
     void dropByZgWeek();
+
     @Transactional
     @Modifying
     @Query(value = "DROP VIEW IF \\EXISTS `zdweek`",nativeQuery = true)
@@ -50,7 +54,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
      * todo 创建视图
      */
     @Modifying
-    @Query(value = "CREATE VIEW  zgmonth as " +
+    @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 " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
             "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
@@ -59,7 +63,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     void addZgMonth(String stateDate,String endDate);
 
     @Modifying
-    @Query(value = "CREATE VIEW  zdmonth as " +
+    @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 " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
             "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
@@ -69,7 +73,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
 
 
     @Modifying
-    @Query(value = "CREATE VIEW  zgyear as " +
+    @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 " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
             "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
@@ -78,7 +82,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     void addZgYear(String stateDate,String endDate);
 
     @Modifying
-    @Query(value = "CREATE VIEW  zdyear as " +
+    @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 " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
             "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
@@ -87,7 +91,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     void addZdYear(String stateDate,String endDate);
 
     @Modifying
-    @Query(value = "CREATE VIEW  zgday as " +
+    @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 " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
             "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
@@ -96,7 +100,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     void addZgDay(String stateDate,String endDate);
 
     @Modifying
-    @Query(value = "CREATE VIEW  zdday as " +
+    @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 " +
             "LEFT JOIN `dm_order_record` r ON  i.bh = r.bh " +
             "WHERE if(:stateDate != '' and :endDate !='',create_date between :stateDate and :endDate,1=1) " +
@@ -105,7 +109,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     void addZdDay(String stateDate,String endDate);
 
     @Modifying
-    @Query(value = "CREATE VIEW  zgweek as " +
+    @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)  AND create_date IS NOT NULL AND i.NAME IS NOT NULL " +
@@ -114,7 +118,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
     void addZgWeek(String stateDate,String endDate);
 
     @Modifying
-    @Query(value = "CREATE VIEW  zdweek as " +
+    @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)  AND create_date IS NOT NULL AND i.NAME IS NOT NULL " +
@@ -151,6 +155,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
                     "WHERE 3> (SELECT COUNT(*) from zgyear b WHERE a.time = b.time and a.zg_num < b.zg_num)" +
                     ")a ",nativeQuery = true)
     Page<DmHaveDinner> selectByZgYear(Pageable pageable);
+    
     @Query(value = "SELECT id,zg_name,zg_num,CONCAT( time, '-01-01 00:00:00' ) time,CAST(money AS DECIMAL(15,2)) money,zd_name,zd_num,week_time FROM("+
             "SELECT @id \\:= @id+1 as id,zd_name,zd_num,time,money,null as zg_name,0 as zg_num,null as week_time from zdyear a " +
             "WHERE 1> (SELECT COUNT(*) from (SELECT @id \\:=0) r,zdyear b WHERE a.time = b.time and a.zd_num > b.zd_num))a ",
@@ -185,6 +190,7 @@ public interface DmHaveDinnerRepository extends JpaRepository<DmHaveDinner,Integ
                     "WHERE 3> (SELECT COUNT(*) from zgweek b WHERE a.time = b.time and a.zg_num < b.zg_num)" +
                     ")a ",nativeQuery = true)
     Page<DmHaveDinner> selectByZgWeek(Pageable pageable);
+
     @Query(value = "SELECT id,zg_name,zg_num, time,CAST(money AS DECIMAL(15,2)) money,zd_name,zd_num,week_time FROM("+//CONCAT( time, '-00 00:00:00' )
             "SELECT @id \\:= @id+1 as id,zd_name,zd_num,null as time,money,null as zg_name,0 as zg_num,week_time from zdweek a " +
             "WHERE 1> (SELECT COUNT(*) from (SELECT @id \\:=0) r,zdweek b WHERE a.week_time = b.week_time and a.zd_num > b.zd_num))a ",

+ 2 - 2
eladmin-system/src/main/java/me/zhengjie/modules/dm/user/rest/DmUserController.java

@@ -136,8 +136,8 @@ public class DmUserController {
     }
 
     @GetMapping(value="/findNotBindUser")
-    @Log("查询未绑定账号的会议用户")
-    @ApiOperation("查询未绑定账号的会议用户")
+    @Log("查询未绑定卡号的餐饮用户")
+    @ApiOperation("查询未绑定卡号的餐饮用户")
     public ResponseEntity<Object> findNotBindUser(String userId){
         return new ResponseEntity<>(dmUserService.findNotBindUser(userId),HttpStatus.OK);
     }

+ 1 - 1
eladmin-system/src/main/java/me/zhengjie/modules/dm/video/rest/DmVideoController.java

@@ -31,7 +31,7 @@ public class DmVideoController {
     }
 
     @PostMapping("/pictures")
-    @ApiOperation("上传图片")
+    @ApiOperation("上传视频")
     public ResponseEntity<Object> upload(@RequestParam MultipartFile file){
         // 判断文件是否为图片
         String suffix = FileUtil.getExtensionName(file.getOriginalFilename());

+ 3 - 3
eladmin-system/src/main/resources/config/application-dev.yml

@@ -7,9 +7,9 @@ spring:
 #      url: jdbc:log4jdbc:mysql://114.55.24.6:3308/dm_restaurant?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
 #      username: root
 #      password: shimao@123
-      url: jdbc:log4jdbc:mysql://47.101.34.182:3306/dm_restaurant?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
-      username: dev
-      password: root
+      url: jdbc:log4jdbc:mysql://10.23.39.230:13306/dm_restaurant?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false
+      username: dm_restaurant
+      password: V24U7Khu
       # 初始连接数
       initial-size: 5
       # 最小连接数