mirror of
https://github.com/alibaba/druid.git
synced 2023-03-04 19:17:16 +00:00
修复orderType判断逻辑错误
This commit is contained in:
@@ -59,7 +59,9 @@ public final class DruidStatService implements DruidStatServiceMBean {
|
||||
|
||||
private final static int DEFAULT_PAGE = 1;
|
||||
private final static int DEFAULT_PER_PAGE_COUNT = Integer.MAX_VALUE;
|
||||
private static final String DEFAULT_ORDER_TYPE = "asc";
|
||||
private static final String ORDER_TYPE_DESC = "desc";
|
||||
private static final String ORDER_TYPE_ASC = "asc";
|
||||
private static final String DEFAULT_ORDER_TYPE = ORDER_TYPE_ASC;
|
||||
private static final String DEFAULT_ORDERBY = "SQL";
|
||||
|
||||
private DruidStatService(){
|
||||
@@ -220,7 +222,7 @@ public final class DruidStatService implements DruidStatServiceMBean {
|
||||
Integer page = DEFAULT_PAGE;
|
||||
Integer perPageCount = DEFAULT_PER_PAGE_COUNT;
|
||||
if (parameters == null) {
|
||||
orderBy = DEFAULT_ORDER_TYPE;
|
||||
orderBy = DEFAULT_ORDERBY;
|
||||
orderType = DEFAULT_ORDER_TYPE;
|
||||
page = DEFAULT_PAGE;
|
||||
perPageCount = DEFAULT_PER_PAGE_COUNT;
|
||||
@@ -241,13 +243,13 @@ public final class DruidStatService implements DruidStatServiceMBean {
|
||||
orderBy = orderBy == null ? DEFAULT_ORDERBY : orderBy;
|
||||
orderType = orderType == null ? DEFAULT_ORDER_TYPE : orderType;
|
||||
|
||||
if (!"desc".equals(orderType)) {
|
||||
orderType = DEFAULT_ORDER_TYPE;
|
||||
if (! ORDER_TYPE_DESC.equals(orderType)) {
|
||||
orderType = ORDER_TYPE_ASC;
|
||||
}
|
||||
|
||||
// orderby the statData array
|
||||
if (orderBy != null && orderBy.trim().length() != 0) {
|
||||
Collections.sort(array, new MapComparator<String, Object>(orderBy, DEFAULT_ORDER_TYPE.equals(orderType)));
|
||||
if (orderBy.trim().length() != 0) {
|
||||
Collections.sort(array, new MapComparator<String, Object>(orderBy, ORDER_TYPE_DESC.equals(orderType)));
|
||||
}
|
||||
|
||||
// page
|
||||
|
||||
Reference in New Issue
Block a user