模具组保养管理
This commit is contained in:
@@ -97,11 +97,34 @@ namespace Tnb.EquipMgr
|
||||
[HttpPost]
|
||||
public async Task RelevanceMaintianGroupAndMold(MoldMaintainGroupItemRelationInput input) =>
|
||||
await Relevance<MoldMaintainGroupItemRelationInput, ToolMoldMaintainGroupRelation>(input, nameof(ToolMoldMaintainGroupRelation.mold_id), it => it.item_group_id == input.item_group_id);
|
||||
/// <summary>
|
||||
/// 删除项目组与模具检查项信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public async Task Delete(MoldMaintainDelInput input)
|
||||
{
|
||||
|
||||
if (input.table_name == "item")
|
||||
{
|
||||
await Delete<ToolMoldMaintainGroupItem>(it => it.item_group_id == input.item_group_id && input.ids.Contains(it.item_id));
|
||||
}
|
||||
else
|
||||
{
|
||||
await Delete<ToolMoldMaintainGroupRelation>(it => it.item_group_id == input.item_group_id && input.ids.Contains(it.mold_id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
private async Task Delete<T>(Expression<Func<T, bool>> deleteExp) where T : BaseEntity<string>, new()
|
||||
{
|
||||
await _db.Deleteable<T>().Where(deleteExp).ExecuteCommandAsync();
|
||||
}
|
||||
|
||||
private async Task Relevance<TSrc, TDest>(TSrc input, string name, Expression<Func<TDest, bool>> deleleExp) where TDest : BaseEntity<string>, new()
|
||||
where TSrc : BaseInput
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user