27 lines
887 B
Python
27 lines
887 B
Python
from motor.motor_asyncio import AsyncIOMotorDatabase
|
|
import schemas
|
|
from crud.base import CRUDBase
|
|
|
|
__all__ = 'talentpool_filtrate',
|
|
|
|
|
|
class Talentpool_filtrate(CRUDBase):
|
|
# 获取所有数据
|
|
async def all_filtrate(self, db: AsyncIOMotorDatabase):
|
|
return await self.find_many(db, {})
|
|
|
|
# 获取对应条件数据
|
|
async def where_filtrate(self, db: AsyncIOMotorDatabase, where: list):
|
|
return await self.find_many(db, {'user_id': {'$in': where}},{'_id':0})
|
|
|
|
# 修改数据
|
|
async def update_filtrate(self, db: AsyncIOMotorDatabase, user_id: str, up: dict):
|
|
await self.update_one(db, {'user_id': user_id}, {'$set':up})
|
|
|
|
# 插入数据
|
|
async def ins_filtrate(self, db: AsyncIOMotorDatabase, data_in: schemas.Filtrate):
|
|
await self.insert_one(db, data_in.dict())
|
|
|
|
|
|
talentpool_filtrate = Talentpool_filtrate('talentpool_filtrate')
|