c1785 2 months ago
parent d12c277689
commit 52626093fd

@ -108,13 +108,15 @@ def main():
print(f"年龄在 {min_age} - {max_age} 岁之间的学生数量为: {count}")
elif stats_choice == '0':
continue
elif choice == '6':
ui.display_import_export_menu()
import_export_choice = ui.get_input("请输入你的导入导出选择: ")
if import_export_choice != '0':
ui.handle_import_export(import_export_choice)
else:
continue
elif choice == '6':
print(6666666666666666666666666)
ui.display_import_export_menu()
import_export_choice = ui.get_input("请输入你的导入导出选择: ")
if import_export_choice != '0':
ui.handle_import_export(import_export_choice)
else:
continue
elif choice == '7':
try:
ui.bll.dal.clear_all_students()

@ -18,9 +18,9 @@ class StudentUI:
def display_menu(self):
"""显示主菜单"""
os.system('cls' if os.name == 'nt' else 'clear')
print("\n=" * 1)
print("*" * 50)
print(" 学生信息管理系统 - 主菜单 ")
print("=" * 1)
print("*" * 50)
print("1. 添加学生信息")
print("2. 删除学生信息")
print("3. 更新学生信息")
@ -29,48 +29,48 @@ class StudentUI:
print("6. 数据导入导出")
print("7. 清空所有学生信息")
print("0. 退出系统")
print("=" * 1)
print("*" * 50)
def display_query_menu(self):
"""显示查询子菜单"""
os.system('cls' if os.name == 'nt' else 'clear')
print("\n=" * 1)
print("*" * 50)
print(" 学生信息管理系统 - 查询菜单 ")
print("=" * 1)
print("*" * 50)
print("1. 查询所有学生")
print("2. 按身份证号查询")
print("3. 按学号查询")
print("4. 按姓名查询")
print("5. 按班级查询")
print("0. 返回上一级")
print("=" * 1)
print("*" * 50)
def display_stats_menu(self):
"""显示统计分析子菜单"""
os.system('cls' if os.name == 'nt' else 'clear')
print("\n=" * 1)
print("*" * 50)
print(" 学生信息管理系统 - 统计分析菜单 ")
print("=" * 1)
print("*" * 50)
print("1. 学生总数")
print("2. 平均身高")
print("3. 按身高范围统计")
print("4. 按入学年份统计")
print("5. 按年龄范围统计")
print("0. 返回上一级")
print("=" * 1)
print("*" * 50)
def display_import_export_menu(self):
"""显示数据导入导出子菜单"""
os.system('cls' if os.name == 'nt' else 'clear')
print("\n=" * 1)
print("*" * 50)
print(" 学生信息管理系统 - 数据导入导出菜单 ")
print("=" * 1)
print("*" * 50)
print("1. 导出数据到JSON")
print("2. 从JSON导入数据")
print("3. 导出数据到CSV")
print("4. 从CSV导入数据")
print("0. 返回上一级")
print("=" * 1)
print("*" * 50)
def get_input(self, prompt: str) -> str:
"""获取用户输入,添加异常处理"""
@ -82,9 +82,9 @@ class StudentUI:
def add_student(self):
"""添加学生信息"""
os.system('cls' if os.name == 'nt' else 'clear')
print("\n=" * 1)
print("*" * 50)
print(" 添加学生信息 ")
print("=" * 1)
print("*" * 50)
name = self.get_input("请输入姓名: ")
id_number = self.get_input("请输入身份证号: ")

Loading…
Cancel
Save