chengyiqun
2019-09-20 18:32:05 +08:00
这个之前我也碰到过, 通过客户名称定位客户时, 本来就是模糊查询(不走索引) 包一层更慢. 索性手动分页, 计算好 limit 和 offset... 快多了, 原本直接服务超时, 改过以后, 400ms.
```java
Integer count;
if ( (
"2".equals(qryInMap.get("custTypeFlag")) || "3".equals(qryInMap.get("custTypeFlag"))
) &&
(
!ObjectIsNull.check(qryInMap.get(Constants.HUMP_PROD_INST_ID)) || !ObjectIsNull.check(qryInMap.get(Constants.HUMP_ACC_NBR)) || !ObjectIsNull.check(qryInMap.get(Constants.HUMP_ACCOUNT))
)
) {
List<Long> custIdsList1 = this.selectList(null, QRY_CUST_LIST_NAME_SPACE + ".qryUseCustIdsOrPayCustIdsByProdInst", qryInParamMap);
qryInParamMap.put("custIds", custIdsList1);
qryInParamMap.remove(Constants.HUMP_PROD_INST_ID);
qryInParamMap.remove(Constants.HUMP_ACC_NBR);
qryInParamMap.remove(Constants.HUMP_ACCOUNT);
qryInParamMap.remove("custTypeFlag");
count = this.selectOne(null, QRY_CUST_LIST_NAME_SPACE + ".countCustWithoutParam", qryInParamMap);
} else {
count = this.selectOne(null, QRY_CUST_LIST_NAME_SPACE + ".countCustWithoutParam", qryInParamMap);
}
if (pageMap != null) {
pageMap.setTotalRecord(count);
pageMap.setTotalPage(count % pageMap.getPageSize() == 0? count/pageMap.getPageSize() : count/pageMap.getPageSize() + 1);
if (count == 0 || (pageMap.getStartNum() > count)) {
return new ArrayList<Map<String,Object>>();
}
qryInParamMap.put("startNum", pageMap.getStartNum());
qryInParamMap.put("pageSize", pageMap.getPageSize());
} else {
// 兼容政企客户类型不传 分页
if (count == 0) {
return new ArrayList<Map<String,Object>>();
}
qryInParamMap.put("startNum", 0);
qryInParamMap.put("pageSize", 65535);
}
List<Long> custIdsList = this.selectList(null, QRY_CUST_LIST_NAME_SPACE + ".queryCustIdsWithoutParam", qryInParamMap);
qryInParamMap.put("custIds", custIdsList);
List<Map<String, Object>> customers = this.selectList(null, QRY_CUST_LIST_NAME_SPACE + ".queryCustListWithCustIds", qryInParamMap);
```