实现获取门禁识别记录接口
This commit is contained in:
parent
83952560c2
commit
4fd4b4ad3c
@ -20,11 +20,12 @@ identify_recordController = APIRouter(prefix='/system/identify_record', dependen
|
||||
|
||||
|
||||
@identify_recordController.get(
|
||||
'/list', response_model=PageResponseModel, dependencies=[Depends(CheckUserInterfaceAuth('system:identify_record:list'))]
|
||||
'/list', response_model=PageResponseModel
|
||||
# , dependencies=[Depends(CheckUserInterfaceAuth('system:identify_record:list'))]
|
||||
)
|
||||
async def get_system_identify_record_list(
|
||||
request: Request,
|
||||
identify_record_page_query: Identify_recordPageQueryModel = Depends(Identify_recordPageQueryModel.as_query),
|
||||
identify_record_page_query: Identify_recordPageQueryModel = Depends(Identify_recordPageQueryModel.as_query) ,
|
||||
query_db: AsyncSession = Depends(get_db),
|
||||
):
|
||||
# 获取分页数据
|
||||
@ -50,21 +51,21 @@ async def add_system_identify_record(
|
||||
return ResponseUtil.success(msg=add_identify_record_result.message)
|
||||
|
||||
|
||||
@identify_recordController.put('', dependencies=[Depends(CheckUserInterfaceAuth('system:identify_record:edit'))])
|
||||
@ValidateFields(validate_model='edit_identify_record')
|
||||
@Log(title='识别记录', business_type=BusinessType.UPDATE)
|
||||
async def edit_system_identify_record(
|
||||
request: Request,
|
||||
edit_identify_record: Identify_recordModel,
|
||||
query_db: AsyncSession = Depends(get_db),
|
||||
current_user: CurrentUserModel = Depends(LoginService.get_current_user),
|
||||
):
|
||||
edit_identify_record.update_by = current_user.user.user_name
|
||||
edit_identify_record.update_time = datetime.now()
|
||||
edit_identify_record_result = await Identify_recordService.edit_identify_record_services(query_db, edit_identify_record)
|
||||
logger.info(edit_identify_record_result.message)
|
||||
|
||||
return ResponseUtil.success(msg=edit_identify_record_result.message)
|
||||
# @identify_recordController.put('', dependencies=[Depends(CheckUserInterfaceAuth('system:identify_record:edit'))])
|
||||
# @ValidateFields(validate_model='edit_identify_record')
|
||||
# @Log(title='识别记录', business_type=BusinessType.UPDATE)
|
||||
# async def edit_system_identify_record(
|
||||
# request: Request,
|
||||
# edit_identify_record: Identify_recordModel,
|
||||
# query_db: AsyncSession = Depends(get_db),
|
||||
# current_user: CurrentUserModel = Depends(LoginService.get_current_user),
|
||||
# ):
|
||||
# edit_identify_record.update_by = current_user.user.user_name
|
||||
# edit_identify_record.update_time = datetime.now()
|
||||
# edit_identify_record_result = await Identify_recordService.edit_identify_record_services(query_db, edit_identify_record)
|
||||
# logger.info(edit_identify_record_result.message)
|
||||
#
|
||||
# return ResponseUtil.success(msg=edit_identify_record_result.message)
|
||||
|
||||
|
||||
# @identify_recordController.delete('/{record_ids}', dependencies=[Depends(CheckUserInterfaceAuth('system:identify_record:remove'))])
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
from sqlalchemy import delete, select, update
|
||||
from sqlalchemy import delete, select, update, or_, desc
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
from module_admin.entity.do.identify_record_do import IdentifyRecord
|
||||
from module_admin.entity.vo.identify_record_vo import Identify_recordModel, Identify_recordPageQueryModel
|
||||
from utils.page_util import PageUtil
|
||||
from datetime import datetime, time
|
||||
|
||||
|
||||
class Identify_recordDao:
|
||||
@ -69,14 +70,32 @@ class Identify_recordDao:
|
||||
query = (
|
||||
select(IdentifyRecord)
|
||||
.where(
|
||||
IdentifyRecord.create_time.like(f'%{query_object.create_time}%') if query_object.create_time else True,
|
||||
IdentifyRecord.name == query_object.name if query_object.name else True,
|
||||
IdentifyRecord.position == query_object.position if query_object.position else True,
|
||||
IdentifyRecord.result == query_object.result if query_object.result else True,
|
||||
IdentifyRecord.create_time.between(
|
||||
datetime.combine(datetime.strptime(query_object.create_time, '%Y-%m-%d'), time(00, 00, 00)),
|
||||
datetime.combine(datetime.strptime(query_object.create_time, '%Y-%m-%d'), time(23, 59, 59)),
|
||||
)
|
||||
if query_object.create_time else True,
|
||||
# IdentifyRecord.name == query_object.name if query_object.name else True,
|
||||
# IdentifyRecord.position == query_object.position if query_object.position else True,
|
||||
# IdentifyRecord.result == query_object.result if query_object.result else True,
|
||||
IdentifyRecord.source == query_object.source if query_object.source else True,
|
||||
IdentifyRecord.robot_id == query_object.robot_id if query_object.robot_id else True,
|
||||
# IdentifyRecord.robot_id == query_object.robot_id if query_object.robot_id else True,
|
||||
)
|
||||
.order_by(IdentifyRecord.record_id)
|
||||
.where(
|
||||
or_(
|
||||
IdentifyRecord.name.like(f'%{query_object.keywords}%')
|
||||
if query_object.keywords
|
||||
else True,
|
||||
IdentifyRecord.position.like(f'%{query_object.keywords}%')
|
||||
if query_object.keywords
|
||||
else True,
|
||||
IdentifyRecord.source.like(f'%{query_object.keywords}%')
|
||||
if query_object.keywords
|
||||
else True,
|
||||
IdentifyRecord.result.like(f'%{query_object.keywords}%')
|
||||
)
|
||||
)
|
||||
.order_by(desc(IdentifyRecord.create_time))
|
||||
.distinct()
|
||||
)
|
||||
identify_record_list = await PageUtil.paginate(db, query, query_object.page_num, query_object.page_size, is_page)
|
||||
|
||||
@ -23,11 +23,19 @@ class Identify_recordModel(BaseModel):
|
||||
image: Optional[str] = Field(default=None, description='识别图片路径')
|
||||
|
||||
|
||||
class IdentifyRecordModelSearchModel(BaseModel):
|
||||
"""
|
||||
识别记录表查询模型
|
||||
"""
|
||||
model_config = ConfigDict(alias_generator=to_camel, from_attributes=True)
|
||||
create_time: Optional[str] = Field(default=None, description='识别时间')
|
||||
source: Optional[str] = Field(default=None, description='识别来源')
|
||||
keywords : Optional[str] = Field(default=None, description='识别关键词')
|
||||
|
||||
|
||||
|
||||
|
||||
class Identify_recordQueryModel(Identify_recordModel):
|
||||
class Identify_recordQueryModel(IdentifyRecordModelSearchModel):
|
||||
"""
|
||||
识别记录不分页查询模型
|
||||
"""
|
||||
|
||||
@ -31,6 +31,7 @@ from module_admin.controller.robot_role_pairing_controller import pairingControl
|
||||
from module_admin.controller.explanation_content_controller import explanationContentController
|
||||
from module_admin.controller.explanation_style_robot_pair_controller import explanation_style_robot_pairController
|
||||
from module_admin.controller.sys_statistics_controller import sys_statisticsController
|
||||
from module_admin.controller.identify_record_controller import identify_recordController
|
||||
|
||||
from sub_applications.handle import handle_sub_applications
|
||||
from utils.common_util import worship
|
||||
@ -96,6 +97,7 @@ controller_list = [
|
||||
{'router': explanationContentController, 'tags': ['讲解管理']},
|
||||
{'router': explanation_style_robot_pairController, 'tags': ['讲解风格管理']},
|
||||
{'router': sys_statisticsController, 'tags': ['系统统计数据管理']},
|
||||
{'router': identify_recordController, 'tags': ['识别记录管理']},
|
||||
|
||||
]
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user