|
@@ -2,9 +2,10 @@
|
|
|
from sqlalchemy import String, Column, Integer,DateTime,Text,BigInteger,Boolean,PrimaryKeyConstraint,Index,UniqueConstraint,CHAR,LargeBinary,TIMESTAMP
|
|
|
from sqlalchemy.dialects.mysql import TINYINT
|
|
|
from sqlalchemy.sql import func
|
|
|
+from sqlalchemy import event
|
|
|
from database import Base
|
|
|
from datetime import datetime
|
|
|
-
|
|
|
+from common.enc import mpfun
|
|
|
|
|
|
'''社会化关系表'''
|
|
|
class SysSocial(Base):
|
|
@@ -154,9 +155,38 @@ class SysUser(Base):
|
|
|
yzy_account = Column(String(50), default=None, comment='粤政易账号')
|
|
|
sign = Column(String, server_default='', default='', comment='HMACSM3数值')
|
|
|
|
|
|
+ @property
|
|
|
+ def plain_user_name(self):
|
|
|
+ return mpfun.dec_data(self.user_name)
|
|
|
+
|
|
|
+ @property
|
|
|
+ def plain_password(self):
|
|
|
+ return mpfun.dec_data(self.password)
|
|
|
+
|
|
|
+ @property
|
|
|
+ def plain_phonenumber(self):
|
|
|
+ return mpfun.dec_data(self.phonenumber)
|
|
|
+
|
|
|
+ @property
|
|
|
+ def plain_email(self):
|
|
|
+ return mpfun.dec_data(self.email)
|
|
|
+
|
|
|
+ @property
|
|
|
+ def plain_yzy_account(self):
|
|
|
+ return mpfun.dec_data(self.yzy_account)
|
|
|
class Config:
|
|
|
orm_mode = True
|
|
|
|
|
|
+'''
|
|
|
+@event.listens_for(SysUser, 'before_insert')
|
|
|
+@event.listens_for(SysUser, 'before_update')
|
|
|
+def calculate_sys_user_sign(mapper, connection, target):
|
|
|
+ """在保存前自动计算并更新sign字段"""
|
|
|
+ sign_data = ",".join([target.user_id, target.user_name, target.password, target.nick_name, target.dept_id, target.dept_name, target.email, target.phonenumber, target.status, target.del_flag, target.yzy_account])
|
|
|
+ sign_hmac = mpfun.sign_data(sign_data)
|
|
|
+ target.sign = sign_hmac
|
|
|
+'''
|
|
|
+
|
|
|
'''岗位信息表'''
|
|
|
|
|
|
|