From 4fa3124aea8179b71e67eb0a405235599189d13b Mon Sep 17 00:00:00 2001 From: "DEVICE8\\12494" Date: Wed, 17 May 2023 18:31:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=85=B7=E7=BB=84=E4=BF=9D=E5=85=BB?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Dto/MoldMaintainDelInput.cs | 19 +++++++++++++++ .../ToolMoldMaintainGroupService.cs | 23 +++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs diff --git a/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs new file mode 100644 index 00000000..0d078291 --- /dev/null +++ b/EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tnb.EquipMgr.Entities.Dto +{ + /// + /// 模具保养删除参数 + /// + public class MoldMaintainDelInput : BaseInput + { + /// + /// 删除的表名 + /// + public string table_name { get; set; } + } +} diff --git a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs index 52c7d969..2391aa23 100644 --- a/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs +++ b/EquipMgr/Tnb.EquipMgr/ToolMoldMaintainGroupService.cs @@ -97,11 +97,34 @@ namespace Tnb.EquipMgr [HttpPost] public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input) => await Relevance(input, nameof(ToolMoldMaintainGroupRelation.mold_id), it => it.item_group_id == input.item_group_id); + /// + /// 删除项目组与模具检查项信息 + /// + /// + /// + [HttpPost] + public async Task Delete(MoldMaintainDelInput input) + { + if (input.table_name == "item") + { + await Delete(it => it.item_group_id == input.item_group_id && input.ids.Contains(it.item_id)); + } + else + { + await Delete(it => it.item_group_id == input.item_group_id && input.ids.Contains(it.mold_id)); + } + } #endregion + + private async Task Delete(Expression> deleteExp) where T : BaseEntity, new() + { + await _db.Deleteable().Where(deleteExp).ExecuteCommandAsync(); + } + private async Task Relevance(TSrc input, string name, Expression> deleleExp) where TDest : BaseEntity, new() where TSrc : BaseInput {