李进 vor 2 Jahren
Ursprung
Commit
7e512b4a6b
1 geänderte Dateien mit 0 neuen und 41 gelöschten Zeilen
  1. 0 41
      device-api-service/src/main/java/com/xy/config/MysqlSyncConfig.java

+ 0 - 41
device-api-service/src/main/java/com/xy/config/MysqlSyncConfig.java

@@ -1,41 +0,0 @@
-package com.xy.config;
-
-import com.xy.utils.DataTime;
-import lombok.AllArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.context.annotation.Bean;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.EncodedResource;
-import org.springframework.jdbc.datasource.init.ScriptUtils;
-import org.springframework.stereotype.Service;
-
-import javax.sql.DataSource;
-
-/**
- * 执行sql脚本
- */
-@Slf4j
-@Service
-@AllArgsConstructor
-public class MysqlSyncConfig {
-
-    private DataSource dataSource;
-
-    @Bean
-    public Boolean syncSql() {
-        try {
-            String time = DataTime.getSring("yyyyMMdd");
-            Resource classPathResource = new ClassPathResource(String.format("doc/%s.sql", time));
-            if (classPathResource.exists()) {
-                EncodedResource encodedResource = new EncodedResource(classPathResource, "utf-8");
-                ScriptUtils.executeSqlScript(dataSource.getConnection(), encodedResource);
-            }
-        } catch (Exception e) {
-            log.error("", e);
-            System.exit(1);
-        }
-        return true;
-    }
-
-}