Skip to content

Commit d302efe

Browse files
dragonpooludomikula
authored andcommitted
Sort organization in login screen
1 parent 7c48ccd commit d302efe

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/usermanagement/OrganizationController.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import reactor.core.publisher.Flux;
3131
import reactor.core.publisher.Mono;
3232

33+
import java.util.Comparator;
3334
import java.util.List;
3435

3536
import static org.lowcoder.api.util.Pagination.fluxToPageResponseView;
@@ -59,15 +60,21 @@ public class OrganizationController implements OrganizationEndpoints
5960
public Mono<PageResponseView<?>> getOrganizationByUser(@PathVariable String email,
6061
@RequestParam(required = false, defaultValue = "1") Integer pageNum,
6162
@RequestParam(required = false, defaultValue = "0") Integer pageSize) {
62-
Flux<?> flux;
63+
Flux<OrgView> flux;
6364
if (commonConfig.getWorkspace().getMode() == WorkspaceMode.SAAS) {
6465
flux = userService.findByEmailDeep(email).flux().flatMap(user -> orgMemberService.getAllActiveOrgs(user.getId()))
6566
.flatMap(orgMember -> organizationService.getById(orgMember.getOrgId()))
6667
.map(OrgView::new).cache();
6768
} else {
68-
flux = organizationService.getOrganizationInEnterpriseMode().flux().cache();
69+
flux = organizationService.getOrganizationInEnterpriseMode().flux().map(OrgView::new).cache();
6970
}
70-
return fluxToPageResponseView(pageNum, pageSize, flux);
71+
var newflux = flux.sort((OrgView o1, OrgView o2) -> {
72+
if (o1.getOrgName() == null || o2.getOrgName() == null) {
73+
return 0;
74+
}
75+
return o1.getOrgName().compareTo(o2.getOrgName());
76+
});
77+
return fluxToPageResponseView(pageNum, pageSize, newflux);
7178
}
7279

7380
@Override

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy