|
|
|
@ -119,10 +119,15 @@ public class MetadataSearchService { |
|
|
|
|
if (field != null) { |
|
|
|
|
TableField tableField = field.getAnnotation(TableField.class); |
|
|
|
|
if (tableField != null && StringUtils.hasText(tableField.value())) { |
|
|
|
|
//没有过滤条件时,order by前面会拼接and,导致查询报错
|
|
|
|
|
if(condition.getConditions().size()<=0){ |
|
|
|
|
queryWrapper.last("1=1 ORDER BY "+ tableField.value() + (sort.getSort().equalsIgnoreCase("asc") ? " ASC " :" DESC ")); |
|
|
|
|
}else { |
|
|
|
|
queryWrapper.orderBy(true, sort.getSort().equalsIgnoreCase("asc"), tableField.value()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return queryWrapper; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|