#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Date:2022/07/13 09:44:57 ''' from sqlalchemy import or_, asc from Business.Repository import Repository from DataEntity.ClientModels import EntityClient # 用户操作业务逻辑类 class BllClient(Repository): # _instance_lock = threading.Lock() # #实现单例模式 # def __new__(cls, *args, **kwargs): # if not hasattr(BllClient, "_instance"): # with BllClient._instance_lock: # if not hasattr(BllClient, "_instance"): # BllClient._instance = object.__new__(cls) # return BllClient._instance def __init__(self, entityType=EntityClient): return super().__init__(entityType) # 模糊查询根据客户端编号和客户端名字 def like_ClientId_or_Name(self, searchValue): return self.findList(or_(EntityClient.client_code.like('%' + searchValue + '%'), EntityClient.client_name.like('%' + searchValue + '%'))).all() def getAllClientList(self): return self.findList().order_by(asc(EntityClient.client_code)).all()