feat:bug修改
This commit is contained in:
1 parent
3729e3b896
commit
48c1ee8cb2
8 files changed
+143
-85
No files matched your search
@@ -1600,7 +1600,11 @@ class _$UserDao extends UserDao {
|
||||
createTime:
|
||||
_dateTimeEmptyConverter.decode(row['createTime'] as String),
|
||||
updateTime:
|
||||
_dateTimeEmptyConverter.decode(row['updateTime'] as String)),
|
||||
_dateTimeEmptyConverter.decode(row['updateTime'] as String),
|
||||
discountsUpdateTime: _dateTimeEmptyConverter
|
||||
.decode(row['discountsUpdateTime'] as String),
|
||||
discountsList:
|
||||
_listDiscountsConverter.decode(row['discountsList'] as String)),
|
||||
arguments: [userId]);
|
||||
}
|
||||
|
||||
@@ -1622,7 +1626,11 @@ class _$UserDao extends UserDao {
|
||||
createTime:
|
||||
_dateTimeEmptyConverter.decode(row['createTime'] as String),
|
||||
updateTime:
|
||||
_dateTimeEmptyConverter.decode(row['updateTime'] as String)),
|
||||
_dateTimeEmptyConverter.decode(row['updateTime'] as String),
|
||||
discountsUpdateTime: _dateTimeEmptyConverter
|
||||
.decode(row['discountsUpdateTime'] as String),
|
||||
discountsList:
|
||||
_listDiscountsConverter.decode(row['discountsList'] as String)),
|
||||
arguments: [walletCardNumber]);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,8 @@ class UserEntity extends Equatable {
|
||||
this.canteenId,
|
||||
this.createTime,
|
||||
this.updateTime,
|
||||
this.discountsUpdateTime,
|
||||
this.discountsList,
|
||||
});
|
||||
|
||||
/// 计算优惠后的价格
|
||||
|
||||
@@ -44,13 +44,13 @@ UserEntity _$UserEntityFromJson(Map<String, dynamic> json) => UserEntity(
|
||||
updateTime: json['updateTime'] == null
|
||||
? null
|
||||
: DateTime.parse(json['updateTime'] as String),
|
||||
)
|
||||
..discountsList = (json['discountsList'] as List<dynamic>?)
|
||||
?.map((e) => DiscountsItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList()
|
||||
..discountsUpdateTime = json['discountsUpdateTime'] == null
|
||||
discountsUpdateTime: json['discountsUpdateTime'] == null
|
||||
? null
|
||||
: DateTime.parse(json['discountsUpdateTime'] as String);
|
||||
: DateTime.parse(json['discountsUpdateTime'] as String),
|
||||
discountsList: (json['discountsList'] as List<dynamic>?)
|
||||
?.map((e) => DiscountsItem.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UserEntityToJson(UserEntity instance) =>
|
||||
<String, dynamic>{
|
||||
|
||||
@@ -153,21 +153,24 @@ class ListDiscountsConverter
|
||||
extends TypeConverter<List<DiscountsItem>?, String> {
|
||||
@override
|
||||
List<DiscountsItem> decode(String databaseValue) {
|
||||
if (databaseValue.isEmpty) {
|
||||
return [];
|
||||
if (databaseValue.isEmpty) return [];
|
||||
final raw = json.decode(databaseValue);
|
||||
if (raw is List) {
|
||||
return raw
|
||||
.map<DiscountsItem>(
|
||||
(e) => DiscountsItem.fromJson(
|
||||
Map<String, dynamic>.from(e as Map),
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
return json
|
||||
.decode(databaseValue)
|
||||
.map((e) => DiscountsItem.fromJson(e))
|
||||
.toList();
|
||||
return [];
|
||||
}
|
||||
|
||||
@override
|
||||
String encode(List<DiscountsItem>? value) {
|
||||
if (ObjectUtil.isEmptyList(value)) {
|
||||
return '';
|
||||
}
|
||||
return json.encode(value);
|
||||
if (ObjectUtil.isEmptyList(value)) return '[]';
|
||||
return json.encode(value!.map((e) => e.toJson()).toList());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user