diff --git a/apps/client/views.py b/apps/client/views.py index 7157410..d97bfde 100644 --- a/apps/client/views.py +++ b/apps/client/views.py @@ -216,9 +216,15 @@ def set_client_drawer_power(): for i in obj_list: user_drawer = set_drawer_info.get(i.user_id) if str(user_drawer) == "0": - cell_user_obj.session.delete(i) + cell_user_obj.delete( + and_( + EntityClientCellUser.client_id==i.client_id, + EntityClientCellUser.client_cell_id==drawer_id, + EntityClientCellUser.user_id==i.user_id + ) + ) set_drawer_info.pop(i.user_id) - cell_user_obj.session.commit() + # cell_user_obj.session.commit() # 筛选出需要添加的用户 drawer_add_user_list = [] for k,v in set_drawer_info.items(): diff --git a/db_logic/client_cell.py b/db_logic/client_cell.py index 7201304..7992c95 100644 --- a/db_logic/client_cell.py +++ b/db_logic/client_cell.py @@ -23,6 +23,7 @@ class BllClientCell(Repository): from rms_user as a LEFT JOIN ( select * from rms_client_cell_user where client_cell_id='{drawer_id}' and client_id='{client_id}' ) as b on a.user_id=b.user_id + group by user_id """ try: count_number = len(self.execute(sql_all).fetchall()) diff --git a/models/client_models.py b/models/client_models.py index 06b6678..4a84b2f 100644 --- a/models/client_models.py +++ b/models/client_models.py @@ -68,7 +68,7 @@ class EntityClientCellUser(Base): client_id = Column(String(50), comment="终端ID") client_code = Column(String(50), comment="终端编号") user_id = Column(String(50), comment="用户ID") - + is_add = Column(Integer, comment="", default=0) class EntityClientUser(Base): __tablename__ = "rms_client_user" @@ -113,7 +113,6 @@ class EntityClientCell(Base): cell_code = Column(String(50), comment="抽屉码") client_id = Column(String(50), comment="终端id") cell_speci = Column(String(50), comment="单元格") - is_add = Column(Integer, comment="", default=0) if __name__ == '__main__':