File tree 1 file changed +10
-3
lines changed
server/api-service/lowcoder-server/src/main/java/org/lowcoder/api/usermanagement
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 30
30
import reactor .core .publisher .Flux ;
31
31
import reactor .core .publisher .Mono ;
32
32
33
+ import java .util .Comparator ;
33
34
import java .util .List ;
34
35
35
36
import static org .lowcoder .api .util .Pagination .fluxToPageResponseView ;
@@ -59,15 +60,21 @@ public class OrganizationController implements OrganizationEndpoints
59
60
public Mono <PageResponseView <?>> getOrganizationByUser (@ PathVariable String email ,
60
61
@ RequestParam (required = false , defaultValue = "1" ) Integer pageNum ,
61
62
@ RequestParam (required = false , defaultValue = "0" ) Integer pageSize ) {
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
- 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 );
71
78
}
72
79
73
80
@ Override
You can’t perform that action at this time.
0 commit comments