添加新的接口, 获取识别总的统计数据接口
This commit is contained in:
parent
c080f730bb
commit
3ee34e8a5b
@ -31,6 +31,21 @@ async def get_today_identification_statistics(request: Request, query_db: AsyncS
|
|||||||
identification_statistics = await Identification_statisticsService.get_today_identification_statistics_services(query_db)
|
identification_statistics = await Identification_statisticsService.get_today_identification_statistics_services(query_db)
|
||||||
return ResponseUtil.success(data = identification_statistics)
|
return ResponseUtil.success(data = identification_statistics)
|
||||||
|
|
||||||
|
# 获取总的识别统计数据
|
||||||
|
@identification_statisticsController.get('/total')
|
||||||
|
async def get_total_identification_statistics(request: Request, query_db: AsyncSession = Depends(get_db)):
|
||||||
|
"""
|
||||||
|
获取今天的识别统计数据
|
||||||
|
:param request:
|
||||||
|
:param query_db:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
logger.info('获取今天的识别统计数据')
|
||||||
|
identification_statistics = await Identification_statisticsService.get_total_identification_statistics_services(query_db)
|
||||||
|
return ResponseUtil.success(data = identification_statistics)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# @identification_statisticsController.get(
|
# @identification_statisticsController.get(
|
||||||
# '/list', response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('system:identification_statistics:list'))]
|
# '/list', response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('system:identification_statistics:list'))]
|
||||||
|
|||||||
@ -21,6 +21,23 @@ class Identification_statisticsDao:
|
|||||||
result = await query_db.execute(stmt)
|
result = await query_db.execute(stmt)
|
||||||
return result.mappings().all()
|
return result.mappings().all()
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
async def get_total_identification_statistics(cls, query_db: AsyncSession):
|
||||||
|
"""
|
||||||
|
获取总的识别统计数据 - 返回各个字段的总和
|
||||||
|
|
||||||
|
:param query_db: orm对象
|
||||||
|
:return: 总和统计数据
|
||||||
|
"""
|
||||||
|
stmt = select(
|
||||||
|
func.sum(IdentificationStatistics.employ).label('employ'),
|
||||||
|
func.sum(IdentificationStatistics.visitor).label('visitor'),
|
||||||
|
func.sum(IdentificationStatistics.stranger).label('stranger')
|
||||||
|
)
|
||||||
|
|
||||||
|
result = await query_db.execute(stmt)
|
||||||
|
return result.mappings().first()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get_identification_statistics_detail_by_id(cls, db: AsyncSession, id: int):
|
async def get_identification_statistics_detail_by_id(cls, db: AsyncSession, id: int):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@ -24,6 +24,16 @@ class Identification_statisticsService:
|
|||||||
"""
|
"""
|
||||||
result = await Identification_statisticsDao.get_today_identification_statistics(query_db)
|
result = await Identification_statisticsDao.get_today_identification_statistics(query_db)
|
||||||
return result
|
return result
|
||||||
|
@classmethod
|
||||||
|
async def get_total_identification_statistics_services(cls, query_db: AsyncSession):
|
||||||
|
"""
|
||||||
|
获取总的识别统计数据 - 返回各个字段的总和
|
||||||
|
|
||||||
|
:param query_db: orm对象
|
||||||
|
:return: 总和统计数据
|
||||||
|
"""
|
||||||
|
result = await Identification_statisticsDao.get_total_identification_statistics(query_db)
|
||||||
|
return result
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
async def get_identification_statistics_list_services(
|
async def get_identification_statistics_list_services(
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user