|
@@ -360,3 +360,43 @@ async def delete_dict_data(
|
|
|
'msg': str(e)
|
|
|
})
|
|
|
|
|
|
+@router.delete("/delete_list/{id_list}") # 使用 ID 来标识要删除的接口
|
|
|
+async def delete_dict_data(
|
|
|
+ id_list: str,
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
+ user_id = Depends(valid_access_token)
|
|
|
+):
|
|
|
+ try:
|
|
|
+ # 从数据库中获取要删除的 OneShareApiEntity 实例
|
|
|
+ id_list = [int(i) for i in id_list.split(',')]
|
|
|
+ query = db.query(DutySchedule)
|
|
|
+ query = query.filter(DutySchedule.id._in(id_list))
|
|
|
+ query = query.filter(DutySchedule.del_flag != '2')
|
|
|
+ position_data = query.all()
|
|
|
+ # dict_data = db.query(SysDictData).filter(SysDictData.dict_code == dictCode and SysDictData.del_flag != '2').first()
|
|
|
+
|
|
|
+ if not position_data:
|
|
|
+ return JSONResponse(status_code=404, content={
|
|
|
+ 'code': 404,
|
|
|
+ 'msg': '值班不存在'
|
|
|
+ })
|
|
|
+ for info in position_data:
|
|
|
+ info.del_flag = '2'
|
|
|
+ # 删除实例
|
|
|
+ # db.delete(api)
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ # 构建并返回响应
|
|
|
+ return {
|
|
|
+ "code": 200,
|
|
|
+ "msg": "操作成功",
|
|
|
+ "data": None
|
|
|
+ }
|
|
|
+ except Exception as e:
|
|
|
+
|
|
|
+ traceback.print_exc()
|
|
|
+ return JSONResponse(status_code=404, content={
|
|
|
+ 'code': 404,
|
|
|
+ 'msg': str(e)
|
|
|
+ })
|