悠修复自定义实收金额和求和采集功能增强
This commit is contained in:
@@ -182,6 +182,33 @@ def init_database_tables():
|
||||
"total_amount_name VARCHAR(100) NULL COMMENT '实收金额报表表头名称'",
|
||||
'total_amount_name'
|
||||
)
|
||||
|
||||
# 创建全局配置表
|
||||
create_global_config_table = """
|
||||
CREATE TABLE IF NOT EXISTS t_daily_report_global_config (
|
||||
id BIGINT NOT NULL DEFAULT 1 COMMENT '主键(固定为1)',
|
||||
sum_data_fields VARCHAR(1000) NULL COMMENT '求和数据采集和显示字段列表(JSON格式)',
|
||||
create_time DATETIME NULL COMMENT '创建时间',
|
||||
update_time DATETIME NULL COMMENT '更新时间'
|
||||
)
|
||||
UNIQUE KEY(id)
|
||||
DISTRIBUTED BY HASH(id) BUCKETS 1
|
||||
PROPERTIES("replication_num" = "1")
|
||||
"""
|
||||
execute_update(create_global_config_table)
|
||||
_set_table_comment('t_daily_report_global_config', '日报全局配置表')
|
||||
log_info("[数据库] t_daily_report_global_config 表已就绪", 'db_init')
|
||||
|
||||
# 初始化全局配置记录(如果不存在)
|
||||
try:
|
||||
exists = execute_query("SELECT COUNT(*) as cnt FROM t_daily_report_global_config WHERE id = 1")
|
||||
if not exists or exists[0]['cnt'] == 0:
|
||||
execute_update(
|
||||
"INSERT INTO t_daily_report_global_config (id, create_time, update_time) VALUES (1, NOW(), NOW())"
|
||||
)
|
||||
log_info("[数据库] 初始化全局配置记录成功", 'db_init')
|
||||
except Exception as e:
|
||||
log_warning(f"[数据库] 初始化全局配置记录失败: {e}", 'db_init')
|
||||
|
||||
# 数据迁移:给 sort_order 为 NULL 的配置记录按 id 顺序赋值
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user