|
|
@@ -210,6 +210,7 @@ public class KanbanParser {
|
|
|
fieldNames.add(fieldName);
|
|
|
}
|
|
|
}
|
|
|
+ sql = removeLastSemicolon(sql);
|
|
|
checkCount(jdbc.getDataSource().getConnection(), sql);
|
|
|
List<Map<String, Object>> listMap = jdbc.listMap(sql);
|
|
|
if (CollectionUtils.isEmpty(listMap)) {
|
|
|
@@ -250,7 +251,7 @@ public class KanbanParser {
|
|
|
if (StringUtils.isEmpty(sql)) {
|
|
|
continue;
|
|
|
}
|
|
|
- sql = replaceParameters(sql, parameters, true);
|
|
|
+ sql = replaceParameters(removeLastSemicolon(sql), parameters, true);
|
|
|
checkCount(jdbc.getDataSource().getConnection(), sql);
|
|
|
Map<String, List<Object>> map = convert(jdbc.listMap(sql));
|
|
|
if (CollectionUtils.isEmpty(map)) {
|
|
|
@@ -311,7 +312,7 @@ public class KanbanParser {
|
|
|
if (StringUtils.isEmpty(sql)) {
|
|
|
continue;
|
|
|
}
|
|
|
- sql = replaceParameters(sql, parameters, true);
|
|
|
+ sql = replaceParameters(removeLastSemicolon(sql), parameters, true);
|
|
|
checkCount(jdbc.getDataSource().getConnection(), sql);
|
|
|
List<Map<String, Object>> listMap = jdbc.listMap(sql);
|
|
|
if (CollectionUtils.isEmpty(listMap)) {
|
|
|
@@ -368,9 +369,7 @@ public class KanbanParser {
|
|
|
PreparedStatement preparedStatement = null;
|
|
|
ResultSet resultSet = null;
|
|
|
try {
|
|
|
- if (sql.endsWith(";")) {
|
|
|
- sql = sql.substring(0, sql.length() - 1);
|
|
|
- }
|
|
|
+ sql = removeLastSemicolon(sql);
|
|
|
sql = "select count(1) from (" + sql + ")";
|
|
|
preparedStatement = connection.prepareStatement(sql);
|
|
|
resultSet = preparedStatement.executeQuery();
|
|
|
@@ -395,6 +394,16 @@ public class KanbanParser {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 删除 sql 结尾的分号
|
|
|
+ */
|
|
|
+ public String removeLastSemicolon(@NotEmpty("sql") String sql) {
|
|
|
+ if (sql.endsWith(";")) {
|
|
|
+ sql = sql.substring(0, sql.length() - 1);
|
|
|
+ }
|
|
|
+ return sql;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 将 List<Map<String, Object>> 转为 Map<String, List<Object>>
|
|
|
*
|