From 0bdfffaef3b003ea81bc2415ce583e555489ae24 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期日, 24 九月 2023 10:25:17 +0800 Subject: [PATCH] 添加自动查询数据库功能 --- src/main/java/com/lf/server/config/InitConfig.java | 20 +++++++++++++++----- 1 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/lf/server/config/InitConfig.java b/src/main/java/com/lf/server/config/InitConfig.java index 7ac27e7..7f8fbde 100644 --- a/src/main/java/com/lf/server/config/InitConfig.java +++ b/src/main/java/com/lf/server/config/InitConfig.java @@ -4,14 +4,16 @@ import com.lf.server.helper.*; import com.lf.server.service.all.TestService; import com.lf.server.service.all.UploadAttachService; +import com.lf.server.service.show.AutoQueryService; import com.lf.server.service.sys.ArgsService; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.core.env.Environment; import org.springframework.stereotype.Component; + +import javax.annotation.Resource; /** * 鍒濆鍖栧畬鎴愰厤缃被 @@ -21,17 +23,20 @@ public class InitConfig implements ApplicationRunner { private final static Log log = LogFactory.getLog(InitConfig.class); - @Autowired + @Resource PathHelper pathHelper; - @Autowired + @Resource ArgsService argsService; - @Autowired + @Resource Environment env; - //@Autowired + //@Resource //TestService testService; + + @Resource + AutoQueryService autoQueryService; @Override public void run(ApplicationArguments args) { @@ -46,6 +51,11 @@ argsService.initSettingData(); log.info("***************** 绯荤粺鍚姩瀹屾瘯 *****************" + "\n"); + + String autoQuery = env.getProperty("sys.autoQuery"); + if (StaticData.S1.equals(autoQuery)) { + autoQueryService.autoQuery(); + } } catch (Exception ex) { log.error(ex.getMessage(), ex); } -- Gitblit v1.9.3