blob: 1b5df6bd2ceaf7a5330c23d434ab1086e17f3d15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package com.nis.handler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.context.annotation.DependsOn;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import com.nis.service.AssetService;
import cn.hutool.log.Log;
/**
* 此类用于数据库的数据处理操作
* @author admin
*
*/
@Component
@Order(2)
public class TransferDataHandler implements CommandLineRunner {
private Log log = Log.get();
@Autowired
private SqlHandler sqlHandler;
@Override
public void run(String... args) throws Exception {
// 数据同步前相关新增表数据初始化
sqlHandler.initData();
log.info("init data successful");
// 新旧表数据同步
sqlHandler.transferData();
log.info("transfer data successful");
// 表清空数据
sqlHandler.removeData();
log.info("remove data successful");
}
}
|