1 # coding:utf-8 2 ''' 3 @file: run_old.py 4 @author: jingsheng hong 5 @ide: PyCharm 6 @createTime: 2019年08月20日 17點16分 7 @contactInformation: [email protected] 8 ''' 9 10 import sys 11 12 from tableData.m_tp_account import M_tp_account 13 from tableData.m_tp_store import M_tp_store 14 15 class Run: 16 17 '''驗證銷售部門的數據查看權限''' 18 19 def __init__(self,account_id:int): 20 ''' 21 :param account_id 登錄後臺的賬號id/賬號表單個主鍵id (模擬業務流程,從後臺登錄頁面登錄成功後,會傳給該後臺服務器接口一個登錄賬號id) 22 ''' 23 self.account_id = account_id 24 self.account_information() 25 self.store_information() 26 27 def account_information(self): 28 '''獲取:賬號A的單條賬號表數據''' 29 # 校驗account_id是否存在且是否有效 30 account_information = M_tp_account().mysql_account_information(self.account_id) 31 # 關聯的員工id 32 self.staff_id = account_information["staff_id"] 33 # 可查看數據範圍 34 self.viewable_data_range = account_information["viewable_data_range"] 35 # 數據權限類型 36 self.data_permission_type = account_information["data_permission_type"] 37 # 五種數據權限類型對應的可查看的部門清單 38 self.department_of_viewable = account_information["department_of_viewable"] 39 40 def store_information(self): 41 '''返回:符合數據查看權限規則的銷售部門數據''' 42 store_information = M_tp_store().mysql_store_information(self.account_id,self.staff_id,self.viewable_data_range,self.data_permission_type,self.department_of_viewable) 43 return store_information 44 45 46 47 if __name__ == "__main__": 48 # 填寫登錄賬號id即可 49 Run(sys.argv[1])
昨晚完成的培訓資料,記錄一下~