优化代码

This commit is contained in:
SanLi
2020-09-14 10:02:25 +08:00
parent e890b82dd2
commit 0f48dc7081
9 changed files with 126 additions and 79 deletions

View File

@@ -103,5 +103,4 @@ public class DefaultConstants implements Serializable {
*/
public static final String PHOENIX_SYS_NAMESPACE_MAPPING = "phoenix.schema.mapSystemTablesToNamespace";
}

View File

@@ -1,3 +1,20 @@
/*
* screw-core - 简洁好用的数据库表结构文档生成工具
* Copyright © 2020 SanLi (qinggang.zuo@gmail.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cn.smallbun.screw.core.query.phoenix;
import cn.smallbun.screw.core.exception.QueryException;
@@ -22,9 +39,7 @@ import static cn.smallbun.screw.core.constant.DefaultConstants.PERCENT_SIGN;
/**
* @author xielongwang
* @create 2020/8/19 4:53 下午
* @email siaron.wang@gmail.com
* @description
* Created by siaron.wang@gmail.com 2020/8/19 4:53 下午
*/
public class PhoenixDataBaseQuery extends AbstractDatabaseQuery {
@@ -45,7 +60,7 @@ public class PhoenixDataBaseQuery extends AbstractDatabaseQuery {
try {
//查询
resultSet = getMetaData().getTables("", getSchema(), PERCENT_SIGN,
new String[]{"TABLE"});
new String[] { "TABLE" });
//映射
return Mapping.convertList(resultSet, PhoenixlTableModel.class);
} catch (SQLException e) {
@@ -63,7 +78,8 @@ public class PhoenixDataBaseQuery extends AbstractDatabaseQuery {
//查询
resultSet = getMetaData().getColumns("", getSchema(), table, PERCENT_SIGN);
//映射
List<PhoenixColumnModel> list = Mapping.convertList(resultSet, PhoenixColumnModel.class);
List<PhoenixColumnModel> list = Mapping.convertList(resultSet,
PhoenixColumnModel.class);
//处理columnName
list.forEach(model -> model.setColumnType(model.getTypeName()));
@@ -95,7 +111,6 @@ public class PhoenixDataBaseQuery extends AbstractDatabaseQuery {
}
}
@Override
public List<? extends PrimaryKey> getPrimaryKeys() throws QueryException {
ResultSet resultSet = null;

View File

@@ -1,3 +1,20 @@
/*
* screw-core - 简洁好用的数据库表结构文档生成工具
* Copyright © 2020 SanLi (qinggang.zuo@gmail.com)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package cn.smallbun.screw.core.query.phoenix.model;
import cn.smallbun.screw.core.metadata.Database;
@@ -5,9 +22,7 @@ import lombok.Data;
/**
* @author xielongwang
* @create 2020/8/19 4:55 下午
* @email siaron.wang@gmail.com
* @description
* Created by siaron.wang@gmail.com 2020/8/19 4:55 下午
*/
@Data
public class PhoenixSqlDatabaseModel implements Database {

View File

@@ -1,6 +1,6 @@
#
# screw-core - \u7B80\u6D01\u597D\u7528\u7684\u6570\u636E\u5E93\u8868\u7ED3\u6784\u6587\u6863\u751F\u6210\u5DE5\u5177
# Copyright \u00A9 2020 SanLi (qinggang.zuo@gmail.com)
# screw-core - 简洁好用的数据库表结构文档生成工具
# Copyright © 2020 SanLi (qinggang.zuo@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by

View File

@@ -1,3 +1,21 @@
#
# screw-core - 简洁好用的数据库表结构文档生成工具
# Copyright © 2020 SanLi (qinggang.zuo@gmail.com)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
driver=org.apache.phoenix.jdbc.PhoenixDriver
url=jdbc:phoenix:xxxx:2181
username=username

View File

@@ -270,8 +270,8 @@ public class RunDocMojo extends AbstractMojo {
}
//phoenix
if (JdbcUtils.getDbType(getJdbcUrl()).equals(DatabaseType.PHOENIX)) {
hikariConfig.addDataSourceProperty(PHOENIX_SYS_NAMESPACE_MAPPING,true);
hikariConfig.addDataSourceProperty(PHOENIX_NAMESPACE_MAPPING,true);
hikariConfig.addDataSourceProperty(PHOENIX_SYS_NAMESPACE_MAPPING, true);
hikariConfig.addDataSourceProperty(PHOENIX_NAMESPACE_MAPPING, true);
}
//oracle
if (JdbcUtils.getDbType(getJdbcUrl()).equals(DatabaseType.ORACLE)) {