#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Date:2022/07/13 11:31:27 ''' from sqlalchemy import and_, or_ from Business.Repository import Repository from DataEntity.LogInfoModels import EntityLog # 功能模块 class BllLog(Repository): # _instance_lock = threading.Lock() # #实现单例模式 # # def __new__(cls, *args, **kwargs): # if not hasattr(BllLog, "_instance"): # with BllLog._instance_lock: # if not hasattr(BllLog, "_instance"): # BllLog._instance = object.__new__(cls) # return BllLog._instance def __init__(self, entityType=EntityLog): return super().__init__(entityType) # 查询某个时间段的日志数据 def query_LogData_between_time(self, start_time, end_time): self.findList(and_(EntityLog.operate_date >= start_time, EntityLog.operate_date <= end_time)) # 获取模糊查询日志数据 def like_Log_data(self, searchValue): return self.findList(or_(EntityLog.operate_user_name.like('%' + searchValue + '%'), EntityLog.operate_type.like('%' + searchValue + '%')))