修复综合浏览查询结果列表中自定义表头排序配置失效的bug

master
xiong_cl 8 months ago
parent 0747e4f74f
commit 87bdabb8f5
  1. 7
      shandan-browser/src/main/java/com/keyware/shandan/browser/service/MetadataSearchService.java

@ -119,7 +119,12 @@ public class MetadataSearchService {
if (field != null) {
TableField tableField = field.getAnnotation(TableField.class);
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());
}
}
}
}