|
30 | 30 | importreactor.core.publisher.Flux; |
31 | 31 | importreactor.core.publisher.Mono; |
32 | 32 |
|
| 33 | +importjava.util.Comparator; |
33 | 34 | importjava.util.List; |
34 | 35 |
|
35 | 36 | importstaticorg.lowcoder.api.util.Pagination.fluxToPageResponseView; |
@@ -59,15 +60,21 @@ public class OrganizationController implements OrganizationEndpoints |
59 | 60 | publicMono<PageResponseView<?>>getOrganizationByUser(@PathVariableStringemail, |
60 | 61 | @RequestParam(required =false,defaultValue ="1")IntegerpageNum, |
61 | 62 | @RequestParam(required =false,defaultValue ="0")IntegerpageSize) { |
62 | | -Flux<?>flux; |
| 63 | +Flux<OrgView>flux; |
63 | 64 | if (commonConfig.getWorkspace().getMode() ==WorkspaceMode.SAAS) { |
64 | 65 | flux =userService.findByEmailDeep(email).flux().flatMap(user ->orgMemberService.getAllActiveOrgs(user.getId())) |
65 | 66 | .flatMap(orgMember ->organizationService.getById(orgMember.getOrgId())) |
66 | 67 | .map(OrgView::new).cache(); |
67 | 68 | }else { |
68 | | -flux =organizationService.getOrganizationInEnterpriseMode().flux().cache(); |
| 69 | +flux =organizationService.getOrganizationInEnterpriseMode().flux().map(OrgView::new).cache(); |
69 | 70 | } |
70 | | -returnfluxToPageResponseView(pageNum,pageSize,flux); |
| 71 | +varnewflux =flux.sort((OrgViewo1,OrgViewo2) -> { |
| 72 | +if (o1.getOrgName() ==null ||o2.getOrgName() ==null) { |
| 73 | +return0; |
| 74 | + } |
| 75 | +returno1.getOrgName().compareTo(o2.getOrgName()); |
| 76 | + }); |
| 77 | +returnfluxToPageResponseView(pageNum,pageSize,newflux); |
71 | 78 | } |
72 | 79 |
|
73 | 80 | @Override |
|