From fdfabf7eb79bf22bcf438e4d6ee115fea9719a1a Mon Sep 17 00:00:00 2001 From: dzc <2388224167@qq.com> Date: Wed, 14 Oct 2026 16:59:18 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E6=AF=8F=E6=97=A5=E8=8F=9C?= =?UTF-8?q?=E8=B0=B1=E6=8E=92=E5=BA=8F=E5=92=8C=E6=B6=88=E8=B4=B9=E6=9C=BA?= =?UTF-8?q?=E6=8E=92=E5=BA=8F=E4=B8=80=E8=87=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../services/database/dao/canteen_spu_dao.dart | 13 ++++++++----- lib/common/services/database/database.g.dart | 2 +- lib/common/values/constants.dart | 6 +++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/common/services/database/dao/canteen_spu_dao.dart b/lib/common/services/database/dao/canteen_spu_dao.dart index daaacae..622fbda 100644 --- a/lib/common/services/database/dao/canteen_spu_dao.dart +++ b/lib/common/services/database/dao/canteen_spu_dao.dart @@ -114,15 +114,18 @@ abstract class CanteenSpuDao { ); /// 查询指定分类、餐段和日期的全部主商品快照。 + /// + /// 排序与 PC 后台「每日菜谱-列表管理」默认展示一致:商品 sort 升序,同序时按接口 + /// 返回顺序(服务端已按餐段、菜谱行 ID 稳定排序)。本地自增 id 在按日原子替换时 + /// 保持接口返回顺序,因此作为同序并列键即可复刻后台顺序,不再按分类或价格重排。 @Query(''' SELECT canteen_spu.* FROM canteen_spu - LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 - WHERE - (:classifyServiceUniqueCode = '-1' OR canteen_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode) - AND (:hourType = '-1' OR INSTR(',' || hourType || ',', ',' || :hourType || ',') > 0) + WHERE + (:classifyServiceUniqueCode = '-1' OR canteen_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode) + AND (:hourType = '-1' OR INSTR(',' || hourType || ',', ',' || :hourType || ',') > 0) AND (:saleDate = '-1' OR strftime('%Y-%m-%d', saleDate) = strftime('%Y-%m-%d', :saleDate)) - ORDER BY classify.sort,canteen_spu.sort desc,canteen_spu.price + ORDER BY canteen_spu.sort asc, canteen_spu.id asc ''') Future> getAll( String classifyServiceUniqueCode, diff --git a/lib/common/services/database/database.g.dart b/lib/common/services/database/database.g.dart index 4f30f90..90bc095 100644 --- a/lib/common/services/database/database.g.dart +++ b/lib/common/services/database/database.g.dart @@ -983,7 +983,7 @@ class _$CanteenSpuDao extends CanteenSpuDao { String saleDate, ) async { return _queryAdapter.queryList( - 'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', ?3)) ORDER BY classify.sort,canteen_spu.sort desc,canteen_spu.price', + 'SELECT canteen_spu.* FROM canteen_spu WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', ?3)) ORDER BY canteen_spu.sort asc, canteen_spu.id asc', mapper: (Map row) => CanteenSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, stock: row['stock'] as int?, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, isPriceIncreased: _boolConverter.decode(row['isPriceIncreased'] as int), spuType: row['spuType'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String)), arguments: [classifyServiceUniqueCode, hourType, saleDate]); } diff --git a/lib/common/values/constants.dart b/lib/common/values/constants.dart index fb729c1..c65ec17 100644 --- a/lib/common/values/constants.dart +++ b/lib/common/values/constants.dart @@ -15,10 +15,10 @@ class Constants { static const pwdEncKey = 'pigxpigxpigxpigx'; /// 服务 url 线上 - // static const apiUrl = 'https://dzc-test-1.fy.takin.cc'; - static const apiUrl = 'https://www.zianxin.com/api'; + static const apiUrl = 'https://dzc-test-1.fy.takin.cc'; +// static const apiUrl = 'https://www.zianxin.com/api'; - // static const apiUrl = 'https://dzc-test-1.fy.takin.cc'; +// static const apiUrl = 'https://dzc-test-1.fy.takin.cc'; /// 静态资源 url 497 static const ossUrl = apiUrl;