diff --git a/apps/power/views.py b/apps/power/views.py index d5de2b0..e8829fe 100644 --- a/apps/power/views.py +++ b/apps/power/views.py @@ -6,7 +6,7 @@ import sys sys.path.append('.') -from sqlalchemy import or_ +from sqlalchemy import and_, or_ from db_logic.module import BllModule from db_logic.role import BllRole from Common.auth import token_auth @@ -51,7 +51,11 @@ def add_user_power_list(): "5": instrument_modulet if instrument_modulet else [], } # 删除除去柜子权限外的所有权限 - BllModuleRelation().delete(EntityModuleRelation.object_id == user_id, EntityModuleRelation.module_type != "1") + BllModuleRelation().delete( + and_(EntityModuleRelation.object_id == user_id, + EntityModuleRelation.module_type != "1", + EntityModuleRelation.object_type != "1") + ) inster_module_list = [] for k,v in inster_dic.items(): for i in v: