List jsonToContentList(list) { List contList = []; list.forEach((item) { contList.add(ContentImageList.fromJson(item)); }); return contList; } List jsonToImagesList(list) { List contList = []; list.forEach((item) { contList.add(BannerImageList.fromJson(item)); }); return contList; } class CardInfo { // @ApiModelProperty(value = "农机Id") String? machineryId; // @ApiModelProperty(value = "名称") String? name; // @ApiModelProperty(value = "农机类型") String? typeId; // @ApiModelProperty(value = "类型名称") String? typeName; // @ApiModelProperty(value = "农机价格") int? price; // @ApiModelProperty(value = "主图") String? thumb; // @ApiModelProperty(value = "当前位置") String? location; // @ApiModelProperty(value = "距离") double? distance; // @ApiModelProperty(value = "机构ID") String? orgId; // @ApiModelProperty(value = "机构名称") String? orgName; // @ApiModelProperty(value = "工作状态") String? jobStatus; // @ApiModelProperty(value = "状态") int? status; // @ApiModelProperty(value = "内容详情") List? contentList=[]; // @ApiModelProperty(value = "图片列表") List? imagesList=[]; CardInfo(); CardInfo.fromJson(Map json) : machineryId = json["machineryId"], name = json["name"], typeId = json["typeId"], typeName = json["typeName"], price = json["price"], thumb = json["thumb"], location = json["location"], distance = json["distance"], orgId = json["orgId"], orgName = json["orgName"], jobStatus = json["jobStatus"], status = json["status"], contentList = jsonToContentList(json["contentList"]), imagesList = jsonToImagesList(json["imagesList"]); Map toJson() => { 'machineryId': machineryId, 'name': name, 'typeId': typeId, 'typeName': typeName, 'price': price, 'thumb': thumb, 'location': location, 'distance': distance, 'orgId': orgId, 'orgName': orgName, 'jobStatus': jobStatus, 'status': status, 'contentList': contentList, 'imagesList': imagesList, }; } class ContentImageList { String? content; String? contentType; String? createDate; String? extId; String? sort; String? targetId; String? targetType; ContentImageList(); ContentImageList.fromJson(Map json) : content = json["content"], contentType = json["contentType"], createDate = json["createDate"], extId = json["extId"], sort = json["sort"], targetId = json["targetId"], targetType = json["targetType"]; Map toJson() => { 'content': content, 'contentType': contentType, 'createDate': createDate, 'extId': extId, 'sort': sort, 'targetId': targetId, 'targetType': targetType, }; } class BannerImageList { String? createDate; String? imageId; num? status; String? targetId; String? targetType; String? url; BannerImageList(); BannerImageList.fromJson(Map json) : createDate = json["createDate"], imageId = json["imageId"], status = json["status"], targetId = json["targetId"], targetType = json["targetType"], url = json["url"]; Map toJson() => { 'createDate': createDate, 'imageId': imageId, 'status': status, 'targetId': targetId, 'targetType': targetType, 'url': url, }; }