feat:交易记录、日期组建
This commit is contained in:
1 parent
08ad1c2d81
commit
88e73ad950
32 files changed
+672
-279
No files matched your search
@@ -112,7 +112,7 @@ class _$AppDatabase extends AppDatabase {
|
||||
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 `product` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `sysType` TEXT NOT NULL, `classifyServiceUniqueCode` TEXT NOT NULL, `hourType` INTEGER, `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, `delFlag` INTEGER NOT NULL)');
|
||||
'CREATE TABLE IF NOT EXISTS `product` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `sysType` TEXT NOT NULL, `classifyServiceUniqueCode` TEXT NOT NULL, `hourType` INTEGER, `saleDate` TEXT, `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, `delFlag` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `shop_card` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `orderId` INTEGER NOT NULL, `productServiceUniqueCode` TEXT NOT NULL, `productName` TEXT NOT NULL, `productPic` TEXT NOT NULL, `productPrice` INTEGER NOT NULL, `productNumber` INTEGER NOT NULL, `productWidget` REAL NOT NULL, `totalPrice` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
@@ -287,7 +287,7 @@ class _$OrderDao extends OrderDao {
|
||||
String hourType,
|
||||
) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT * FROM order_record WHERE (?1 == \"-1\" OR status = ?1) AND (?6 = \'-1\' OR sysType = ?6) AND (?7 = \'-1\' OR hourType = ?7) AND createTime >= ?2 AND createTime <= ?3 ORDER BY createTime DESC LIMIT ?4 OFFSET ?5',
|
||||
'SELECT * FROM order_record WHERE (?1 == \"-1\" OR status = ?1) AND (?6 = \'-1\' OR sysType = ?6) AND (?7 = \'-1\' OR hourType = ?7) AND strftime(\'%Y-%m-%d\', createTime) >= strftime(\'%Y-%m-%d\', ?2) AND strftime(\'%Y-%m-%d\', createTime) <= strftime(\'%Y-%m-%d\', ?3) ORDER BY createTime DESC LIMIT ?4 OFFSET ?5',
|
||||
mapper: (Map<String, Object?> row) => OrderEntity(
|
||||
id: row['id'] as int?,
|
||||
uniqueCode: row['uniqueCode'] as String,
|
||||
@@ -329,7 +329,7 @@ class _$OrderDao extends OrderDao {
|
||||
String hourType,
|
||||
) async {
|
||||
return _queryAdapter.query(
|
||||
'SELECT COUNT(0) FROM order_record WHERE (?1 == \"-1\" OR status = ?1) AND (?4 = \'-1\' OR sysType = ?4) AND (?5 = \'-1\' OR hourType = ?5) AND createTime >= ?2 AND createTime <= ?3',
|
||||
'SELECT COUNT(0) FROM order_record WHERE (?1 == \"-1\" OR status = ?1) AND (?4 = \'-1\' OR sysType = ?4) AND (?5 = \'-1\' OR hourType = ?5) AND strftime(\'%Y-%m-%d\', createTime) >= strftime(\'%Y-%m-%d\', ?2) AND strftime(\'%Y-%m-%d\', createTime) <= strftime(\'%Y-%m-%d\', ?3)',
|
||||
mapper: (Map<String, Object?> row) => row.values.first as int,
|
||||
arguments: [
|
||||
status,
|
||||
@@ -452,6 +452,7 @@ class _$ProductDao extends ProductDao {
|
||||
'sysType': _sysTypeConverter.encode(item.sysType),
|
||||
'classifyServiceUniqueCode': item.classifyServiceUniqueCode,
|
||||
'hourType': item.hourType?.index,
|
||||
'saleDate': _dateTimeEmptyConverter.encode(item.saleDate),
|
||||
'name': item.name,
|
||||
'price': item.price,
|
||||
'image': item.image,
|
||||
@@ -472,6 +473,7 @@ class _$ProductDao extends ProductDao {
|
||||
'sysType': _sysTypeConverter.encode(item.sysType),
|
||||
'classifyServiceUniqueCode': item.classifyServiceUniqueCode,
|
||||
'hourType': item.hourType?.index,
|
||||
'saleDate': _dateTimeEmptyConverter.encode(item.saleDate),
|
||||
'name': item.name,
|
||||
'price': item.price,
|
||||
'image': item.image,
|
||||
@@ -492,6 +494,7 @@ class _$ProductDao extends ProductDao {
|
||||
'sysType': _sysTypeConverter.encode(item.sysType),
|
||||
'classifyServiceUniqueCode': item.classifyServiceUniqueCode,
|
||||
'hourType': item.hourType?.index,
|
||||
'saleDate': _dateTimeEmptyConverter.encode(item.saleDate),
|
||||
'name': item.name,
|
||||
'price': item.price,
|
||||
'image': item.image,
|
||||
@@ -529,7 +532,7 @@ class _$ProductDao extends ProductDao {
|
||||
String hourType,
|
||||
) async {
|
||||
await _queryAdapter.queryNoReturn(
|
||||
'UPDATE product SET isDefault = ?1 WHERE delFlag = 0 AND serviceUniqueCode = ?2 AND hourType = ?3',
|
||||
'UPDATE product SET isDefault = ?1 WHERE delFlag = 0 AND serviceUniqueCode = ?2 AND hourType = ?3 AND (sysType = \'canteen\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\'))',
|
||||
arguments: [_boolConverter.encode(isDefault), uniqueCode, hourType]);
|
||||
}
|
||||
|
||||
@@ -539,7 +542,7 @@ class _$ProductDao extends ProductDao {
|
||||
String hourType,
|
||||
) async {
|
||||
return _queryAdapter.query(
|
||||
'SELECT DISTINCT COUNT(0) FROM product WHERE delFlag = 0 AND (?1 = \'-1\' OR sysType = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0)',
|
||||
'SELECT DISTINCT COUNT(0) FROM product WHERE delFlag = 0 AND (?1 = \'-1\' OR sysType = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?1 = \'canteen\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\'))',
|
||||
mapper: (Map<String, Object?> row) => row.values.first as int,
|
||||
arguments: [sysType, hourType]);
|
||||
}
|
||||
@@ -557,6 +560,7 @@ class _$ProductDao extends ProductDao {
|
||||
hourType: row['hourType'] == null
|
||||
? null
|
||||
: ProductHourType.values[row['hourType'] as int],
|
||||
saleDate: _dateTimeEmptyConverter.decode(row['saleDate'] as String),
|
||||
name: row['name'] as String,
|
||||
price: row['price'] as int,
|
||||
image: row['image'] as String?,
|
||||
@@ -577,12 +581,12 @@ class _$ProductDao extends ProductDao {
|
||||
) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT product.* FROM product LEFT JOIN classify ON product.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE product.delFlag = 0 AND (?1 = \'-1\' OR product.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR product.sysType = ?3) ORDER BY classify.sort, product.price',
|
||||
mapper: (Map<String, Object?> row) => ProductEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, sysType: _sysTypeConverter.decode(row['sysType'] as String), classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
mapper: (Map<String, Object?> row) => ProductEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, sysType: _sysTypeConverter.decode(row['sysType'] as String), classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeEmptyConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [classifyServiceUniqueCode, hourType, sysType]);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<ProductEntity>> getCurrentDayAllPage(
|
||||
Future<List<ProductEntity>> getAllPage(
|
||||
String classifyServiceUniqueCode,
|
||||
String hourType,
|
||||
String sysType,
|
||||
@@ -590,8 +594,8 @@ class _$ProductDao extends ProductDao {
|
||||
int offset,
|
||||
) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT product.* FROM product LEFT JOIN classify ON product.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE product.delFlag = 0 AND (?1 = \'-1\' OR product.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || product.hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR product.sysType = ?3) ORDER BY classify.sort, classify.id, product.price LIMIT ?4 OFFSET ?5',
|
||||
mapper: (Map<String, Object?> row) => ProductEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, sysType: _sysTypeConverter.decode(row['sysType'] as String), classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
'SELECT product.* FROM product LEFT JOIN classify ON product.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE product.delFlag = 0 AND (?1 = \'-1\' OR product.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || product.hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR product.sysType = ?3) AND (?3 = \'canteen\' OR strftime(\'%Y-%m-%d\', product.saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\')) ORDER BY classify.sort, classify.id, product.price LIMIT ?4 OFFSET ?5',
|
||||
mapper: (Map<String, Object?> row) => ProductEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, sysType: _sysTypeConverter.decode(row['sysType'] as String), classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeEmptyConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [
|
||||
classifyServiceUniqueCode,
|
||||
hourType,
|
||||
@@ -607,8 +611,8 @@ class _$ProductDao extends ProductDao {
|
||||
String hourType,
|
||||
) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT * FROM product WHERE product.delFlag = 0 AND isDefault = 1 AND (?1 = \'-1\' OR sysType = ?1) AND (?2 = \'-1\' OR hourType = ?2)',
|
||||
mapper: (Map<String, Object?> row) => ProductEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, sysType: _sysTypeConverter.decode(row['sysType'] as String), classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
'SELECT * FROM product WHERE delFlag = 0 AND isDefault = 1 AND (?1 = \'-1\' OR sysType = ?1) AND (?2 = \'-1\' OR hourType = ?2) AND (?1 = \'canteen\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', \'now\', \'localtime\'))',
|
||||
mapper: (Map<String, Object?> row) => ProductEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, sysType: _sysTypeConverter.decode(row['sysType'] as String), classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeEmptyConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [sysType, hourType]);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user