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