|
@@ -0,0 +1,27 @@
|
|
|
+package com.rongwei.safecommon.config;
|
|
|
+
|
|
|
+import com.rongwei.commonservice.service.RedisService;
|
|
|
+import com.rongwei.rwadmincommon.system.domain.SysOrganizationDo;
|
|
|
+import com.rongwei.rwadmincommon.system.service.SysOrganizationService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.ApplicationArguments;
|
|
|
+import org.springframework.boot.ApplicationRunner;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Component
|
|
|
+public class CxCommonRunnerImpl implements ApplicationRunner {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysOrganizationService sysOrganizationService;
|
|
|
+ @Autowired
|
|
|
+ private RedisService redisService;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void run(ApplicationArguments args) throws Exception {
|
|
|
+ System.out.println("服务启动公共初始化");
|
|
|
+ // 查询所有组织机构数据,并缓存到Redis中
|
|
|
+ List<SysOrganizationDo> orgdos = sysOrganizationService.list();
|
|
|
+ redisService.redisCatchInit("allOrgs",orgdos,0);
|
|
|
+ }
|
|
|
+}
|