v1.2.70 - 修复版本号统一+编号并发锁+Stats性能优化

This commit is contained in:
甲辰生产 2026-04-08 20:44:15 +08:00
parent 49795690af
commit 022e81c800
1 changed files with 2 additions and 2 deletions

View File

@ -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: