You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
#!/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))
|