Skip to content

Commit 0337ed6

Browse files
committed
perf: 优化编辑部门时获取部门树数据方式
1 parent c2ce55c commit 0337ed6

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

dash-fastapi-backend/module_admin/dao/dept_dao.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,8 @@ def get_dept_info_for_edit_option(cls, db: Session, dept_info: DeptModel, data_s
8888
eval(data_scope_sql)) \
8989
.order_by(SysDept.order_num) \
9090
.distinct().all()
91-
dept = cls.get_dept_by_id(db, dept_info.dept_id)
92-
parent = cls.get_dept_by_id(db, dept.parent_id)
93-
if parent:
94-
dept_result.insert(-1, parent)
9591

96-
return list_format_datetime(sorted(set(dept_result), key=dept_result.index))
92+
return list_format_datetime(dept_result)
9793

9894
@classmethod
9995
def get_children_dept(cls, db: Session, dept_id: int):

0 commit comments

Comments
 (0)