模具组保养管理
This commit is contained in:
19
EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs
Normal file
19
EquipMgr/Tnb.EquipMgr.Entities/Dto/MoldMaintainDelInput.cs
Normal file
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 模具保养删除参数
|
||||
/// </summary>
|
||||
public class MoldMaintainDelInput : BaseInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 删除的表名
|
||||
/// </summary>
|
||||
public string table_name { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -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