1.优化职位管理
This commit is contained in:
parent
6dd3d121bf
commit
27dcbcb18a
@ -1213,26 +1213,22 @@ async def get_job(
|
||||
ress = await crud.jobs.all_fields(db, schemas.Jobs(state=True))
|
||||
nums = len(ress)
|
||||
job = []
|
||||
job_list=[i['job_id'] for i in res]
|
||||
sql1 = f"""
|
||||
select job_id,count(*) as nu from HR.resumes where job_id in {job_list} and interview_stage < 6 group by job_id
|
||||
"""
|
||||
#获取各个职位的候选人总数
|
||||
df = await ckdb.query_dataframe(sql1)
|
||||
job_dict=dict(zip(df['job_id'],df['nu']))
|
||||
for i in res:
|
||||
# 获取职位名称
|
||||
job_list = {}
|
||||
job_list['key'] = i['job_id'] # 职位id
|
||||
# 查询对应职位id入职多少人
|
||||
# sql = f"""
|
||||
# select count(*) as nu from HR.resumes where job_id = '{i['job_id']}' and interview_stage = 7
|
||||
# """
|
||||
# num = await ckdb.execute(sql)
|
||||
# 候选人总数
|
||||
sql1 = f"""
|
||||
select count(*) as nu from HR.resumes where job_id = '{i['job_id']}' and interview_stage < 6
|
||||
"""
|
||||
hou_num = await ckdb.execute(sql1)
|
||||
job_list['job_name'] = i['job_name'] # 职位名
|
||||
job_list['principal'] = i['principal'] # 招聘负责人
|
||||
job_list['job_sector'] = i['job_sector'] # 部门
|
||||
job_list['job_num'] = i['job_num'] # 目标招聘人数
|
||||
job_list['now_job_num'] = i['now_job_num'] # 对应职位的入职人数
|
||||
job_list['hou_num'] = hou_num[0]['nu'] # 候选人总数
|
||||
job_list['hou_num'] = job_dict.get(i['job_id'],0) # 候选人总数
|
||||
job_list['creat_time'] = i['creat_time'] # 创建职位的时间
|
||||
job.append(job_list)
|
||||
# 按创建职位的最新时间排序
|
||||
|
Loading…
Reference in New Issue
Block a user