#导入pymysql
import pymysql
def update(applic_id,staff_id,state):
#1 创建mysql的数据库链接
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
#2 创建操作数据库表的增删改查的对象 ,游标对象
cur = con.cursor();
#3 定义一个sql语句
if state == "签约完成" :
rs = PanDuanId(applic_id,staff_id)
if rs == True :
sql = "update t_recruit set staff_id=%s,state=%s where applic_id = %s;"
cur.execute(sql, (staff_id, state,applic_id))
con.commit()
rs = cur.fetchall()
con.commit()
num = cur.rowcount
cur.close()
con.close()
if num > 0:
print("新增成功")
return True
else:
print("新增失败")
return False
else :
return False
else:
sql = "update t_recruit set staff_id=null,state=%s where applic_id = %s;"
cur.execute(sql, (state, applic_id))
con.commit()
rs = cur.fetchall()
con.commit()
num = cur.rowcount
cur.close()
con.close()
if num > 0:
print("新增成功")
return True
else:
print("新增失败")
return False
#新增
def add(applic_id,staff_id,state):
#1 创建mysql的数据库链接
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
#print(name,age)
#2 创建操作数据库表的增删改查的对象 ,游标对象
cur = con.cursor();
#3 定义一个sql语句
if state == "签约完成":
rs = PanDuanId(applic_id,staff_id)
if rs == True:
sql = "INSERT into t_recruit (applic_id,staff_id,state) values (%s,%s,%s);"
cur.execute(sql,(applic_id,staff_id,state))
con.commit()
rs = cur.fetchall()
con.commit()
num = cur.rowcount
cur.close()
con.close()
if num > 0:
print("新增成功")
return True
else:
print("新增失败")
return False
else:
rs = "id错误"
return rs
else:
sql = "INSERT into t_recruit (applic_id,staff_id,state) values (%s,null,%s);"
cur.execute(sql,(applic_id,state))
con.commit()
rs = cur.fetchall()
con.commit()
num = cur.rowcount
cur.close()
con.close()
if num > 0:
print("新增成功")
return True
else:
print("新增失败")
return False
def delete(id):
#1 创建mysql的数据库链接
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
#2 创建操作数据库表的增删改查的对象 ,游标对象
cur = con.cursor();
#3 定义一个sql语句
sql ="DELETE FROM t_recruit WHERE applic_id=%s;"
#4 运行sql
cur.execute(sql,(id))
#5 提交事务
con.commit()
#获取受影响行数
num = cur.rowcount
# 关闭游标对象
cur.close()
# 关闭数据库链接对象
con.close()
if num > 0:
print("删除成功")
return True
else:
print("删除失败")
return False
def selectCount(name):
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
# 2 创建操作数据库表的增删改查的对象 ,游标对象
cur = con.cursor();
if name == "":
sql1 = "SELECT count(*) from t_recruit "
cur.execute(sql1)
rs = cur.fetchall()
print(rs)
return rs[0][0]
else:
sql1 = "select count(*) from t_staff where edu_back = %s or duty = %s or entry_time like %s or state=%s or section =%s; "
cur.execute(sql1,(name,name,"%name%",name,name))
rs = cur.fetchall()
print(rs)
return rs[0][0]
def selectAll2(staff_id):
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
# 2 创建操作数据库表的增删改查的对象 ,游标对象
cur = con.cursor();
sql ="select edu_back,section,duty,entry_time,state from t_staff where staff_id =%s"
cur.execute(sql, (staff_id))
con.commit()
rs1 = cur.fetchall()
print(rs1)
return rs1
def selectlAll(index,row,name):
dict1 = {"dict": ""}
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
# 2 创建操作数据库表的增删改查的对象 ,游标对象
cur = con.cursor();
list = []
if name =="":
sql1 = "SELECT t_application.applic_id,t_application.`name`,t_application.sex,t_application.birth,t_application.phone,t_application.email,t_recruit.state ,t_recruit.staff_id FROM t_application,t_recruit WHERE t_application.applic_id = t_recruit.applic_id limit %s,%s;"
cur.execute(sql1, (index,row))
con.commit()
rs1 = cur.fetchall()#不是工人,需要加空值
for x in rs1:
# 创建一个字典
if x[6]=="签约完成":
print(x[7])
rs2=selectAll2(x[7])
print(rs2[0])
print(rs2)
dc = {"id": x[0], "name": x[1], "sex": x[2], "birth": x[3], "phone": x[4], "email": x[5], "state": x[6],
"staff_id": x[7], "edu_back": rs2[0][0], "section": rs2[0][1], "duty": rs2[0][2], "entry_time": rs2[0][3], "staTe": rs2[0][4]}
list.append(dc)
else:
print("-----")
dc = {"id": x[0], "name": x[1], "sex": x[2], "birth": x[3], "phone": x[4], "email": x[5], "state": x[6],
"staff_id": "", "edu_back": "", "section": "", "duty": "", "entry_time": "", "staTe": ""}
list.append(dc)
print(list)
return list
else:
rs = PanDuanSelect(name,index,row)
for x in rs:
sql0 = "SELECT t_application.applic_id,t_application.`name`,t_application.sex,t_application.birth,t_application.phone,t_application.email,t_recruit.state ,t_recruit.staff_id FROM t_application,t_recruit WHERE t_application.applic_id = t_recruit.applic_id and t_recruit.staff_id = %s;"
cur.execute(sql0, (x[0]))
con.commit()
rs3 = cur.fetchall()
dc = {"id": rs3[0][0], "name": rs3[0][1], "sex": rs3[0][2], "birth": rs3[0][3], "phone": rs3[0][4], "email": rs3[0][5], "state": rs3[0][6],
"staff_id": x[0], "edu_back": x[1], "section": x[2], "duty": x[3],
"entry_time": x[4], "staTe": x[5]}
list.append(dc)
return list
def PanDuanSelect(name,index,row):
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="1234",
database="hrms",
charset="utf8"
)
cur = con.cursor();
print("name=",name)
sql = "select staff_id,edu_back,section,duty,entry_time,state from t_staff where edu_back = %s or duty = %s or entry_time like %s or state=%s or section =%s limit %s,%s;"
cur.execute(sql, (name,name,"%name%",name,name,index,row))
con.commit()
rs1 = cur.fetchall()
print(rs1)
return rs1
def PanDuanId(staff_id,applic_id):
con = pymysql.connect(
host="localhost",
port=3306,
user="root",
passwd="
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
【资源说明】 课程设计 基于Python+Django的人力资源管理系统+数据库的设计与实现+详细文档+全部资料(高分项目).zip课程设计 基于Python+Django的人力资源管理系统+数据库的设计与实现+详细文档+全部资料(高分项目).zip 【备注】 1、该项目是个人高分课程设计项目源码,已获导师指导认可通过,答辩评审分达到95分 2、该资源内项目代码都经过mac/window10/11测试运行成功,功能ok的情况下才上传的,请放心下载使用! 3、本项目适合计算机相关专业(如软件工程、计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也可作为课程设计、作业、项目初期立项演示等,当然也适合小白学习进阶。 4、如果基础还行,可以在此代码基础上进行修改,以实现其他功能,也可直接用于课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/HTML.png)
共 218 条
- 1
- 2
- 3
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
- weixin_523111592024-06-11资源是宝藏资源,实用也是真的实用,感谢大佬分享~
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
不走小道
- 粉丝: 3253
- 资源: 5112
![benefits](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-1.c8e153b4.png)
下载权益
![privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-2.ec46750a.png)
C知道特权
![article](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-3.fc5e5fb6.png)
VIP文章
![course-privilege](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-4.320a6894.png)
课程特权
![rights](https://csdnimg.cn/release/downloadcmsfe/public/img/vip-rights-icon.fe0226a8.png)
开通VIP
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
最新资源
- tinymce 多图片批量上传插件
- Virtualized Hadoop Performance with VMware vSphere 6 on Servers
- 基于java开发的驾校学员信息管理系统
- 电气类117、变电站真实巡检电力设备检测数据集(7500多张+15类+YOLO格式txt标签)-第二部分
- 智能图像处理应用案例介绍:开发基于Java的智能图像处理应用,包括图像识别、图像增强等功能
- HTML 和 JavaScript 创建一个端午节的祝福页面.docx
- 电气类、117.变电站真实巡检电力设备检测数据集(7500多张+15类+YOLO格式txt标签)-第一部分
- IMG_20180720_124347_01.jpg
- IMG20240621095811.jpg
- jQuery 库.docx
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)