mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
修复DB工具分页查询的时候oracle数据库会把ROWNUM_也带出来问题
This commit is contained in:
parent
186289c979
commit
eb370bf32e
@ -20,6 +20,7 @@
|
||||
* 【core 】 修复ReflectUtil 反射方法中桥接判断问题(issue#2625@Github)
|
||||
* 【poi 】 修复ExcelWriter导出List<Map>引起的个数混乱问题(issue#2627@Github)
|
||||
* 【poi 】 修复ExcelReader读取时间变成12小时形式问题(issue#I5Q1TW@Gitee)
|
||||
* 【db 】 修复DB工具分页查询的时候oracle数据库会把ROWNUM_也带出来问题(issue#2618@Github)
|
||||
|
||||
-------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
@ -35,8 +35,8 @@ public class OracleDialect extends AnsiSqlDialect {
|
||||
return find
|
||||
.insertPreFragment("SELECT * FROM ( SELECT row_.*, rownum rownum_ from ( ")
|
||||
.append(" ) row_ where rownum <= ").append(startEnd[1])//
|
||||
.append(") table_alias")//
|
||||
.append(" where table_alias.rownum_ > ").append(startEnd[0]);//
|
||||
.append(") table_alias_")//
|
||||
.append(" where table_alias_.rownum_ > ").append(startEnd[0]);//
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,9 +149,16 @@ public class HandleHelper {
|
||||
*/
|
||||
public static <T extends Entity> T handleRow(T row, int columnCount, ResultSetMetaData meta, ResultSet rs, boolean withMetaInfo) throws SQLException {
|
||||
int type;
|
||||
String columnLabel;
|
||||
for (int i = 1; i <= columnCount; i++) {
|
||||
type = meta.getColumnType(i);
|
||||
row.put(meta.getColumnLabel(i), getColumnValue(rs, i, type, null));
|
||||
columnLabel = meta.getColumnLabel(i);
|
||||
if("rownum_".equalsIgnoreCase(columnLabel)){
|
||||
// issue#2618@Github
|
||||
// 分页时会查出rownum字段,此处忽略掉读取
|
||||
continue;
|
||||
}
|
||||
row.put(columnLabel, getColumnValue(rs, i, type, null));
|
||||
}
|
||||
if (withMetaInfo) {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user