82 lines
2.5 KiB
Python
82 lines
2.5 KiB
Python
"""
|
|
验证初步核实审批表数据是否正确写入数据库
|
|
"""
|
|
import pymysql
|
|
|
|
DB_CONFIG = {
|
|
'host': '152.136.177.240',
|
|
'port': 5012,
|
|
'user': 'finyx',
|
|
'password': '6QsGK6MpePZDE57Z',
|
|
'database': 'finyx',
|
|
'charset': 'utf8mb4'
|
|
}
|
|
|
|
TENANT_ID = 615873064429507639
|
|
|
|
conn = pymysql.connect(**DB_CONFIG)
|
|
cursor = conn.cursor()
|
|
|
|
print("="*60)
|
|
print("验证初步核实审批表相关数据")
|
|
print("="*60)
|
|
|
|
# 1. 查看文件配置
|
|
print("\n1. 文件配置 (f_polic_file_config):")
|
|
cursor.execute("""
|
|
SELECT id, name, file_path, input_data, state
|
|
FROM f_polic_file_config
|
|
WHERE tenant_id = %s AND name = '初步核实审批表'
|
|
""", (TENANT_ID,))
|
|
file_config = cursor.fetchone()
|
|
if file_config:
|
|
print(f" ID: {file_config[0]}")
|
|
print(f" 名称: {file_config[1]}")
|
|
print(f" 文件路径: {file_config[2]}")
|
|
print(f" 输入数据: {file_config[3]}")
|
|
print(f" 状态: {file_config[4]}")
|
|
file_config_id = file_config[0]
|
|
else:
|
|
print(" 未找到文件配置")
|
|
file_config_id = None
|
|
|
|
# 2. 查看相关字段
|
|
print("\n2. 相关字段 (f_polic_field):")
|
|
cursor.execute("""
|
|
SELECT id, name, filed_code, field_type, state
|
|
FROM f_polic_field
|
|
WHERE tenant_id = %s
|
|
AND filed_code IN ('target_name', 'target_organization_and_position', 'target_organization', 'target_position',
|
|
'target_gender', 'target_date_of_birth', 'target_age', 'target_education_level',
|
|
'target_political_status', 'target_professional_rank', 'clue_source', 'target_issue_description',
|
|
'department_opinion', 'filler_name')
|
|
ORDER BY field_type, name
|
|
""", (TENANT_ID,))
|
|
fields = cursor.fetchall()
|
|
print(f" 找到 {len(fields)} 个字段:")
|
|
for field in fields:
|
|
field_type_str = "输出字段" if field[3] == 2 else "输入字段"
|
|
state_str = "启用" if field[4] == b'\x01' else "未启用"
|
|
print(f" - {field[1]} ({field[2]}) [{field_type_str}] [{state_str}]")
|
|
|
|
# 3. 查看关联关系
|
|
if file_config_id:
|
|
print("\n3. 文件和字段关联关系 (f_polic_file_field):")
|
|
cursor.execute("""
|
|
SELECT ff.id, f.name, f.filed_code
|
|
FROM f_polic_file_field ff
|
|
JOIN f_polic_field f ON ff.filed_id = f.id
|
|
WHERE ff.tenant_id = %s AND ff.file_id = %s
|
|
""", (TENANT_ID, file_config_id))
|
|
relations = cursor.fetchall()
|
|
print(f" 找到 {len(relations)} 个关联关系:")
|
|
for rel in relations:
|
|
print(f" - {rel[1]} ({rel[2]})")
|
|
|
|
print("\n" + "="*60)
|
|
print("验证完成!")
|
|
print("="*60)
|
|
|
|
conn.close()
|
|
|