Skip to content

Commit

Permalink
优化获取上级接口
Browse files Browse the repository at this point in the history
  • Loading branch information
welliamcao committed Mar 28, 2021
1 parent 42c7d35 commit 8b194ec
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions dao/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,16 +205,17 @@ def modf_user_assets(self,request):
return "资产不存在"

def get_user_superior(self,user):
#获取直属上级以及部门上级
dataList, uidList = [], []
if user.superior and user.superior.id != user.id:
uidList.append(user.superior.id)
dataList.append(user.superior.to_json())

dataList.append(user.superior.to_json())
for ds in user.department.values():
manage_user = User.objects.get(id=ds.get("manage"))
if manage_user.id not in uidList and manage_user.id != user.id:
uidList.append(manage_user.id)
dataList.append(manage_user.to_json())
if ds.get("manage"):
manage_user = User.objects.get(id=ds.get("manage"))
if manage_user.id not in uidList and manage_user.id != user.id:
uidList.append(manage_user.id)
dataList.append(manage_user.to_json())
return dataList


Expand Down

0 comments on commit 8b194ec

Please sign in to comment.