feat(系统设置): 项目选择器中的备选项目更换排序方法:当前使用项目排第一,其余按照名称排序

【github#29170 切换项目列表,当前项目默认排第一,其它项目按首字母排序】
https://www.tapd.cn/55049933/prong/stories/view/1155049933001014513
This commit is contained in:
song-tianyang 2024-03-01 14:00:25 +08:00 committed by 建国
parent c72d43e15d
commit b8ca3b5e96
2 changed files with 11 additions and 1 deletions

View File

@ -153,6 +153,7 @@
AND p.name LIKE #{proRequest.name, jdbcType=VARCHAR}
</if>
</where>
ORDER BY CONVERT(p.name USING gbk) COLLATE gbk_chinese_ci ASC
</select>
<select id="getSystemIdByProjectId" resultType="java.lang.String">
SELECT system_id

View File

@ -116,7 +116,16 @@ public class BaseProjectService {
request.setName(StringUtils.wrapIfMissing(request.getName(), "%"));
}
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders()));
return baseProjectMapper.getUserProject(request);
List<Project> returnList = baseProjectMapper.getUserProject(request);
int ownerProjectIndex = 0;
for (int i = 0; i < returnList.size(); i++) {
if (StringUtils.equals(returnList.get(i).getId(), SessionUtils.getCurrentProjectId())) {
ownerProjectIndex = i;
break;
}
}
Collections.swap(returnList, 0, ownerProjectIndex);
return returnList;
}
public List<Project> getProjectByIds(List<String> ids) {