From e7889930f834c17e2acc39dc06071d4531ae7ec3 Mon Sep 17 00:00:00 2001 From: "apan_youxiang@163.com" Date: Mon, 29 Aug 2022 13:58:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E9=80=BB=E8=BE=91=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/client/views.py | 34 +++++++++++++++++----------------- db_logic/client.py | 2 +- db_logic/module_relation.py | 13 ++++++------- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/apps/client/views.py b/apps/client/views.py index ecadc06..649071c 100644 --- a/apps/client/views.py +++ b/apps/client/views.py @@ -102,17 +102,17 @@ def update_status(): @token_auth.login_required def client_del(): client_id = request.values.get("client_id") - # drug_obj = BllMedicament().findEntity(EntityMedicament.client_id == client_id) - # if drug_obj: - # return jsonify(Utils.false_return(msg="请先删除柜体内试剂数据")) - # else: - # BllClient().delete(EntityClient.client_id==client_id) - # BllMedicamentRecord().delete(EntityMedicamentRecord.client_id == client_id) - # BllMedicamentTemplate().delete(EntityMedicamentTemplate.client_id == client_id) - # BllHumitureRecord().delete(EntityHumitureRecord.client_id == client_id) + drug_obj = BllMedicament().findEntity(EntityMedicament.client_id == client_id) + if drug_obj: + return jsonify(Utils.false_return(msg="请先删除柜体内试剂数据")) + else: + BllClient().delete(EntityClient.client_id==client_id) + BllMedicamentRecord().delete(EntityMedicamentRecord.client_id == client_id) + BllMedicamentTemplate().delete(EntityMedicamentTemplate.client_id == client_id) + BllHumitureRecord().delete(EntityHumitureRecord.client_id == client_id) - # return jsonify(Utils.true_return(msg="删除成功")) - return jsonify(Utils.true_return()) + return jsonify(Utils.true_return(msg="删除成功")) + # return jsonify(Utils.true_return()) # 清空所有需删除表数据 @@ -126,13 +126,13 @@ def client_del(): @token_auth.login_required def client_empty(): client_id = request.values.get("client_id") - # if client_id: - # BllMedicament().delete(EntityMedicament.client_id == client_id) - # BllMedicamentRecord().delete(EntityMedicamentRecord.client_id == client_id) - # BllMedicamentTemplate().delete(EntityMedicamentTemplate.client_id == client_id) - # BllHumitureRecord().delete(EntityHumitureRecord.client_id == client_id) - # else: - # BllClient().empty_table_info() + if client_id: + BllMedicament().delete(EntityMedicament.client_id == client_id) + BllMedicamentRecord().delete(EntityMedicamentRecord.client_id == client_id) + BllMedicamentTemplate().delete(EntityMedicamentTemplate.client_id == client_id) + BllHumitureRecord().delete(EntityHumitureRecord.client_id == client_id) + else: + BllClient().empty_table_info() return jsonify(Utils.true_return()) diff --git a/db_logic/client.py b/db_logic/client.py index 691330f..c3b4692 100644 --- a/db_logic/client.py +++ b/db_logic/client.py @@ -70,5 +70,5 @@ class BllClient(Repository): ] for i in table_list: sql_all = f"truncate {i}" - self.execute(sql_all) + self.executeNoParam(sql_all) return True diff --git a/db_logic/module_relation.py b/db_logic/module_relation.py index 3d1c849..e2fd80e 100644 --- a/db_logic/module_relation.py +++ b/db_logic/module_relation.py @@ -124,7 +124,7 @@ class BllModuleRelation(Repository): return self.execute(page_sql_data).fetchall() def add_inster_user_moduele(self): - role_id = "a699ff99-117b-11ed-a086-f47b094925e5" + role_id = "68984021-117b-11ed-8c91-f47b094925e5" obj_list = [] all_module_list = self.execute("select * from rms_module") all_module_list = Utils.msyql_table_model(all_module_list) @@ -144,16 +144,15 @@ class BllModuleRelation(Repository): if __name__ == '__main__': - module_list = BllModuleRelation().get_user_module_list( - user_id='4cea74ee-0d8b-11ed-943e-f47b094925e1', role_id='a699ff99-117b-11ed-a086-f47b094925e5') - module_list = Utils.msyql_table_model(module_list) + module_list = BllModuleRelation().add_inster_user_moduele() + # module_list = Utils.msyql_table_model(module_list) # if len(module_list) > 6: # for module in module_list: # if module["module_code"] == "DataReport": # if module_list.index(module) in [1,2,4]: # module_list.pop(module_list.index(module)) # module_list.insert(5, module) - data = module_list - for i in data: - print(data) + # data = module_list + # for i in data: + # print(data)