fix(数据源列表): 数据源列表按照类型名称和数据源名称升序排序,忽略大小写

This commit is contained in:
wisonic-s 2023-01-12 15:55:47 +08:00
parent d76933d6e8
commit 4ed513c798
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;
}