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.
22 lines
636 B
22 lines
636 B
|
|
from dao.MysqlConfig import MysqlConfig
|
|
|
|
|
|
class UserDao:
|
|
|
|
@staticmethod # 增删改的方法
|
|
def update_user(sql, *params):
|
|
try:
|
|
MysqlConfig.cursor.execute(sql, params)
|
|
except Exception as ex:
|
|
print("出现异常:%s" % ex)
|
|
MysqlConfig.db.rollback()
|
|
|
|
@staticmethod # 查询用户的方法
|
|
def query_user(user_name):
|
|
sql = "SELECT * FROM t_user WHERE user_name = %s" % repr(user_name)
|
|
MysqlConfig.cursor.execute(sql) # 执行语句
|
|
MysqlConfig.db.commit() # 提交
|
|
return MysqlConfig.cursor.fetchone() # 返回查询到的结果
|
|
|