From 47994d7847cc40092f05b15a85ac2ff4b6e6af38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E4=BC=9F?= <250213850@qq.com> Date: Wed, 14 Sep 2022 15:40:55 +0800 Subject: [PATCH] =?UTF-8?q?1.=E8=81=8C=E4=BD=8D=E8=BF=94=E5=9B=9E=E5=B7=B2?= =?UTF-8?q?=E6=8B=9B=E8=81=98=E5=92=8C=E6=9C=AA=E6=8B=9B=E8=81=98=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/api_v1/endpoints/interview.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/api/api_v1/endpoints/interview.py b/api/api_v1/endpoints/interview.py index 4ad9115..ef27e8e 100644 --- a/api/api_v1/endpoints/interview.py +++ b/api/api_v1/endpoints/interview.py @@ -622,14 +622,15 @@ async def get_job( # 获取对应条件的职位 res = await crud.jobs.all_fields(db, data_in) # 获取职位数量 - if data_in.state == True: - nums = len(res) - ress=await crud.jobs.all_fields(db,schemas.Jobs(state=False)) - number=len(ress) - else: - number = len(res) - ress = await crud.jobs.all_fields(db, schemas.Jobs(state=True)) - nums = len(ress) + if data_in != None: + if data_in.state == True: + nums = len(res) + ress=await crud.jobs.all_fields(db,schemas.Jobs(state=False)) + number=len(ress) + else: + number = len(res) + ress = await crud.jobs.all_fields(db, schemas.Jobs(state=True)) + nums = len(ress) job = [] for i in res: # 获取职位名称 @@ -652,11 +653,14 @@ async def get_job( job_list['now_job_num'] = num[0]['nu'] # 对应职位的入职人数 job_list['hou_num'] = hou_num[0]['nu'] # 候选人总数 job.append(job_list) - data = { - 'start_num': nums, - 'end_num':number, - 'job': job - } + if data_in != None: + data = { + 'start_num': nums, + 'end_num':number, + 'job': job + } + else: + data={'job': job} return schemas.Msg(code=200, msg='ok', data=data)