new_order_bean_entity_helper.dart 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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['SellerUID'] != null) {
  67. data.sellerUID = json['SellerUID'] is String
  68. ? int.tryParse(json['SellerUID'])
  69. : json['SellerUID'].toInt();
  70. }
  71. if (json['ShopName'] != null) {
  72. data.shopName = json['ShopName'].toString();
  73. }
  74. if (json['ID'] != null) {
  75. data.iD = json['ID'] is String
  76. ? int.tryParse(json['ID'])
  77. : json['ID'].toInt();
  78. }
  79. return data;
  80. }
  81. Map<String, dynamic> newOrderBeanContentToJson(NewOrderBeanContent entity) {
  82. final Map<String, dynamic> data = new Map<String, dynamic>();
  83. data['UID'] = entity.uID;
  84. data['State'] = entity.state;
  85. data['SellerID'] = entity.sellerID;
  86. data['CreateTime'] = entity.createTime;
  87. data['ShopUID'] = entity.shopUID;
  88. data['Amount'] = entity.amount;
  89. data['Hash'] = entity.hash;
  90. data['BuyerName'] = entity.buyerName;
  91. data['ShopPic'] = entity.shopPic;
  92. data['ShopID'] = entity.shopID;
  93. data['SellerName'] = entity.sellerName;
  94. data['SellerPic'] = entity.sellerPic;
  95. data['SellerUID'] = entity.sellerUID;
  96. data['ShopName'] = entity.shopName;
  97. data['ID'] = entity.iD;
  98. return data;
  99. }