Skip to content

Commit

Permalink
fix(项目管理): 修改项目列表的排序方法
Browse files Browse the repository at this point in the history
  • Loading branch information
Somebody-JIAN authored and liuruibin committed Mar 27, 2024
1 parent 1f0e657 commit 74723d1
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,11 @@ public List<Project> getUserProject(ProjectRequest request, String sessionProjec
}

private void swapProject(List<Project> projectList, String sessionProjectId) {
int ownerProjectIndex = 0;
for (int i = 0; i < projectList.size(); i++) {
if (StringUtils.equals(projectList.get(i).getId(), sessionProjectId)) {
ownerProjectIndex = i;
break;
}
Project ownerProject = projectList.stream().filter(project -> StringUtils.equals(project.getId(), sessionProjectId)).findFirst().orElse(null);
if (ownerProject != null) {
projectList.remove(ownerProject);
projectList.add(0, ownerProject);
}
Collections.swap(projectList, 0, ownerProjectIndex);
}

public List<Project> getProjectByIds(List<String> ids) {
Expand Down

0 comments on commit 74723d1

Please sign in to comment.