|
|
@ -119,7 +119,12 @@ public class MetadataSearchService { |
|
|
|
if (field != null) { |
|
|
|
if (field != null) { |
|
|
|
TableField tableField = field.getAnnotation(TableField.class); |
|
|
|
TableField tableField = field.getAnnotation(TableField.class); |
|
|
|
if (tableField != null && StringUtils.hasText(tableField.value())) { |
|
|
|
if (tableField != null && StringUtils.hasText(tableField.value())) { |
|
|
|
queryWrapper.orderBy(true, sort.getSort().equalsIgnoreCase("asc"), 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()); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|