增加t自定义服务费单价

This commit is contained in:
2026-07-15 11:23:02 +08:00
parent 9c3c1e26cc
commit 96cca34de0
6 changed files with 245 additions and 28 deletions

View File

@@ -21,6 +21,9 @@ def init_database_tables():
merge_telecom TINYINT NULL COMMENT '是否合并特来电数据',
telecom_vehicle_no VARCHAR(500) NULL COMMENT '特来电车量自编号',
field_custom_names VARCHAR(2000) NULL COMMENT '字段自定义报表名头',
show_monthly_total TINYINT NULL COMMENT '是否显示当月充电量总计',
custom_service_fee_price DECIMAL(10,4) NULL COMMENT '自定义服务费单价(元/kWh)',
custom_service_fee_name VARCHAR(100) NULL COMMENT '自定义服务费报表表头名称',
is_active TINYINT NULL COMMENT '是否启用',
sort_order INT NULL COMMENT '排序顺序',
create_time DATETIME NULL COMMENT '创建时间',
@@ -118,7 +121,31 @@ def init_database_tables():
if "Duplicate" in str(e) or "duplicate" in str(e) or "Exists" in str(e) or "exists" in str(e):
pass
else:
print(f"[数据库] 求和数据表新增 sort_order 字段时出错(可能已存在): {e}")
print(f"[数据库] 新增 sort_order 字段时出错(可能已存在): {e}")
# 给配置表增加 custom_service_fee_price 字段(自定义服务费单价)
try:
execute_update(
"ALTER TABLE t_daily_report_config ADD COLUMN custom_service_fee_price DECIMAL(10,4) NULL COMMENT '自定义服务费单价(元/kWh)' "
)
print("[数据库] 配置表新增 custom_service_fee_price 字段成功")
except Exception as e:
if "Duplicate" in str(e) or "duplicate" in str(e) or "Exists" in str(e) or "exists" in str(e):
pass
else:
print(f"[数据库] 新增 custom_service_fee_price 字段时出错(可能已存在): {e}")
# 给配置表增加 custom_service_fee_name 字段(自定义服务费表头名称)
try:
execute_update(
"ALTER TABLE t_daily_report_config ADD COLUMN custom_service_fee_name VARCHAR(100) NULL COMMENT '自定义服务费报表表头名称' "
)
print("[数据库] 配置表新增 custom_service_fee_name 字段成功")
except Exception as e:
if "Duplicate" in str(e) or "duplicate" in str(e) or "Exists" in str(e) or "exists" in str(e):
pass
else:
print(f"[数据库] 新增 custom_service_fee_name 字段时出错(可能已存在): {e}")
# 数据迁移:给 sort_order 为 NULL 的配置记录按 id 顺序赋值
try: