new_order_bean_entity_helper.dart 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. import 'package:bbyyy/beans/new_order_bean_entity.dart';
  2. newOrderBeanEntityFromJson(NewOrderBeanEntity data, Map<String, dynamic> json) {
  3. if (json['type'] != null) {
  4. data.type = json['type'].toString();
  5. }
  6. if (json['content'] != null) {
  7. data.content = NewOrderBeanContent().fromJson(json['content']);
  8. }
  9. return data;
  10. }
  11. Map<String, dynamic> newOrderBeanEntityToJson(NewOrderBeanEntity entity) {
  12. final Map<String, dynamic> data = new Map<String, dynamic>();
  13. data['type'] = entity.type;
  14. data['content'] = entity.content?.toJson();
  15. return data;
  16. }
  17. newOrderBeanContentFromJson(NewOrderBeanContent data, Map<String, dynamic> json) {
  18. if (json['UID'] != null) {
  19. data.uID = json['UID'] is String
  20. ? int.tryParse(json['UID'])
  21. : json['UID'].toInt();
  22. }
  23. if (json['State'] != null) {
  24. data.state = json['State'] is String
  25. ? int.tryParse(json['State'])
  26. : json['State'].toInt();
  27. }
  28. if (json['SellerID'] != null) {
  29. data.sellerID = json['SellerID'] is String
  30. ? int.tryParse(json['SellerID'])
  31. : json['SellerID'].toInt();
  32. }
  33. if (json['CreateTime'] != null) {
  34. data.createTime = json['CreateTime'].toString();
  35. }
  36. if (json['ShopUID'] != null) {
  37. data.shopUID = json['ShopUID'] is String
  38. ? int.tryParse(json['ShopUID'])
  39. : json['ShopUID'].toInt();
  40. }
  41. if (json['Amount'] != null) {
  42. data.amount = json['Amount'] is String
  43. ? double.tryParse(json['Amount'])
  44. : json['Amount'].toDouble();
  45. }
  46. if (json['Hash'] != null) {
  47. data.hash = json['Hash'].toString();
  48. }
  49. if (json['BuyerName'] != null) {
  50. data.buyerName = json['BuyerName'].toString();
  51. }
  52. if (json['ShopPic'] != null) {
  53. data.shopPic = json['ShopPic'].toString();
  54. }
  55. if (json['ShopID'] != null) {
  56. data.shopID = json['ShopID'] is String
  57. ? int.tryParse(json['ShopID'])
  58. : json['ShopID'].toInt();
  59. }
  60. if (json['SellerName'] != null) {
  61. data.sellerName = json['SellerName'].toString();
  62. }
  63. if (json['SellerPic'] != null) {
  64. data.sellerPic = json['SellerPic'].toString();
  65. }
  66. if (json['BuyerPic'] != null) {
  67. data.buyerPic = json['BuyerPic'].toString();
  68. }
  69. if (json['SellerUID'] != null) {
  70. data.sellerUID = json['SellerUID'] is String
  71. ? int.tryParse(json['SellerUID'])
  72. : json['SellerUID'].toInt();
  73. }
  74. if (json['BuyerUID'] != null) {
  75. data.buyerUID = json['BuyerUID'] is String
  76. ? int.tryParse(json['BuyerUID'])
  77. : json['BuyerUID'].toInt();
  78. }
  79. if (json['ShopName'] != null) {
  80. data.shopName = json['ShopName'].toString();
  81. }
  82. if (json['ID'] != null) {
  83. data.iD = json['ID'] is String
  84. ? int.tryParse(json['ID'])
  85. : json['ID'].toInt();
  86. }
  87. return data;
  88. }
  89. Map<String, dynamic> newOrderBeanContentToJson(NewOrderBeanContent entity) {
  90. final Map<String, dynamic> data = new Map<String, dynamic>();
  91. data['UID'] = entity.uID;
  92. data['State'] = entity.state;
  93. data['SellerID'] = entity.sellerID;
  94. data['CreateTime'] = entity.createTime;
  95. data['ShopUID'] = entity.shopUID;
  96. data['Amount'] = entity.amount;
  97. data['Hash'] = entity.hash;
  98. data['BuyerName'] = entity.buyerName;
  99. data['ShopPic'] = entity.shopPic;
  100. data['ShopID'] = entity.shopID;
  101. data['SellerName'] = entity.sellerName;
  102. data['SellerPic'] = entity.sellerPic;
  103. data['BuyerPic'] = entity.buyerPic;
  104. data['SellerUID'] = entity.sellerUID;
  105. data['BuyerUID'] = entity.buyerUID;
  106. data['ShopName'] = entity.shopName;
  107. data['ID'] = entity.iD;
  108. return data;
  109. }