移除临时文件,添加/更新.gitignore

This commit is contained in:
Hermes Agent 2026-06-22 15:00:30 +08:00
parent f05eea19e5
commit e8f836ba2d
9 changed files with 13 additions and 24 deletions

4
.gitignore vendored
View File

@ -1,2 +1,6 @@
product_management.egg-info/ product_management.egg-info/
__pycache__/ __pycache__/
*.pyc
*.pyo
*.egg-info/
.DS_Store

View File

@ -21,7 +21,8 @@
"name": "parent_id", "name": "parent_id",
"title": "父类别ID", "title": "父类别ID",
"type": "str", "type": "str",
"length": 32 "length": 32,
"nullable": "yes"
}, },
{ {
"name": "name", "name": "name",

View File

@ -1,7 +0,0 @@
Metadata-Version: 2.4
Name: product_management
Version: 1.0.0
Summary: Sage product management module - dynamic category tree, product registry, operator config, standardized API
Requires-Python: >=3.8
Requires-Dist: sqlor
Requires-Dist: bricks_for_python

View File

@ -1,10 +0,0 @@
README.md
pyproject.toml
product_management/__init__.py
product_management/core.py
product_management/init.py
product_management.egg-info/PKG-INFO
product_management.egg-info/SOURCES.txt
product_management.egg-info/dependency_links.txt
product_management.egg-info/requires.txt
product_management.egg-info/top_level.txt

View File

@ -1,2 +0,0 @@
sqlor
bricks_for_python

View File

@ -1 +0,0 @@
product_management

View File

@ -12,7 +12,7 @@ try:
data['created_at'] = timestampstr() data['created_at'] = timestampstr()
data['updated_at'] = timestampstr() data['updated_at'] = timestampstr()
if 'parent_id' not in data or not data['parent_id']: if 'parent_id' not in data or not data['parent_id']:
data['parent_id'] = '0' data['parent_id'] = None
if 'has_product' not in data: if 'has_product' not in data:
data['has_product'] = '0' data['has_product'] = '0'
if 'status' not in data: if 'status' not in data:
@ -21,7 +21,7 @@ try:
data['sort_order'] = '0' data['sort_order'] = '0'
# Validate parent belongs to same org # Validate parent belongs to same org
if data['parent_id'] != '0': if data['parent_id'] is not None:
check_sql = "SELECT id FROM product_category WHERE id = ${parent_id}$ AND org_id = ${org_id}$" check_sql = "SELECT id FROM product_category WHERE id = ${parent_id}$ AND org_id = ${org_id}$"
async with DBPools().sqlorContext(dbname) as sor: async with DBPools().sqlorContext(dbname) as sor:
rows = await sor.sqlExe(check_sql, {'parent_id': data['parent_id'], 'org_id': org_id}) rows = await sor.sqlExe(check_sql, {'parent_id': data['parent_id'], 'org_id': org_id})

View File

@ -21,6 +21,11 @@ try:
data['updated_at'] = timestampstr() data['updated_at'] = timestampstr()
data['id'] = record_id data['id'] = record_id
# Convert empty parent_id to NULL for tree root nodes
if 'parent_id' in data and not data['parent_id']:
data['parent_id'] = None
if data.get('has_product') == '0': if data.get('has_product') == '0':
data['product_type'] = '' data['product_type'] = ''
data['product_type_title'] = '' data['product_type_title'] = ''