v1.2.70 - 修复版本号统一+编号并发锁+Stats性能优化
This commit is contained in:
parent
49795690af
commit
022e81c800
|
|
@ -67,11 +67,11 @@ def generate_code(version: str, user_id: str, db: Session) -> str:
|
||||||
"""自动生成藏品编号 - 按用户独立编码"""
|
"""自动生成藏品编号 - 按用户独立编码"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
# 查询当前用户的非空编码(不与其他用户混算)
|
# 查询当前用户的非空编码(不与其他用户混算)- 使用行锁防止并发
|
||||||
user_codes = db.query(Collection.f01_02_code).filter(
|
user_codes = db.query(Collection.f01_02_code).filter(
|
||||||
Collection.f01_02_code.isnot(None),
|
Collection.f01_02_code.isnot(None),
|
||||||
Collection.f99_91_user_id == user_id
|
Collection.f99_91_user_id == user_id
|
||||||
).all()
|
).with_for_update().all()
|
||||||
|
|
||||||
max_num = 0
|
max_num = 0
|
||||||
for (code,) in user_codes:
|
for (code,) in user_codes:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue