From 27dcbcb18a22b8c526988812fccc842fb909594d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Tue, 18 Oct 2022 10:55:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BC=98=E5=8C=96=E8=81=8C=E4=BD=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/interview.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index e8ce57f..8e28c34 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -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) # 按创建职位的最新时间排序