From 79f1749c66fcab6b14956e109a3dce2aee8bae7f Mon Sep 17 00:00:00 2001 From: 13507605001 Date: Fri, 2 Dec 2022 19:46:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=8A=BD=E5=B1=89=E6=9D=83?= =?UTF-8?q?=E9=99=90=E5=B1=95=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/client/views.py | 10 ++++++++-- db_logic/client_cell.py | 1 + models/client_models.py | 3 +-- 3 files changed, 10 insertions(+), 4 deletions(-) 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__':