#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Date:2022/07/13 08:39:51 ''' from Business.Repository import Repository from DataEntity.UserModels import EntityUser from sqlalchemy import and_ # 用户操作业务逻辑 class BllUser(Repository): # _instance_lock = threading.Lock() # #实现单例模式 # def __new__(cls, *args, **kwargs): # if not hasattr(BllUser, "_instance"): # with BllUser._instance_lock: # if not hasattr(BllUser, "_instance"): # BllUser._instance = object.__new__(cls) # return BllUser._instance def __init__(self, entityType=EntityUser): return super().__init__(entityType) # 用户账号密码登录 def login(self, userAccount, userPwd): print(userAccount, userPwd, "++++++++++++++++++++++++++++++++++++++++++++++++++") print(self.findEntity(and_(EntityUser.account == userAccount, EntityUser.password == userPwd))) return self.findEntity(and_(EntityUser.account == userAccount, EntityUser.password == userPwd))