import 'package:fis_common/json_convert.dart'; class RpcResult { final bool isSuccess; final int errorCode; final String msg; T? data; RpcResult({ required this.isSuccess, required this.errorCode, required this.msg, this.data, }); factory RpcResult.fromJson(Map map) { T? data; if (map['data'] != null) { data = FJsonConvert.fromJson(map['data']); } return RpcResult( isSuccess: map['isSuccess'] == true, errorCode: map['errorCode'], msg: map['msg'], data: data, ); } } /// 分页数据 class PagedData { PagedData({ required this.currentPage, required this.pageSize, required this.dataCount, this.pageData = const [], }); factory PagedData.fromJson(Map map) { List dataList = []; if (map['PageData'] != null) { dataList.addAll( (map['PageData'] as List).map((e) => FJsonConvert.fromJson(e)!)); } return PagedData( currentPage: map['CurrentPage'], pageSize: map['PageSize'], dataCount: map['DataCount'], pageData: dataList, ); } Map toJson() { Map map = {}; map['CurrentPage'] = this.currentPage; map['PageSize'] = this.pageSize; map['DataCount'] = this.dataCount; map['PageData'] = this.pageData.map((dynamic e) => e.toJson()).toList(); return map; } final int currentPage; final int pageSize; final int dataCount; final List pageData; } /// 分页请求 class PagedRequest { PagedRequest({ this.currentPage = 1, this.pageSize = 10, }); int currentPage; int pageSize; Map toJson() { Map map = {}; map['currentPage'] = this.currentPage; map['pageSize'] = this.pageSize; return map; } }