77import org .apache .commons .collections4 .CollectionUtils ;
88import org .apache .commons .lang3 .BooleanUtils ;
99import org .apache .commons .lang3 .StringUtils ;
10+ import org .lowcoder .api .framework .view .PageResponseView ;
1011import org .lowcoder .api .framework .view .ResponseView ;
1112import org .lowcoder .api .permission .view .CommonPermissionView ;
1213import org .lowcoder .api .util .BusinessEventPublisher ;
2930import java .util .List ;
3031import java .util .Locale ;
3132
33+ import static org .lowcoder .api .util .Pagination .fluxToPageResponseView ;
3234import static org .lowcoder .plugin .api .event .LowcoderEvent .EventType .*;
3335import static org .lowcoder .sdk .exception .BizError .INVALID_PARAMETER ;
3436import static org .lowcoder .sdk .util .ExceptionUtils .ofError ;
@@ -116,11 +118,11 @@ public Mono<ResponseView<DatasourceStructure>> getStructure(@PathVariable String
116118 * name, type... and the plugin definition of it, excluding the detail configs such as the connection uri, password...
117119 */
118120 @ 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 ) {
120124 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 ));
124126 }
125127
126128 /**
@@ -139,26 +141,26 @@ public Mono<ResponseView<List<Object>>> getPluginDynamicConfig(
139141
140142 @ SneakyThrows
141143 @ 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 ) {
143147 if (StringUtils .isBlank (orgId )) {
144148 return ofError (BizError .INVALID_PARAMETER , "ORG_ID_EMPTY" );
145149 }
146150 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 ));
150152 }
151153
152154 @ 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 ) {
154158 if (StringUtils .isBlank (applicationId )) {
155159 return ofError (BizError .INVALID_PARAMETER , "INVALID_APP_ID" );
156160 }
157161 String objectId = gidService .convertApplicationIdToObjectId (applicationId );
158162
159- return datasourceApiService .listAppDataSources (objectId , name , type )
160- .collectList ()
161- .map (ResponseView ::success );
163+ return fluxToPageResponseView (pageNum , pageSize , datasourceApiService .listAppDataSources (objectId , name , type ));
162164 }
163165
164166 @ Override
0 commit comments