Commit efefd1c0 by 李承祥

保底绩效配置修改,删除数据

parent eaae5321
......@@ -98,9 +98,10 @@ public List<cof_guarantee> GuarantInsert(GuaranteeRequest request)
/// <returns></returns>
public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
{
var guaranteeList = perforCofguaranteeRepository.GetEntities(t => t.UnitType == request.UnitType && t.Target == request.Target);
var guarantee = perforCofguaranteeRepository.GetEntity(t => t.Id == request.Source.FirstOrDefault().GId);
var guaranteeList = perforCofguaranteeRepository.GetEntities(t => t.UnitType == guarantee.UnitType && t.Target == guarantee.Target);
if (guaranteeList == null)
throw new PerformanceException("request.Id 参数错误");
throw new PerformanceException("提交数据无效");
#region 修改优先级
int flag = guaranteeList.FirstOrDefault().Priority.Value;
......@@ -122,6 +123,15 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
perforCofguaranteeRepository.UpdateRange(list.ToArray());
}
}
else if (flag == request.Priority)
{
var list = perforCofguaranteeRepository.GetEntities(t => t.AllotId == request.AllotId && t.UnitType == request.UnitType && t.Priority == request.Priority);
if (list != null && list.Any())
{
list?.ForEach(t => { t.Priority = t.Priority + 1; });
perforCofguaranteeRepository.UpdateRange(list.ToArray());
}
}
#endregion
#region 添加
......@@ -153,7 +163,7 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
if (!perforCofguaranteeRepository.UpdateRange(guaranteeList.ToArray()))
throw new PerformanceException("保存失败");
if (exist != null && exist.Count() > 0)
if (delItem != null && delItem.Count() > 0)
perforCofguaranteeRepository.RemoveRange(guaranteeList.Where(t => delItem.Contains(t.Id)).ToArray());
#endregion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment