feat:超市数据库
This commit is contained in:
1 parent
9a98ac8e1c
commit
fa4bb78f8b
25 files changed
+307
-185
No files matched your search
+7
-12
@@ -4,11 +4,11 @@ import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/models/index.dart';
|
||||
|
||||
part 'product_entity.g.dart';
|
||||
part 'canteen_spu_entity.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
@Entity(tableName: "product")
|
||||
class ProductEntity extends Equatable {
|
||||
@Entity(tableName: "canteen_spu")
|
||||
class CanteenSpuEntity extends Equatable {
|
||||
/// 自增ID
|
||||
@PrimaryKey(autoGenerate: true)
|
||||
int? id;
|
||||
@@ -16,9 +16,6 @@ class ProductEntity extends Equatable {
|
||||
/// 服务端唯一标识
|
||||
String serviceUniqueCode;
|
||||
|
||||
/// 平台类型
|
||||
SysType sysType;
|
||||
|
||||
/// 分类 serviceID
|
||||
String classifyServiceUniqueCode;
|
||||
|
||||
@@ -55,10 +52,9 @@ class ProductEntity extends Equatable {
|
||||
/// 是否删除
|
||||
bool delFlag;
|
||||
|
||||
ProductEntity({
|
||||
CanteenSpuEntity({
|
||||
this.id,
|
||||
required this.serviceUniqueCode,
|
||||
required this.sysType,
|
||||
required this.classifyServiceUniqueCode,
|
||||
this.hourType,
|
||||
this.saleDate,
|
||||
@@ -73,15 +69,14 @@ class ProductEntity extends Equatable {
|
||||
required this.delFlag,
|
||||
});
|
||||
|
||||
factory ProductEntity.fromJson(Map<String, dynamic> json) =>
|
||||
_$ProductEntityFromJson(json);
|
||||
factory CanteenSpuEntity.fromJson(Map<String, dynamic> json) =>
|
||||
_$CanteenSpuEntityFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$ProductEntityToJson(this);
|
||||
Map<String, dynamic> toJson() => _$CanteenSpuEntityToJson(this);
|
||||
|
||||
@override
|
||||
List<Object?> get props => [
|
||||
serviceUniqueCode,
|
||||
sysType,
|
||||
classifyServiceUniqueCode,
|
||||
hourType,
|
||||
name,
|
||||
+4
-11
@@ -1,16 +1,15 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'product_entity.dart';
|
||||
part of 'canteen_spu_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
ProductEntity _$ProductEntityFromJson(Map<String, dynamic> json) =>
|
||||
ProductEntity(
|
||||
CanteenSpuEntity _$CanteenSpuEntityFromJson(Map<String, dynamic> json) =>
|
||||
CanteenSpuEntity(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
serviceUniqueCode: json['serviceUniqueCode'] as String,
|
||||
sysType: $enumDecode(_$SysTypeEnumMap, json['sysType']),
|
||||
classifyServiceUniqueCode: json['classifyServiceUniqueCode'] as String,
|
||||
hourType: $enumDecodeNullable(_$ProductHourTypeEnumMap, json['hourType']),
|
||||
saleDate: json['saleDate'] == null
|
||||
@@ -27,11 +26,10 @@ ProductEntity _$ProductEntityFromJson(Map<String, dynamic> json) =>
|
||||
delFlag: json['delFlag'] as bool,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$ProductEntityToJson(ProductEntity instance) =>
|
||||
Map<String, dynamic> _$CanteenSpuEntityToJson(CanteenSpuEntity instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
'serviceUniqueCode': instance.serviceUniqueCode,
|
||||
'sysType': _$SysTypeEnumMap[instance.sysType]!,
|
||||
'classifyServiceUniqueCode': instance.classifyServiceUniqueCode,
|
||||
'hourType': _$ProductHourTypeEnumMap[instance.hourType],
|
||||
'saleDate': instance.saleDate?.toIso8601String(),
|
||||
@@ -46,11 +44,6 @@ Map<String, dynamic> _$ProductEntityToJson(ProductEntity instance) =>
|
||||
'delFlag': instance.delFlag,
|
||||
};
|
||||
|
||||
const _$SysTypeEnumMap = {
|
||||
SysType.SUPERMARKET: 'SUPERMARKET',
|
||||
SysType.CANTEEN: 'CANTEEN',
|
||||
};
|
||||
|
||||
const _$ProductHourTypeEnumMap = {
|
||||
ProductHourType.TOTAL: 'TOTAL',
|
||||
ProductHourType.MORNING: 'MORNING',
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:floor/floor.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'supermarket_sku_entity.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
@Entity(tableName: "supermarket_sku")
|
||||
class SupermarketSkuEntity {
|
||||
/// 自增ID
|
||||
@PrimaryKey(autoGenerate: true)
|
||||
int? id;
|
||||
|
||||
SupermarketSkuEntity({
|
||||
this.id,
|
||||
});
|
||||
|
||||
factory SupermarketSkuEntity.fromJson(Map<String, dynamic> json) =>
|
||||
_$SupermarketSkuEntityFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$SupermarketSkuEntityToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'supermarket_sku_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
SupermarketSkuEntity _$SupermarketSkuEntityFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
SupermarketSkuEntity(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SupermarketSkuEntityToJson(
|
||||
SupermarketSkuEntity instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:floor/floor.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'supermarket_spu_entity.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
@Entity(tableName: "supermarket_spu")
|
||||
class SupermarketSpuEntity {
|
||||
/// 自增ID
|
||||
@PrimaryKey(autoGenerate: true)
|
||||
int? id;
|
||||
|
||||
SupermarketSpuEntity({
|
||||
this.id,
|
||||
});
|
||||
|
||||
factory SupermarketSpuEntity.fromJson(Map<String, dynamic> json) =>
|
||||
_$SupermarketSpuEntityFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$SupermarketSpuEntityToJson(this);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'supermarket_spu_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
SupermarketSpuEntity _$SupermarketSpuEntityFromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
SupermarketSpuEntity(
|
||||
id: (json['id'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$SupermarketSpuEntityToJson(
|
||||
SupermarketSpuEntity instance) =>
|
||||
<String, dynamic>{
|
||||
'id': instance.id,
|
||||
};
|
||||
Reference in new issue
Block a user