From 022e81c800fb0cfc74f195a094bae1a8691ebb87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=94=B2=E8=BE=B0=E7=94=9F=E4=BA=A7?= Date: Wed, 8 Apr 2026 20:44:15 +0800 Subject: [PATCH] =?UTF-8?q?v1.2.70=20-=20=E4=BF=AE=E5=A4=8D=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E5=8F=B7=E7=BB=9F=E4=B8=80+=E7=BC=96=E5=8F=B7?= =?UTF-8?q?=E5=B9=B6=E5=8F=91=E9=94=81+Stats=E6=80=A7=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/routers/collections.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/app/routers/collections.py b/backend/app/routers/collections.py index cfad289..7fbf85a 100644 --- a/backend/app/routers/collections.py +++ b/backend/app/routers/collections.py @@ -67,11 +67,11 @@ def generate_code(version: str, user_id: str, db: Session) -> str: """自动生成藏品编号 - 按用户独立编码""" import re - # 查询当前用户的非空编码(不与其他用户混算) + # 查询当前用户的非空编码(不与其他用户混算)- 使用行锁防止并发 user_codes = db.query(Collection.f01_02_code).filter( Collection.f01_02_code.isnot(None), Collection.f99_91_user_id == user_id - ).all() + ).with_for_update().all() max_num = 0 for (code,) in user_codes: