You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
import conn
import operation
def main ( ) :
logged_in = False # 用于标记是否已经登录
while True :
print ( " 欢迎使用员工管理系统! " )
# 如果没有登录,提示用户先登录
if not logged_in :
print ( " 请选择操作: " )
print ( " 1. 登录 " )
else :
print ( " 请选择操作: " )
print ( " 2. 查询所有员工 " )
print ( " 3. 查询员工信息 " )
print ( " 4. 添加新员工 " )
print ( " 5. 修改员工信息 " )
print ( " 6. 删除员工 " )
print ( " 7. 查询考勤记录 " )
print ( " 8. 查询部门信息 " )
print ( " 9. 查询假期申请 " )
print ( " 10. 查询绩效考核 " )
print ( " 11. 查询员工入职日期之后的员工 " )
print ( " 12. 查询考勤状态 " )
print ( " 13. 查询部门主管 " )
print ( " 14. 退出系统 " )
choice = input ( " 请输入操作编号: " )
if choice == " 1 " and not logged_in :
# 登录操作
username = input ( " 请输入用户名: " )
password = input ( " 请输入密码: " )
# 假设 login 函数返回 True 表示登录成功
if operation . login ( username , password ) : # 假设 login 函数返回 True 表示登录成功
logged_in = True
print ( " 登录成功! " )
else :
print ( " 登录失败,请重新尝试! " )
elif logged_in : # 只有登录后才能执行后续操作
if choice == " 2 " :
operation . query_all_employees ( )
elif choice == " 3 " :
operation . query_id ( )
elif choice == " 4 " :
operation . add_employee ( )
elif choice == " 5 " :
operation . update_employee ( )
elif choice == " 6 " :
operation . delete_employee ( )
elif choice == " 7 " :
employee_id = input ( " 请输入员工ID查询考勤记录: " )
operation . query_attendance_by_employee_id ( employee_id )
elif choice == " 8 " :
operation . query_employee_department ( )
elif choice == " 9 " :
employee_id = input ( " 请输入员工ID查询假期申请记录: " )
operation . query_leave_requests_by_employee ( employee_id )
elif choice == " 10 " :
employee_id = input ( " 请输入员工ID查询绩效考核记录: " )
operation . query_performance_reviews_by_employee ( employee_id )
elif choice == " 11 " :
operation . query_employees_after_hire_date ( )
elif choice == " 12 " :
operation . query_attendance_by_status ( )
elif choice == " 13 " :
operation . query_department_manager ( )
elif choice == " 14 " :
print ( " 感谢使用员工管理系统! " )
operation . close ( )
break
else :
print ( " 无效选择,请重新输入! " )
else :
print ( " 无效选择,请重新输入! " )
if __name__ == " __main__ " :
main ( )