Merge pull request #4365 from dataease/pr@dev@fix_datasource_sort

fix(数据源列表): 数据源列表按照类型名称和数据源名称升序排序,忽略大小写
This commit is contained in:
wisonic-s 2023-01-12 15:57:24 +08:00 committed by GitHub
commit 06da8a2aa1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -125,7 +125,7 @@
</if>
</where>
<if test="sort != null">
order by ${sort}
order by #{sort}
</if>
</select>

View File

@ -158,9 +158,17 @@ public class DatasourceService {
}
public List<DatasourceDTO> getDatasourceList(DatasourceUnionRequest request) throws Exception {
request.setSort("type,name");
List<DatasourceDTO> datasourceDTOS = extDataSourceMapper.queryUnion(request);
datasourceDTOS.forEach(this::datasourceTrans);
if (StringUtils.isBlank(request.getSort())) {
datasourceDTOS.sort((o1,o2) -> {
int tmp = StringUtils.compareIgnoreCase(o1.getTypeDesc(), o2.getTypeDesc());
if (tmp == 0) {
tmp = StringUtils.compareIgnoreCase(o1.getName(), o2.getName());
}
return tmp;
});
}
return datasourceDTOS;
}