feat:创建挂单数据库,和迁移文件
This commit is contained in:
1 parent
815cb2ac8b
commit
988247f3cd
7 files changed
+248
-3
No files matched your search
@@ -76,6 +76,8 @@ class _$AppDatabase extends AppDatabase {
|
||||
|
||||
OrderDao? _getOrderDaoInstance;
|
||||
|
||||
OrderHoldBillDao? _getOrderHoldBillDaoInstance;
|
||||
|
||||
CanteenSpuDao? _getCanteenSpuDaoInstance;
|
||||
|
||||
SupermarketSkuDao? _getSupermarketSkuDaoInstance;
|
||||
@@ -102,7 +104,7 @@ class _$AppDatabase extends AppDatabase {
|
||||
Callback? callback,
|
||||
]) async {
|
||||
final databaseOptions = sqflite.OpenDatabaseOptions(
|
||||
version: 2,
|
||||
version: 3,
|
||||
onConfigure: (database) async {
|
||||
await database.execute('PRAGMA foreign_keys = ON');
|
||||
await callback?.onConfigure?.call(database);
|
||||
@@ -121,6 +123,8 @@ class _$AppDatabase extends AppDatabase {
|
||||
'CREATE TABLE IF NOT EXISTS `broadcast` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `content` TEXT NOT NULL, `broadcastCount` INTEGER NOT NULL, `broadcastMaxCount` INTEGER NOT NULL, `isBroadcast` INTEGER NOT NULL, `isDone` INTEGER NOT NULL, `isDoneTime` TEXT, `serviceCode` TEXT NOT NULL, `serviceOrderCode` TEXT NOT NULL, `userId` TEXT NOT NULL, `username` TEXT NOT NULL, `userMobile` TEXT NOT NULL, `productDesc` TEXT NOT NULL, `payPrice` INTEGER NOT NULL, `hourType` INTEGER, `enable` INTEGER NOT NULL, `createTime` TEXT NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `order_record` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `uniqueCode` TEXT NOT NULL, `serviceUniqueCode` TEXT NOT NULL, `sysType` TEXT NOT NULL, `userCode` TEXT NOT NULL, `username` TEXT, `hourType` TEXT, `price` INTEGER NOT NULL, `extraPrice` INTEGER NOT NULL, `payPrice` INTEGER NOT NULL, `walletId` TEXT, `orderSourceTypeId` TEXT, `type` TEXT NOT NULL, `status` TEXT NOT NULL, `payType` TEXT NOT NULL, `productDesc` TEXT, `count` INTEGER NOT NULL, `weight` REAL NOT NULL, `payTime` TEXT, `createTime` TEXT NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `order_hold_bill` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `sysType` TEXT NOT NULL, `orderListJson` TEXT, `userJson` TEXT, `orderJson` TEXT, `createTime` TEXT NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `canteen_spu` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `classifyServiceUniqueCode` TEXT NOT NULL, `hourType` INTEGER, `saleDate` TEXT NOT NULL, `name` TEXT NOT NULL, `price` INTEGER NOT NULL, `image` TEXT, `isDefault` INTEGER NOT NULL, `status` INTEGER NOT NULL, `sort` INTEGER NOT NULL, `createTime` TEXT NOT NULL, `updateTime` TEXT NOT NULL)');
|
||||
await database.execute(
|
||||
@@ -159,6 +163,12 @@ class _$AppDatabase extends AppDatabase {
|
||||
return _getOrderDaoInstance ??= _$OrderDao(database, changeListener);
|
||||
}
|
||||
|
||||
@override
|
||||
OrderHoldBillDao get getOrderHoldBillDao {
|
||||
return _getOrderHoldBillDaoInstance ??=
|
||||
_$OrderHoldBillDao(database, changeListener);
|
||||
}
|
||||
|
||||
@override
|
||||
CanteenSpuDao get getCanteenSpuDao {
|
||||
return _getCanteenSpuDaoInstance ??=
|
||||
@@ -594,6 +604,76 @@ class _$OrderDao extends OrderDao {
|
||||
}
|
||||
}
|
||||
|
||||
class _$OrderHoldBillDao extends OrderHoldBillDao {
|
||||
_$OrderHoldBillDao(
|
||||
this.database,
|
||||
this.changeListener,
|
||||
) : _orderHoldBillEntityInsertionAdapter = InsertionAdapter(
|
||||
database,
|
||||
'order_hold_bill',
|
||||
(OrderHoldBillEntity item) => <String, Object?>{
|
||||
'id': item.id,
|
||||
'sysType': _sysTypeConverter.encode(item.sysType),
|
||||
'orderListJson': item.orderListJson,
|
||||
'userJson': item.userJson,
|
||||
'orderJson': item.orderJson,
|
||||
'createTime': _dateTimeConverter.encode(item.createTime)
|
||||
}),
|
||||
_orderHoldBillEntityUpdateAdapter = UpdateAdapter(
|
||||
database,
|
||||
'order_hold_bill',
|
||||
['id'],
|
||||
(OrderHoldBillEntity item) => <String, Object?>{
|
||||
'id': item.id,
|
||||
'sysType': _sysTypeConverter.encode(item.sysType),
|
||||
'orderListJson': item.orderListJson,
|
||||
'userJson': item.userJson,
|
||||
'orderJson': item.orderJson,
|
||||
'createTime': _dateTimeConverter.encode(item.createTime)
|
||||
}),
|
||||
_orderHoldBillEntityDeletionAdapter = DeletionAdapter(
|
||||
database,
|
||||
'order_hold_bill',
|
||||
['id'],
|
||||
(OrderHoldBillEntity item) => <String, Object?>{
|
||||
'id': item.id,
|
||||
'sysType': _sysTypeConverter.encode(item.sysType),
|
||||
'orderListJson': item.orderListJson,
|
||||
'userJson': item.userJson,
|
||||
'orderJson': item.orderJson,
|
||||
'createTime': _dateTimeConverter.encode(item.createTime)
|
||||
});
|
||||
|
||||
final sqflite.DatabaseExecutor database;
|
||||
|
||||
final StreamController<String> changeListener;
|
||||
|
||||
final InsertionAdapter<OrderHoldBillEntity>
|
||||
_orderHoldBillEntityInsertionAdapter;
|
||||
|
||||
final UpdateAdapter<OrderHoldBillEntity> _orderHoldBillEntityUpdateAdapter;
|
||||
|
||||
final DeletionAdapter<OrderHoldBillEntity>
|
||||
_orderHoldBillEntityDeletionAdapter;
|
||||
|
||||
@override
|
||||
Future<int> save(OrderHoldBillEntity entity) {
|
||||
return _orderHoldBillEntityInsertionAdapter.insertAndReturnId(
|
||||
entity, OnConflictStrategy.abort);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> edit(OrderHoldBillEntity entity) async {
|
||||
await _orderHoldBillEntityUpdateAdapter.update(
|
||||
entity, OnConflictStrategy.abort);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> del(OrderHoldBillEntity entity) async {
|
||||
await _orderHoldBillEntityDeletionAdapter.delete(entity);
|
||||
}
|
||||
}
|
||||
|
||||
class _$CanteenSpuDao extends CanteenSpuDao {
|
||||
_$CanteenSpuDao(
|
||||
this.database,
|
||||
|
||||
Reference in new issue
Block a user