7
7
import org .apache .commons .collections4 .CollectionUtils ;
8
8
import org .apache .commons .lang3 .BooleanUtils ;
9
9
import org .apache .commons .lang3 .StringUtils ;
10
+ import org .lowcoder .api .framework .view .PageResponseView ;
10
11
import org .lowcoder .api .framework .view .ResponseView ;
11
12
import org .lowcoder .api .permission .view .CommonPermissionView ;
12
13
import org .lowcoder .api .util .BusinessEventPublisher ;
29
30
import java .util .List ;
30
31
import java .util .Locale ;
31
32
33
+ import static org .lowcoder .api .util .Pagination .fluxToPageResponseView ;
32
34
import static org .lowcoder .plugin .api .event .LowcoderEvent .EventType .*;
33
35
import static org .lowcoder .sdk .exception .BizError .INVALID_PARAMETER ;
34
36
import static org .lowcoder .sdk .util .ExceptionUtils .ofError ;
@@ -116,11 +118,11 @@ public Mono<ResponseView<DatasourceStructure>> getStructure(@PathVariable String
116
118
* name, type... and the plugin definition of it, excluding the detail configs such as the connection uri, password...
117
119
*/
118
120
@ Override
119
- public Mono <ResponseView <List <Datasource >>> listJsDatasourcePlugins (@ RequestParam ("appId" ) String applicationId , @ RequestParam (required = false ) String name , @ RequestParam (required = false ) String type ) {
121
+ public Mono <PageResponseView <?>> listJsDatasourcePlugins (@ RequestParam ("appId" ) String applicationId , @ RequestParam (required = false ) String name , @ RequestParam (required = false ) String type ,
122
+ @ RequestParam (required = false , defaultValue = "0" ) int pageNum ,
123
+ @ RequestParam (required = false , defaultValue = "0" ) int pageSize ) {
120
124
String objectId = gidService .convertApplicationIdToObjectId (applicationId );
121
- return datasourceApiService .listJsDatasourcePlugins (objectId , name , type )
122
- .collectList ()
123
- .map (ResponseView ::success );
125
+ return fluxToPageResponseView (pageNum , pageSize , datasourceApiService .listJsDatasourcePlugins (objectId , name , type ));
124
126
}
125
127
126
128
/**
@@ -139,26 +141,26 @@ public Mono<ResponseView<List<Object>>> getPluginDynamicConfig(
139
141
140
142
@ SneakyThrows
141
143
@ Override
142
- public Mono <ResponseView <List <DatasourceView >>> listOrgDataSources (@ RequestParam (name = "orgId" ) String orgId , @ RequestParam (required = false ) String name , @ RequestParam (required = false ) String type ) {
144
+ public Mono <PageResponseView <?>> listOrgDataSources (@ RequestParam (name = "orgId" ) String orgId , @ RequestParam (required = false ) String name , @ RequestParam (required = false ) String type ,
145
+ @ RequestParam (required = false , defaultValue = "0" ) int pageNum ,
146
+ @ RequestParam (required = false , defaultValue = "0" ) int pageSize ) {
143
147
if (StringUtils .isBlank (orgId )) {
144
148
return ofError (BizError .INVALID_PARAMETER , "ORG_ID_EMPTY" );
145
149
}
146
150
String objectId = gidService .convertOrganizationIdToObjectId (orgId );
147
- return datasourceApiService .listOrgDataSources (objectId , name , type )
148
- .collectList ()
149
- .map (ResponseView ::success );
151
+ return fluxToPageResponseView (pageNum , pageSize , datasourceApiService .listOrgDataSources (objectId , name , type ));
150
152
}
151
153
152
154
@ Override
153
- public Mono <ResponseView <List <DatasourceView >>> listAppDataSources (@ RequestParam (name = "appId" ) String applicationId , @ RequestParam (required = false ) String name , @ RequestParam (required = false ) String type ) {
155
+ public Mono <PageResponseView <?>> listAppDataSources (@ RequestParam (name = "appId" ) String applicationId , @ RequestParam (required = false ) String name , @ RequestParam (required = false ) String type ,
156
+ @ RequestParam (required = false , defaultValue = "0" ) int pageNum ,
157
+ @ RequestParam (required = false , defaultValue = "0" ) int pageSize ) {
154
158
if (StringUtils .isBlank (applicationId )) {
155
159
return ofError (BizError .INVALID_PARAMETER , "INVALID_APP_ID" );
156
160
}
157
161
String objectId = gidService .convertApplicationIdToObjectId (applicationId );
158
162
159
- return datasourceApiService .listAppDataSources (objectId , name , type )
160
- .collectList ()
161
- .map (ResponseView ::success );
163
+ return fluxToPageResponseView (pageNum , pageSize , datasourceApiService .listAppDataSources (objectId , name , type ));
162
164
}
163
165
164
166
@ Override
0 commit comments