报表分组

This commit is contained in:
Àî×ÚÕñ 2022-08-30 10:22:34 +08:00
parent 373b214cff
commit 6460a905a7
2 changed files with 3 additions and 10 deletions

View File

@ -899,19 +899,12 @@ async def find_mode_tables(
) -> schemas.Msg: ) -> schemas.Msg:
"""获取一条hr分组包含的报表""" """获取一条hr分组包含的报表"""
mode_data = await crud.api_interview_modes.get_one_mode(db, data_in.mode_id) mode_data = await crud.api_interview_modes.get_one_mode(db, data_in.mode_id)
new_tables = [] table_data = []
if mode_data: if mode_data:
tables = mode_data['mode_list'] tables = mode_data['mode_list']
if tables: if tables:
table_data = await crud.api_interview_tables.get_tables(db, {'table_id': {'$in': tables}}) table_data = await crud.api_interview_tables.get_tables(db, {'table_id': {'$in': tables}})
for table in table_data: return schemas.Msg(code=200, msg='ok', data=table_data)
new_table = {
'table_id': table['table_id'],
'title': table['title'],
'url': table['url']
}
new_tables.append(new_table)
return schemas.Msg(code=200, msg='ok', data=new_tables)
@router.post("/update_mode") @router.post("/update_mode")

View File

@ -26,7 +26,7 @@ class ApiInterviewTables(CRUDBase):
# 查询报表信息 # 查询报表信息
async def get_tables(self, db: AsyncIOMotorDatabase, where): async def get_tables(self, db: AsyncIOMotorDatabase, where):
return await self.find_many(db, where) return await self.find_many(db, where, {'_id': 0})
api_interview_tables = ApiInterviewTables('interview_tables') api_interview_tables = ApiInterviewTables('interview_tables')