diff --git a/db_logic/module_relation.py b/db_logic/module_relation.py index 800f34e..a968306 100644 --- a/db_logic/module_relation.py +++ b/db_logic/module_relation.py @@ -64,10 +64,10 @@ class BllModuleRelation(Repository): def get_role_module_list(self, role_id): sql_all = f""" - SELECT a.module_id, b.module_code, b.sort_index, b.module_name - from rms_module_relation as a - LEFT JOIN rms_module as b on a.module_id=b.module_id - WHERE object_id='{role_id}' AND object_type=1 + select a.module_id, a.module_code, a.sort_index, a.module_name, a.module_type, + CASE WHEN b.object_id is NULL THEN 0 ELSE 1 END have from rms_module as a LEFT JOIN ( + select * from rms_module_relation WHERE object_id='{role_id}' and object_type=1 + ) b on a.module_id=b.module_id """ return self.execute(sql_all).fetchall()