130 lines
2.9 KiB
Dart
130 lines
2.9 KiB
Dart
class ProductModel {
|
|
int? id;
|
|
String? createdAt;
|
|
String? updatedAt;
|
|
String? name;
|
|
String? remark;
|
|
int? isDelete;
|
|
int? companyId;
|
|
int? unitId;
|
|
String? namePinyin;
|
|
List<Files>? files;
|
|
Company? company;
|
|
Unit? unit;
|
|
|
|
ProductModel(
|
|
{this.id,
|
|
this.createdAt,
|
|
this.updatedAt,
|
|
this.name,
|
|
this.remark,
|
|
this.isDelete,
|
|
this.companyId,
|
|
this.unitId,
|
|
this.namePinyin,
|
|
this.files,
|
|
this.company,
|
|
this.unit});
|
|
|
|
ProductModel.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
createdAt = json['createdAt'];
|
|
updatedAt = json['updatedAt'];
|
|
name = json['name'];
|
|
remark = json['remark'];
|
|
isDelete = json['isDelete'];
|
|
companyId = json['companyId'];
|
|
unitId = json['unitId'];
|
|
namePinyin = json['namePinyin'];
|
|
if (json['files'] != null) {
|
|
files = <Files>[];
|
|
json['files'].forEach((v) {
|
|
files!.add(new Files.fromJson(v));
|
|
});
|
|
}
|
|
company =
|
|
json['company'] != null ? new Company.fromJson(json['company']) : null;
|
|
unit = json['unit'] != null ? new Unit.fromJson(json['unit']) : null;
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['id'] = this.id;
|
|
data['createdAt'] = this.createdAt;
|
|
data['updatedAt'] = this.updatedAt;
|
|
data['name'] = this.name;
|
|
data['remark'] = this.remark;
|
|
data['isDelete'] = this.isDelete;
|
|
data['companyId'] = this.companyId;
|
|
data['unitId'] = this.unitId;
|
|
data['namePinyin'] = this.namePinyin;
|
|
if (this.files != null) {
|
|
data['files'] = this.files!.map((v) => v.toJson()).toList();
|
|
}
|
|
if (this.company != null) {
|
|
data['company'] = this.company!.toJson();
|
|
}
|
|
if (this.unit != null) {
|
|
data['unit'] = this.unit!.toJson();
|
|
}
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Files {
|
|
int? id;
|
|
String? path;
|
|
|
|
Files({this.id, this.path});
|
|
|
|
Files.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
path = json['path'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['id'] = this.id;
|
|
data['path'] = this.path;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Company {
|
|
int? id;
|
|
String? name;
|
|
|
|
Company({this.id, this.name});
|
|
|
|
Company.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
name = json['name'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['id'] = this.id;
|
|
data['name'] = this.name;
|
|
return data;
|
|
}
|
|
}
|
|
|
|
class Unit {
|
|
int? id;
|
|
String? label;
|
|
|
|
Unit({this.id, this.label});
|
|
|
|
Unit.fromJson(Map<String, dynamic> json) {
|
|
id = json['id'];
|
|
label = json['label'];
|
|
}
|
|
|
|
Map<String, dynamic> toJson() {
|
|
final Map<String, dynamic> data = new Map<String, dynamic>();
|
|
data['id'] = this.id;
|
|
data['label'] = this.label;
|
|
return data;
|
|
}
|
|
}
|