修改添加
parent
50590e3fa8
commit
788efab769
|
@ -96,14 +96,8 @@ public class SourceController extends BaseController {
|
||||||
//同步资产结构
|
//同步资产结构
|
||||||
@PostMapping("/structure")
|
@PostMapping("/structure")
|
||||||
public Result structure(@RequestBody Source source) throws ServletException {
|
public Result structure(@RequestBody Source source) throws ServletException {
|
||||||
if(source.getDatabaseType().equals("mysql")){
|
|
||||||
return toAjax(sourceService.structure(source));
|
return toAjax(sourceService.structure(source));
|
||||||
}
|
}
|
||||||
if(source.getDatabaseType().equals("redis")){
|
|
||||||
return toAjax(sourceService.redis(source));
|
|
||||||
}
|
|
||||||
return toAjax(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.muyu.domain.Structure;
|
||||||
import com.muyu.domain.TableInfo;
|
import com.muyu.domain.TableInfo;
|
||||||
import com.muyu.domain.req.SourceReq;
|
import com.muyu.domain.req.SourceReq;
|
||||||
import groovy.lang.Lazy;
|
import groovy.lang.Lazy;
|
||||||
|
import lombok.extern.java.Log;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
|
@ -26,6 +27,7 @@ import java.util.Date;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
|
@Log
|
||||||
@Service
|
@Service
|
||||||
public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> implements SourceService {
|
public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> implements SourceService {
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -124,6 +126,7 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
||||||
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + source.getConnectionParams();
|
String url = "jdbc:" + databaseType + "://" + host + ":" + port + "/" + databaseName + "?" + source.getConnectionParams();
|
||||||
String user = source.getUsername();
|
String user = source.getUsername();
|
||||||
String password = source.getPassword();
|
String password = source.getPassword();
|
||||||
|
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
conn = DriverManager.getConnection(url, user, password);
|
conn = DriverManager.getConnection(url, user, password);
|
||||||
|
@ -168,6 +171,7 @@ public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> impleme
|
||||||
rowCount++;
|
rowCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info("添加的表名有"+tableName);
|
||||||
TableInfo build = TableInfo.builder()
|
TableInfo build = TableInfo.builder()
|
||||||
.basicId(source.getId())
|
.basicId(source.getId())
|
||||||
.tableName(tableName)
|
.tableName(tableName)
|
||||||
|
|
Loading…
Reference in New Issue