日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

基于python语言开发的员工信息管理系统

發布時間:2023/12/10 python 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 基于python语言开发的员工信息管理系统 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

摘要

目前,在社會里,隨著生產發展的不斷擴大和務工人數的不斷增加,需要處理大量的員工數據信息。如何更好的組織員工信息,更加快捷的管理員工信息顯得尤為的重要。
管理信息系統是一個不斷發展的新型學科,任何一個單位要生存要發展,要高效率地把內部活動有機地組織起來,就必須建立與自身特點相適應的管理信息系統。

1.引言

通過員工信息管理系統可以做到信息的規范化管理、科學性統計和快速查詢、修改、增加、刪除等,從而減少管理方面的工作量。幫助管理人員更好的管理信息。本軟件最終用戶是某公司的工作人員,能夠對計算機進行簡單的操作。
本系統對維護人員的要求是維護人員是計算機科學技術或相關專業學歷,具備PYTHON,MySQL數據庫開發經驗,懂得軟件開發流程,具備相關測試經驗和閱讀項目說明書以及代碼能力。
本系統使用較為頻繁,應具備全天候運行能力,故本系統應極為穩定,系統資源消耗少。

2.系統結構

本系統根據前端模塊來設計,此次設計,使用python+mysql數據庫實現簡易的員工信息管理系統
本系統以VS Code作為開發工具。通過對員工信息管理系統,進行可行性分析,需求分析以及設計,將系統逐步呈現出來主要功能包括:建立各類員工信息設置管理,在計算機的支持下實現員工信息的添加、刪除、查找、修改。
前端功能模塊設計圖如下:
1.查找信息模塊
輸入阿拉伯數字1后即搜索:可以通過信息的搜索,對某公司的所有員工信息進行篩查,點擊搜索,顯示搜索到的員工姓名以及工號。
2.修改信息模塊
輸入阿拉伯數字2后按工號進行員工信息修改,修改成功后系統會提示success
3.刪除信息模塊
輸入阿拉伯數字3后即可刪除錄入在數據庫中的信息
4.增加信息模塊
輸入阿拉伯數字4后顯示英文please insert info for staff:,隨后即可錄入員工的工號以及名字
5.退出系統模塊
輸入阿拉伯數字5后即退出系統
如下圖:

信息管理 添加信息 用戶登錄后,進入管理界面,可以添加信息。
查詢信息 用戶登錄后,進入管理界面,查詢查看信息。
刪除信息 用戶登錄后,進入管理界面,查詢刪除信息
修改信息 用戶登錄后,進入管理界面,查詢修改信息

系統的所有信息管理模塊運行時通過與用戶數據庫相連,可以修改數據庫,可以增加、刪除、查找、修改信息。

員工信息管理運行時通過與信息數據庫連接然后運行,接下來員工以及某公司的管理員都可以在系統中增加、刪除、查找、修改自己的信息信息。

3.實現代碼

用戶添加信息模塊
代碼如下

import time, uuidimport MySQLdb import MySQLdb.cursors db = MySQLdb.connect(host='localhost', user='root', passwd='root', db='user',cursorclass=MySQLdb.cursors.DictCursor) cur = db.cursor()def next_id():return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)def Add():print('please insert info for staff:')uid = next_id()name = input('name:')number = input('employee number:')sql = 'INSERT INTO users(user_id,user_name,employee_number) VALUES (%s,%s,%s)'try:cur.execute(sql,[uid,name,number])db.commit()except Exception as e:db.rollback()print('delete fail, reason: ' + e)# cur.close()# db.close()

3.3用戶查詢信息模塊
代碼如下:

import MySQLdb import MySQLdb.cursors db = MySQLdb.connect(host='localhost', user='root', passwd='root', db='user',cursorclass=MySQLdb.cursors.DictCursor) cur = db.cursor()def staffInfo(Table):sql = 'select * from ' + Tablecur.execute(sql)EmployeeInfo = cur.fetchall()EmployeeInfo = list(EmployeeInfo)findName = input('Pelase enter name who you want to serch(if you need to find all, please input All):')if findName == 'All':print(EmployeeInfo)else:for staff in EmployeeInfo:if staff['user_name'] == findName:print("ID: %(user_id)s, Name: %(user_name)s,Employee Number: %(employee_number)s" %staff)breakelse:print('no this staff')}

3.4用戶刪除信息模塊
代碼如下:

import MySQLdb import MySQLdb.cursors db = MySQLdb.connect(host='localhost', user='root', passwd='root', db='user',cursorclass=MySQLdb.cursors.DictCursor) cur = db.cursor()def Delete():name = input('Please enter the name of the employee you want to delete:')sql = 'delete from users where user_name = %s'try:cur.execute(sql, [name])db.commit()print('delete success')except Exception as e:db.rollback()print(e)# cur.close()# db.close()'''for staff in Table:if staff['name'] == name:# 查找索引Index = Table.index(staff)del Table[Index]print('Success')break '''

3.5用戶修改信息模塊
代碼如下:

import MySQLdb import MySQLdb.cursors db = MySQLdb.connect(host='localhost', user='root', passwd='root', db='user',cursorclass=MySQLdb.cursors.DictCursor) cur = db.cursor()def Modify(Table):while True:Query = input('Please enter the employee to be modified (if you want to exit, please enter exit):')if Query == 'exit':breakelse:sql = "UPDATE users SET employee_number=%s WHERE user_name=%s;"employeeNumber = input('New employee number:')try:# 執行SQL語句cur.execute(sql, [employeeNumber, Query])print('success')# 提交事務db.commit()except Exception as e:db.rollback()print('fail')print(e)# 輸出修改前和修改后,供用戶確認,如果用戶輸入yes,則執行修改,如果用戶輸入no,則不修改# while True:# Query = input('Please enter the employee to be modified (if you want to exit, please enter exit):')# if Query == 'exit':# break# else:# for staff in Table:# if staff['name'] == Query:# newAge = input('New age:')# newContractor = input("Isn't this employee a contractor?")# if newContractor == 'yes':# newContractor = 0# elif newContractor == 'no':# newContractor = 1# staff['age'] = newAge# staff['contractor'] = newContractor# print('name:%s,\nage:%s,\n,contractor:%s\n' %(staff['name'],staff['age'],staff['contractor']))# break!# else:# print('No information for this employee,please re-enter')

4.實驗結果

添加進數據庫的信息:

計算機的支持下實現員工的添加、刪除、查找、修改。故此次實驗成功

5.實驗總結

python語言的強大無法用言語來形容,亦無法用言語來描述。最近的TIOBE編程語言排行,Python已經到了第四位,3.777%,緊緊跟在C++之后,可見Python的使用已經是如火如荼。
通過這次實驗,我認為,我在以后寫前端代碼時候,可以分層,邏輯層,視圖層,變量的設計要首先方便邏輯層的代碼,因為大量的操作基本都在邏輯層。整體來說這個項目對我對python語言的認知和成長都特別大,是一次難忘的回憶。

總結

以上是生活随笔為你收集整理的基于python语言开发的员工信息管理系统的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。