fix: 添加藏品编号查重功能
This commit is contained in:
parent
c226f00a60
commit
cd2e8e80cb
|
|
@ -374,6 +374,22 @@ def create_collection(
|
||||||
db
|
db
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# 编号查重(如果提供了编号且不是强制保存)
|
||||||
|
if not force and final_code:
|
||||||
|
existing_code = db.query(Collection).filter(
|
||||||
|
Collection.f01_02_code == final_code,
|
||||||
|
Collection.f99_91_user_id == current_user.f99_90_id
|
||||||
|
).first()
|
||||||
|
|
||||||
|
if existing_code:
|
||||||
|
logger.warning(f"发现重复编号:{final_code}, 已存在藏品 ID: {existing_code.f99_90_id}")
|
||||||
|
return {
|
||||||
|
"error": {
|
||||||
|
"code": "DUPLICATE_CODE",
|
||||||
|
"message": f"藏品编号 {final_code} 已存在,请使用其他编号"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# 冠字号查重(如果提供了冠字号且不是强制保存)
|
# 冠字号查重(如果提供了冠字号且不是强制保存)
|
||||||
if not force and collection_data.f02_10_prefix_serial:
|
if not force and collection_data.f02_10_prefix_serial:
|
||||||
# 查询当前用户是否有相同冠字号的藏品
|
# 查询当前用户是否有相同冠字号的藏品
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# Version Configuration for Zodiac Collection Management System
|
# Version Configuration for Zodiac Collection Management System
|
||||||
|
|
||||||
# 当前版本号 (语义化版本:主版本。次版本.修订版)
|
# 当前版本号 (语义化版本:主版本。次版本.修订版)
|
||||||
VERSION=1.1.8
|
VERSION=1.1.9
|
||||||
|
|
||||||
# 版本代号 (可选)
|
# 版本代号 (可选)
|
||||||
VERSION_CODENAME="新生"
|
VERSION_CODENAME="新生"
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<title>甲辰收藏 v1.1.7</title>
|
<title>甲辰收藏 v1.1.8</title>
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico" />
|
<link rel="icon" type="image/x-icon" href="/static/icons/favicon.ico" />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue