diff --git a/types/list.go b/types/list.go index 5fcd02f54..0bd38f4ee 100644 --- a/types/list.go +++ b/types/list.go @@ -43,3 +43,14 @@ func ListToArray(lstValue reflect.Value) []any { } return items } + +// GetPageList 获取collections.PageList的元素 +func GetPageList(pageList any) (any, int64) { + pageListValueOf := reflect.ValueOf(pageList) + if _, success := IsPageList(pageListValueOf); !success { + panic("ToPageList的入参必须是collections.PageList类型") + } + listValueOf := pageListValueOf.FieldByName("List") + recordCountValueOf := pageListValueOf.FieldByName("RecordCount") + return listValueOf.Interface(), recordCountValueOf.Interface().(int64) +}