Commit 973a9d15 by 吴佳

查询数据行数时才将BigDecimal转为Integer,查询列表数据时不转换

parent ff6564b4
...@@ -474,9 +474,13 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession ...@@ -474,9 +474,13 @@ public class MyBatisDaoSession extends AbstractDaoSession implements IDaoSession
for (int i = 0; i < result.size(); i++) { for (int i = 0; i < result.size(); i++) {
Map<String, Object> map1 = result.get(i); Map<String, Object> map1 = result.get(i);
Set<Map.Entry<String, Object>> entries = map1.entrySet(); Set<Map.Entry<String, Object>> entries = map1.entrySet();
for (Map.Entry<String, Object> entry : entries) { //结果集只有1列数据,切查询语句中包含COUNT 函数名,则判断SQL为查询数据行数
if (entry.getValue() instanceof BigDecimal) { //将结果集值类型从BigDecimal 转换为Integer
entry.setValue(((BigDecimal) entry.getValue()).intValue()); if (entries.size() == 1 && sql.toUpperCase().contains("COUNT")){
for (Map.Entry<String, Object> entry : entries) {
if (entry.getValue() instanceof BigDecimal) {
entry.setValue(((BigDecimal) entry.getValue()).intValue());
}
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment