1.新增职位

This commit is contained in:
李伟 2022-07-11 17:53:16 +08:00
parent c8a0517aa3
commit f0ebc4af3c
5 changed files with 140 additions and 3 deletions

View File

@ -92,3 +92,14 @@ async def interview_insert(
insert_data = res['insert_data'] insert_data = res['insert_data']
data = await db.execute_dict(sql, insert_data) data = await db.execute_dict(sql, insert_data)
return schemas.Msg(code=200, msg='ok', data=data) return schemas.Msg(code=200, msg='ok', data=data)
@router.post("/add_job")
async def event_edit(
request: Request,
data_in: schemas.Ins_Job,
db: AsyncIOMotorDatabase = Depends(get_database),
current_user: schemas.UserDB = Depends(deps.get_current_user)
) -> schemas.Msg:
"""新增职位"""
await crud.jobs.insert_job(db, data_in)
return schemas.Msg(code=200, msg='ok', data='')

View File

@ -21,3 +21,4 @@ from .crud_url_list import url_list
from .crud_user_url import user_url from .crud_user_url import user_url
from .crud_api_module import api_module from .crud_api_module import api_module
from .crud_event_list import event_list from .crud_event_list import event_list
from .crud_jobs import jobs

40
crud/crud_jobs.py Normal file
View File

@ -0,0 +1,40 @@
from motor.motor_asyncio import AsyncIOMotorDatabase
import schemas
from crud.base import CRUDBase
__all__ = 'jobs',
class CRUDJobs(CRUDBase):
# 获取所有对应职位字段的数据
async def all_field(self, db: AsyncIOMotorDatabase):
return await self.find_many(db, {})
# 获取所有对应条件职位字段的数据
async def all_fields(self, db: AsyncIOMotorDatabase, data_in: schemas.Jobs):
if data_in == None:
return await self.find_many(db, {}, {'_id': 0})
else:
where = {}
data_dict = data_in.dict()
for k, v in data_dict.items():
if v != None:
where[k] = v
return await self.find_many(db, where, {'_id': 0})
# 修改职位的数据
async def update_job(self, db: AsyncIOMotorDatabase, data_in: schemas.Jobs):
update = {}
data_dict = data_in.dict()
for k, v in data_dict.items():
if v != None and k != 'job_id':
update[k] = v
await self.update_one(db, {'job_id': int(data_in.job_id)}, {'$set': update})
# 插入一条新的职位数据
async def insert_job(self, db: AsyncIOMotorDatabase, data_in: schemas.Ins_Job):
await self.insert_one(db, data_in.dict())
jobs = CRUDJobs('jobs')

View File

@ -27,3 +27,4 @@ from .api_module import *
from .event_list import * from .event_list import *
from .interview import * from .interview import *
from .interview_plan import * from .interview_plan import *
from .jobs import *

84
schemas/jobs.py Normal file
View File

@ -0,0 +1,84 @@
import time
from datetime import datetime
from pydantic import BaseModel
class Job(BaseModel):
job_id: str = None # 职位的唯一id
job_name: str # 职位名称
job_sector: str # 职位部门
job_nature: str # 职位性质
job_priority: str # 职位优先级
owner_name: str # 渠道
principal: str # 负责人
patronn: str # 协助人
start_time: datetime = datetime.now() # 开始招聘时间
end_time: datetime = None # 结束招聘时间
function_type: str # 职能类型
filtering_rules: bool # 是否使用筛选规则
hiring_needs: bool # 是否关联招聘需求
auto_repeater: bool # 是否自动转发
cacsi_count: int = None # 面试满意度反馈次数
state: bool = None # 职位招聘状态
job_num: int = None # 招聘人数
education: str # 学历要求
job_rank: str # 职位级别
work_exp: str # 工作经验
report_obj: str # 汇报对象
min_money: int # 薪资范围min
max_money: int # 薪资范围max
requirement: str # 需求描述
class Jobs(BaseModel):
job_id: str = None # 职位的唯一id
job_name: str = None # 职位名称
job_sector: str = None # 职位部门
job_nature: str = None # 职位性质
job_priority: str = None # 职位优先级
owner_name: str = None # 渠道
principal: str = None # 负责人
patronn: str = None # 协助人
start_time: datetime = None # 开始招聘时间
end_time: datetime = None # 结束招聘时间
function_type: str = None # 职能类型
filtering_rules: bool = None # 是否使用筛选规则
hiring_needs: bool = None # 是否关联招聘需求
auto_repeater: bool = None # 是否自动转发
cacsi_count: int = None # 面试满意度反馈次数
state: bool = None # 职位招聘状态
job_num: int = None # 招聘人数
education: str = None # 学历要求
job_rank: str = None # 职位级别
work_exp: str = None # 工作经验
report_obj: str = None # 汇报对象
min_money: int = None # 薪资范围min
max_money: int = None # 薪资范围max
requirement: str = None # 需求描述
class Ins_Job(BaseModel):
job_id: str = int(time.time()) # 职位的唯一id
job_name: str # 职位名称
job_sector: str # 职位部门
job_nature: str # 职位性质
job_priority: str # 职位优先级
owner_name: str # 渠道
principal: str # 负责人
patronn: str # 协助人
start_time: datetime = datetime.now() # 开始招聘时间
function_type: str # 职能类型
filtering_rules: bool # 是否使用筛选规则
hiring_needs: bool # 是否关联招聘需求
auto_repeater: bool # 是否自动转发
cacsi_count: int = 0 # 面试满意度反馈次数
state: bool = True # 职位招聘状态
job_num: int # 招聘人数
education: str # 学历要求
job_rank: str # 职位级别
work_exp: str # 工作经验
report_obj: str # 汇报对象
min_money: int # 薪资范围min
max_money: int # 薪资范围max
requirement: str # 需求描述