|
@@ -6,12 +6,14 @@ import com.customer.config.GenConfig;
|
|
import com.customer.mapper.TableInfoMapper;
|
|
import com.customer.mapper.TableInfoMapper;
|
|
import com.customer.pojo.TableInfo;
|
|
import com.customer.pojo.TableInfo;
|
|
import com.customer.service.ITableInfoService;
|
|
import com.customer.service.ITableInfoService;
|
|
|
|
+import com.customer.vo.TableInfoVO;
|
|
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 org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.StringUtils;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.sql.SQLException;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
@@ -23,6 +25,9 @@ public class TableInfoServiceImpl implements ITableInfoService {
|
|
@Resource
|
|
@Resource
|
|
private TableInfoMapper tableInfoMapper;
|
|
private TableInfoMapper tableInfoMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private DynamicDataSource dynamicDataSource;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void createMysqlDataBase(Map<String, Object> map) {
|
|
public void createMysqlDataBase(Map<String, Object> map) {
|
|
@@ -97,6 +102,16 @@ public class TableInfoServiceImpl implements ITableInfoService {
|
|
return tableInfoMapper.mysqlTableExist(dataBaseName,tableName);
|
|
return tableInfoMapper.mysqlTableExist(dataBaseName,tableName);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public List<TableInfoVO> tableInfoList(String databaseName) throws SQLException {
|
|
|
|
+ if(StringUtils.hasLength(databaseName)){
|
|
|
|
+ return tableInfoMapper.tableInfoList(databaseName);
|
|
|
|
+ }else {
|
|
|
|
+ String database = dynamicDataSource.getConnection().getCatalog();
|
|
|
|
+ return tableInfoMapper.tableInfoList(database);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public int sqlServerTableExist(String dataBaseName,String tableName) {
|
|
public int sqlServerTableExist(String dataBaseName,String tableName) {
|
|
StringBuilder stringBuilder = new StringBuilder();
|
|
StringBuilder stringBuilder = new StringBuilder();
|