删除逻辑添加

duizhaopin
apan_youxiang@163.com 2 years ago
parent 7ceeaccdfe
commit e7889930f8

@ -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())

@ -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

@ -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)

Loading…
Cancel
Save