message_list_entity.dart 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. class MessageListEntity {
  2. List<MessageListItem> rows;
  3. int total;
  4. int size;
  5. int current;
  6. String readCount;
  7. String unreadCount;
  8. bool searchCount;
  9. int pages;
  10. MessageListEntity.fromJsonMap(Map<String, dynamic> map):
  11. rows = List<MessageListItem>.from(map["records"].map((it) => MessageListItem.fromJsonMap(it))),
  12. total = map["total"],
  13. size = map["size"],
  14. current = map["current"],
  15. readCount = map["readCount"],
  16. unreadCount = map["unreadCount"],
  17. searchCount = map["searchCount"],
  18. pages = map["pages"];
  19. Map<String, dynamic> toJson() {
  20. final Map<String, dynamic> data = new Map<String, dynamic>();
  21. data['records'] = rows != null ?
  22. this.rows.map((v) => v.toJson()).toList()
  23. : null;
  24. data['total'] = total;
  25. data['size'] = size;
  26. data['current'] = current;
  27. data['readCount'] = readCount;
  28. data['unreadCount'] = unreadCount;
  29. data['searchCount'] = searchCount;
  30. data['pages'] = pages;
  31. return data;
  32. }
  33. }
  34. class MessageListItem {
  35. String id;
  36. String userId;
  37. String content;
  38. int type;
  39. int viewFlag;
  40. int deviceModel;
  41. String createUserId;
  42. String createTime;
  43. MessageListItem({
  44. this.id=""
  45. });
  46. MessageListItem.fromJsonMap(Map<String, dynamic> map):
  47. id = map["id"],
  48. userId = map["userId"],
  49. content = map["content"],
  50. type = map["type"],
  51. viewFlag = map["viewFlag"],
  52. deviceModel = map["deviceModel"],
  53. createUserId = map["createUserId"],
  54. createTime = map["createTime"];
  55. Map<String, dynamic> toJson() {
  56. final Map<String, dynamic> data = new Map<String, dynamic>();
  57. data['id'] = id;
  58. data['userId'] = userId;
  59. data['content'] = content;
  60. data['type'] = type;
  61. data['viewFlag'] = viewFlag;
  62. data['deviceModel'] = deviceModel;
  63. data['createUserId'] = createUserId;
  64. data['createTime'] = createTime;
  65. return data;
  66. }
  67. }