This commit is contained in:
zlwu committed 2026-08-26 11:10:40 +08:00
1 parent dd1acdc787
commit 4222eaa593
47 files changed
+1054350 -9663

No files matched your search

+5 -2
View File
@@ -474,7 +474,8 @@ def customer_create(
user_id = _user.get("user_id", "") or _user.get("id", "")
dept_id = _user.get("dept_id", "")
if customer_name_exists(db, body.customer_name, tenant_no):
customer_name = (body.customer_name or "").strip()
if customer_name_exists(db, tenant_no, customer_name):
return error_response(400, "客户名称已存在")
obj = create_customer(
@@ -507,7 +508,9 @@ def customer_update(
data = body.model_dump(exclude_unset=True)
customer_id = data.pop("id")
if "customer_name" in data:
if customer_name_exists(db, data["customer_name"], tenant_no, exclude_id=customer_id):
customer_name = (data["customer_name"] or "").strip()
data["customer_name"] = customer_name
if customer_name_exists(db, tenant_no, customer_name, exclude_id=customer_id):
return error_response(400, "客户名称已存在")
obj = update_customer(db, customer_id, user_id=user_id, tenant_no=tenant_no, user_info=user_info, **data)