标签:没有 管理 模糊 hone 登录失败 主键自增 账号 时间 选择
人事管理系统介绍:
1.展示页面:
①首页:
==========欢迎来到简历管理系统v2.1.1==========
1.管理员登录
2.专员登录
3.退出
②管理员操作页面
==========欢迎来到简历管理系统v2.1.1==========
1.查看专员信息
2.添加专员
3.退出
③专员操作页面
==========欢迎来到简历管理系统v2.1.1==========
1.查看简历
2.添加简历
3.退出
2.功能介绍:
①。管理员可以查看数据库中所有专员信息:ID 名字
可以根据名字查看属于该名字操作的简历的简历信息
②。管理员可以添加专员账户
③。专员可以新建简历
④。专员查看自己操作的简历
数据库介绍:
用户表user_t:
id_ 主键自增长
user_reg 账号
user_pwd 密码
user_name 姓名
user_parent 父节点,所属上级,关联用户id
user_roleId 角色id,关联角色表
角色表role_t:
id_ 主键自增长
role_name 角色名
简历表resum_t:
id_ 主键自增长
resume_user_name 姓名
resume_user_sex 性别
resume_user_phone 电话
resume_user_email 邮箱
resume_user_skill 专业
resume_user_graduationTime 毕业时间
resume_user_graduationSchool 毕业学校
resume_user_interviewTime 面试时间
resume_user_remarks 备注
resume_operation_userId 操作人关联user表的id
resume_operationTime 操作时间
#coding = utf-8 import pymysql import time #展示页面 def printinfo(info1,info2): print(‘‘‘==========欢迎来到管理系统v2.1.1========== 1.%s 2.%s 3.退出 ‘‘‘% (info1, info2)) a = input("请以数字形式输入您的操作:") return a #链接数据库 def connectsql(): conn = pymysql.connect( host = ‘192.168.1.110‘, port = 3306, user = ‘root‘, passwd = ‘root‘, db = ‘recruitdb‘, charset =‘utf8‘ ) cor = conn.cursor() #返回游标 return conn, cor #登录操作 def login(a, acor, aconn): a1 = int(a) lcor = acor lconn = aconn req = input(‘请输入账号:‘) passwd = input(‘请输入用户密码:‘) id = 0 user_reg = ‘‘ user_pwd = ‘‘ user_name = ‘‘ user_parent = 0 user_roleId = 0 #定义一个旗帜,判断是否登录成功 flag = False #查询管理员(专员)数据 a1 = 1为管理员 2 为专员 sql = lcor.execute(‘select * from user_t where user_roleId = %d‘% a1 ) info = lcor.fetchmany(sql) for f,g,h,j,k,l in info: if req == g and passwd == h : flag = True id = f user_reg = g user_pwd = h user_name = j user_parent = k user_roleId = l aconn.commit() return [flag, id, user_reg, user_pwd, user_name, user_parent, user_roleId] class People(object): def __init__(self,cor,aconn, id, name): self.cor = cor self.conn = aconn self.id = id self.name = name def add_resume(self): self.r_name = input(‘姓名:‘) self.r_sex = input(‘性别:‘) self.r_phone = input(‘联系方式:‘) self.r_email = input(‘邮箱:‘) self.r_skill = input(‘技能方向:‘) #毕业时间 self.time1 = input(‘毕业时间(yyyy-mm-dd):‘) self.timeStruct1 = time.strptime(self.time1, "%Y-%m-%d") self.timeStamp1 = int(time.mktime(self.timeStruct1)) self.r_graduationTime = time.strftime(‘%Y-%m-%d‘,time.localtime(self.timeStamp1)) self.r_graduationSchool = input(‘毕业院校:‘) #面试时间 self.time2 = input(‘面试时间(yyyy-mm-dd hh:mm:ss):‘) self.timeStruct2 = time.strptime(self.time2, "%Y-%m-%d %H:%M:%S") self.timeStamp2 = int(time.mktime(self.timeStruct2)) self.r_interviewTime = time.strftime(‘%Y-%m-%d %H:%M:%S‘,time.localtime(self.timeStamp2)) print(‘创建人:%s‘% self.name) print(‘操作人:%s‘% self.name) #操作时间,获取当前时间 self.r_operationTime = time.strftime(‘%Y-%m-%d %H:%M:%S‘,time.localtime(time.time())) self.cor.execute(‘insert into resume_t(resume_user_name,resume_user_sex, resume_user_phone,resume_user_email,resume_user_skill, resume_user_graduationTime,resume_user_graduationSchool, resume_user_interviewTime,resume_user_remarks,resume_operation_userId,resume_operationTime) values ("%s","%s","%s","%s","%s","%s","%s","%s","%s",%d,"%s")‘ %(self.r_name,self.r_sex,self.r_phone,self.r_email,self.r_skill,self.r_graduationTime, self.r_graduationSchool,self.r_interviewTime,self.name,self.id,self.r_operationTime)) self.conn.commit() #数据提交给数据库 self.conn.close() print(‘插入成功!‘) def search_resume(self): self.k = input("请选择1.电话,邮箱查询 2.模糊查询:") if self.k == ‘1‘: self.sel = input(‘请选择你需要进行查询的方式(1-电话号码,2-邮箱):‘) if self.sel == ‘1‘: self.sql = self.cor.execute(‘select resume_user_phone from resume_t‘) self.all_phone = self.cor.fetchmany(self.sql) self.l = [] for self.i in self.all_phone: self.l.append(self.i[0]) self.phone = input(‘请输入电话号码:‘) if self.phone in self.l: self.sql_phone = self.cor.execute(‘select * from resume_t where resume_user_phone = "%s"‘%self.phone) self.info = self.cor.fetchmany(self.sql_phone) for self.res in self.info: print(‘姓名:%s‘%self.res[1]) print(‘性别:%s‘%self.res[2]) print(‘联系方式:%s‘%self.res[3]) print(‘邮箱:%s‘%self.res[4]) print(‘技能方向:%s‘%self.res[5]) print(‘毕业时间:%s‘%self.res[6]) print(‘毕业院校:%s‘%(self.res[7])) print(‘面试时间:%s‘%(self.res[8])) print(‘创建人:%s‘%(self.res[9])) print(‘操作员:%s‘%(self.name)) print(‘操作时间:%s‘%(self.res[11])) else: print(‘没有该电话号码的简历‘) elif self.sel == ‘2‘: self.sql = self.cor.execute(‘select resume_user_phone from resume_t‘) self.all_email = self.cor.fetchmany(self.sql) self.l = [] for self.i in self.all_email: self.l.append(self.i[0]) self.email = input(‘请输入邮箱:‘) if self.email in self.l: self.sql_email = self.cor.execute(‘select * from resume_t where resume_user_email = "%s"‘%self.email) self.info = self.cor.fetchmany(self.sql_email) for self.res in self.info: print(‘姓名:%s‘%self.res[1]) print(‘性别:%s‘%self.res[2]) print(‘联系方式:%s‘%self.res[3]) print(‘邮箱:%s‘%self.res[4]) print(‘技能方向:%s‘%self.res[5]) print(‘毕业时间:%s‘%self.res[6]) print(‘毕业院校:%s‘%(self.res[7])) print(‘面试时间:%s‘%(self.res[8])) print(‘创建人:%s‘%(self.res[9])) print(‘操作员:%s‘%(self.name)) print(‘操作时间:%s‘%(self.res[11])) else: print(‘没有该邮箱的简历‘) if self.k == ‘2‘: choose = input(‘选择要进行模糊查询的字段(1-姓名,2-技能方向,3-毕业院校):‘) if choose == ‘1‘: self.key = input(‘输入姓名关键字:‘) self.arg = ‘%‘+self.key+‘%‘ self.sql = self.cor.execute(‘select * from resume_t where resume_user_name like "%s"‘%self.arg) self.info = self.cor.fetchmany(self.sql) if self.info is not None: for self.res in self.info: print(‘姓名:%s‘%self.res[1]) print(‘性别:%s‘%self.res[2]) print(‘联系方式:%s‘%self.res[3]) print(‘邮箱:%s‘%self.res[4]) print(‘技能方向:%s‘%self.res[5]) print(‘毕业时间:%s‘%self.res[6]) print(‘毕业院校:%s‘%self.res[7]) print(‘面试时间:%s‘%self.res[8]) print(‘创建人:%s‘%self.res[9]) print(‘操作员:%s‘%(self.name)) print(‘操作时间:%s‘%self.res[11]) else: print(‘没有该姓名的简历‘) elif choose == ‘2‘: self.key = input(‘输入技能方向关键字:‘) self.arg = ‘%‘+self.key+‘%‘ self.sql = self.cor.execute(‘select * from resume_t where resume_user_skill like "%s"‘%self.arg) self.info = self.cor.fetchmany(self.sql) if self.info is not None: for self.res in self.info: print(‘姓名:%s‘%self.res[1]) print(‘性别:%s‘%self.res[2]) print(‘联系方式:%s‘%self.res[3]) print(‘邮箱:%s‘%self.res[4]) print(‘技能方向:%s‘%self.res[5]) print(‘毕业时间:%s‘%self.res[6]) print(‘毕业院校:%s‘%self.res[7]) print(‘面试时间:%s‘%self.res[8]) print(‘创建人:%s‘%self.res[9]) print(‘操作员:%s‘%(self.name)) print(‘操作时间:%s‘%self.res[11]) else: print(‘没有该姓名的简历‘) elif choose == ‘3‘: self.key = input(‘输入毕业院校关键字:‘) self.arg = ‘%‘+self.key+‘%‘ self.sql = self.cor.execute(‘select * from resume_t where resume_user_graduationSchool like "%s"‘%self.arg) self.info = self.cor.fetchmany(self.sql) if self.info is not None: for self.res in self.info: print(‘姓名:%s‘%self.res[1]) print(‘性别:%s‘%self.res[2]) print(‘联系方式:%s‘%self.res[3]) print(‘邮箱:%s‘%self.res[4]) print(‘技能方向:%s‘%self.res[5]) print(‘毕业时间:%s‘%self.res[6]) print(‘毕业院校:%s‘%self.res[7]) print(‘面试时间:%s‘%self.res[8]) print(‘创建人:%s‘%self.res[9]) print(‘操作员:%s‘%(self.name)) print(‘操作时间:%s‘%self.res[11]) else: print(‘没有该毕业院校的简历‘) class Admin(object): def __init__(self, cor, aconn, id, name ): self.cor = cor self.conn = aconn self.id = id self.name = name def adduser(self): self.user_reg = input(‘请输入账号:‘) self.user_reg = input(‘请输入密码:‘) self.user_reg = input(‘请输入姓名:‘) self.cor.execute(‘insert into user_t(id_, user_reg, user_pwd, user_name, user_parent, user_roleId) values(NULL, "%s", "%s", "%s",NULL ,2)‘%(self.user_reg,self.user_reg,self.user_reg)) self.conn.commit() def search(self): sql = self.cor.execute(‘select id_, user_name from user_t where user_roleId = 2‘) info = self.cor.fetchmany(sql) for i in info: print(‘id:%d 名字:%s‘ % i) self.a = input(‘请输入想要查看员工所操作简历的员工名字:‘) self.sql = self.cor.execute(‘select * from resume_t where resume_user_remarks = "%s"‘% self.a) self.info = self.cor.fetchmany(sql) for self.i in self.info: print(‘ID: %d, 姓名:%s,性别:%s,联系方式:%s,邮箱:%s,技能方向:%s,毕业时间:%s,毕业院校:%s,面试时间:%s,创建人:%s,操作员:%d,操作时间:%s‘% self.i) def action(a, cor, conn): acor = cor aconn = conn if a == ‘1‘: #登录 infoList = login(a, acor, conn) if infoList[0]: b = printinfo(‘查看专员信息‘,‘添加专员‘) admin = Admin(acor,aconn, infoList[1],infoList[4]) if b == ‘1‘: admin.search() elif b == ‘2‘: admin.adduser() else: print(‘已成功退到登录页面!‘) else: print(‘登录失败!‘) if a == ‘2‘: #登录 infoList = login(a, acor,aconn) if infoList[0]: #登录后的展示页面 b = printinfo(‘查看简历‘,‘新建简历‘) user = People(acor,aconn, infoList[1],infoList[4]) if b == ‘1‘: user.search_resume() elif b == ‘2‘: user.add_resume() else: print(‘已成功退到登录页面!‘) else: print(‘登录失败!‘) while True: #链接数据库 conn,cor = connectsql() #页面展示 a = printinfo(‘管理员登录‘, ‘专员登录‘) #用户操作 action(a, cor, conn) if a == ‘3‘: break cor.close() conn.close()
标签:没有 管理 模糊 hone 登录失败 主键自增 账号 时间 选择
原文地址:https://www.cnblogs.com/mysterious-killer/p/10158374.html