1.新增获取对应部门及职位

This commit is contained in:
李伟 2022-08-08 13:43:10 +08:00
parent 1dd241eb23
commit b0e65dc77d
6 changed files with 89 additions and 10 deletions

View File

@ -317,31 +317,31 @@ async def get_job(
# 获取对应条件的职位
res = await crud.jobs.all_fields(db, data_in)
# 获取职位数量
num = len(res)
nums = len(res)
job = []
for i in res:
# 获取职位名称
job_list = {}
job_list['job_id'] = i['job_id'] # 职位id
job_list['key'] = i['job_id'] # 职位id
# 查询对应职位id入职多少人
sql = f"""
select count(job_id) from HR.resumes where job_id = '{i['job_id']}' and interview_stage = 7
select count(job_id) as nu from HR.resumes where job_id = '{i['job_id']}' and interview_stage = 7
"""
num = await ckdb.execute(sql)
# 候选人总数
sql1 = f"""
select count(job_id) from HR.resumes where job_id = '{i['job_id']}' and interview_stage < 6
select count(job_id) as nu from HR.resumes where job_id = '{i['job_id']}' and interview_stage < 6
"""
hou_num = await ckdb.execute(sql1)
num = await ckdb.execute(sql)
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'] = num # 对应职位的入职人数
job_list['hou_num'] = hou_num # 候选人总数
job_list['now_job_num'] = num[0]['nu'] # 对应职位的入职人数
job_list['hou_num'] = hou_num[0]['nu'] # 候选人总数
job.append(job_list)
data = {
'num': num,
'num': nums,
'job': job
}
return schemas.Msg(code=200, msg='ok', data=data)
@ -476,7 +476,7 @@ async def get_str_mail(
@router.post("/send_str_mail")
async def send_str_mail(
async def send_mail(
request: Request,
data_in: schemas.send_str_mail,
db: AsyncIOMotorDatabase = Depends(get_database)
@ -982,3 +982,15 @@ async def owner_edit(
"""新增,删除基本信息"""
await crud.basic_data.update(db, data_in)
return schemas.Msg(code=200, msg='ok', data='')
@router.get("/get_section")
async def get_section(
request: Request,
db: AsyncIOMotorDatabase = Depends(get_database),
# current_user: schemas.UserDB = Depends(deps.get_current_user)
) -> schemas.Msg:
"""获取对应部门及职位"""
res=await crud.section.get_all(db)
return schemas.Msg(code=200, msg='ok', data=res)

View File

@ -31,3 +31,4 @@ from .crud_worker_info import worker_info
from .crud_owner_info import owner_info
from .crud_count_in_worker import count_in_worker
from .crud_basic_data import basic_data
from .crud_section import section

43
crud/crud_section.py Normal file
View File

@ -0,0 +1,43 @@
from motor.motor_asyncio import AsyncIOMotorDatabase
import schemas
from crud.base import CRUDBase
__all__ = 'section',
class Section(CRUDBase):
# 获取所有部门及职位
async def get_all(self, db: AsyncIOMotorDatabase):
return await self.find_many(db,{},{'_id':0})
# # 获取对应级别权限的所有路由和路由状体
# async def get_url(self, db: AsyncIOMotorDatabase, data_in: schemas.Url_list):
# return await self.find_many(db, {'name': data_in.name})
#
# # 插入单条对应级别权限的路由和状态
# async def insert_url(self, db: AsyncIOMotorDatabase, data_in: schemas.Url_list):
# return await self.insert_one(db, data_in.dict())
#
# async def insert_urls(self, db: AsyncIOMotorDatabase, data_in: schemas.Url_lists):
# return await self.insert_one(db, data_in.dict())
#
# # 更新单条对应级别权限的路由和状态
# async def update_url_url(self, db: AsyncIOMotorDatabase, res):
# return await self.update_one(db, {'_id': res['_id']}, {
# '$set': {'state': res['state']}})
#
# async def find_one_url(self, db: AsyncIOMotorDatabase, data_in: schemas.Datalist):
# return await self.find_one(db, {'auth_id': data_in.role_id, 'path_name': data_in.path_name})
#
# # 修改权限用户名字
# async def edit_name(self, db: AsyncIOMotorDatabase, data_in: schemas.Editname):
# where = {'auth_id': data_in.role_id}
# up_data = {'$set': {'name': data_in.name}}
#
# return await self.update_many(db, where, up_data)
#
# # 删除一个权限用户
# async def delete_name(self, db: AsyncIOMotorDatabase, data_in: schemas.Del_roles):
# return await self.delete(db, {'auth_id': data_in.role_id})
section = Section('section')

View File

@ -303,3 +303,7 @@ api:/api/v1/itr/owner_edit
date: List[str] # 各种基本资料
name: str # 基本资料的名称 现有渠道owner_name工作经验job_exp
职能类别function_type职位级别job_rank学历要求education部门sector
#获取对应部门及职位
api:/api/v1/itr/owner_list
请求方式get

View File

@ -37,3 +37,4 @@ from .worker import *
from .owner_info import *
from .count_in_worker import *
from .basic_data import *
from .section import *

18
schemas/section.py Normal file
View File

@ -0,0 +1,18 @@
from typing import Any, List, Union
from pydantic import BaseModel, Field
from schemas import DBBase
from typing import Optional
class Url_module(BaseModel):
auth_id: str = None
path_name: str = None
api_list: List[str] = None
api_name: List[str] = None
state: List[bool] = None
class Add_module(BaseModel):
auth_id: str
url:str