ETest-Vue-FastAPI/check_menu_detail.py

99 lines
3.5 KiB
Python
Raw Normal View History

2026-03-30 10:38:36 +08:00
#!/usr/bin/env python3
"""检查菜单详细配置"""
import asyncio
from sqlalchemy.ext.asyncio import create_async_engine
from sqlalchemy import text
DB_CONFIG = {
'host': '123.57.81.127',
'port': 3306,
'user': 'cpy_admin',
'password': 'Tgzz2025+',
'database': 'ruoyi-fastapi'
}
DATABASE_URL = (
f"mysql+asyncmy://{DB_CONFIG['user']}:{DB_CONFIG['password']}@"
f"{DB_CONFIG['host']}:{DB_CONFIG['port']}/{DB_CONFIG['database']}"
)
async def check_menu_detail():
engine = create_async_engine(DATABASE_URL, echo=False)
async with engine.connect() as conn:
print("=" * 80)
print("Menu Detail Check")
print("=" * 80)
# 1. 检查工单领取菜单
print("\n[1] Work Order Claim Menu Detail:")
result = await conn.execute(text("""
SELECT menu_id, menu_name, parent_id, path, component, menu_type, visible, status, perms, icon
FROM sys_menu
WHERE path LIKE '%claim%' OR path LIKE '%workorder%'
ORDER BY menu_id
"""))
rows = result.fetchall()
for row in rows:
print(f" ID:{row[0]} | Type:{row[5]} | Visible:{row[6]} | Status:{row[7]}")
print(f" Path: {row[3]}")
print(f" Component: {row[4]}")
print(f" Perms: {row[8]}")
print()
# 2. 检查测试类别菜单
print("\n[2] Test Category Menu Detail:")
result = await conn.execute(text("""
SELECT menu_id, menu_name, parent_id, path, component, menu_type, visible, status, perms
FROM sys_menu
WHERE path = 'test_category'
ORDER BY menu_id
"""))
rows = result.fetchall()
for row in rows:
print(f" ID:{row[0]} | Type:{row[5]} | Visible:{row[6]} | Status:{row[7]}")
print(f" Path: {row[3]}")
print(f" Component: {row[4]}")
print(f" Perms: {row[8]}")
print()
# 3. 检查测试配置管理目录下的所有菜单
print("\n[3] Test Config Directory Children:")
result = await conn.execute(text("""
SELECT m.menu_id, m.menu_name, m.path, m.component, m.menu_type, m.visible, m.status
FROM sys_menu m
WHERE m.parent_id = 2059
ORDER BY m.order_num
"""))
rows = result.fetchall()
for row in rows:
print(f" ID:{row[0]} | Type:{row[4]} | Visible:{row[5]} | Status:{row[6]}")
print(f" Name: {row[1]}")
print(f" Path: {row[2]}")
print(f" Component: {row[3]}")
print()
# 4. 检查系统管理目录下的测试类别
print("\n[4] System Management - Test Category:")
result = await conn.execute(text("""
SELECT m.menu_id, m.menu_name, m.path, m.component, m.menu_type, m.visible, m.status
FROM sys_menu m
WHERE m.parent_id = 2036 AND (m.menu_name LIKE '%测试%' OR m.menu_name LIKE '%类别%')
ORDER BY m.order_num
"""))
rows = result.fetchall()
for row in rows:
print(f" ID:{row[0]} | Type:{row[4]} | Visible:{row[5]} | Status:{row[6]}")
print(f" Name: {row[1]}")
print(f" Path: {row[2]}")
print(f" Component: {row[3]}")
print()
print("\n" + "=" * 80)
await engine.dispose()
if __name__ == '__main__':
asyncio.run(check_menu_detail())