Commit 35815337 by 李承祥

删除保底绩效

parent f0a35d36
......@@ -75,7 +75,7 @@ public ApiResponse<List<cof_guarantee>> GuarantUpdate([CustomizeValidator(RuleSe
[HttpPost]
public ApiResponse<cof_guarantee> GuarantDelete([CustomizeValidator(RuleSet = "Delete"), FromBody]GuaranteeRequest request)
{
var result = guaranteeService.GuarantDelete(request.Id);
var result = guaranteeService.GuarantDelete(request);
if (result)
return new ApiResponse<cof_guarantee>(ResponseType.OK, "删除配置成功");
return new ApiResponse<cof_guarantee>(ResponseType.Fail, "删除配置失败");
......
......@@ -42,14 +42,17 @@ public GuaranteeRequestValidator()
RuleFor(x => x.Priority).NotNull().GreaterThan(0);
});
RuleSet("Update", () =>
{
RuleFor(x => x.Id).NotNull().GreaterThan(0);
});
//RuleSet("Update", () =>
//{
// RuleFor(x => x.Id).NotNull().GreaterThan(0);
//});
RuleSet("Delete", () =>
{
RuleFor(x => x.Id).NotNull().GreaterThan(0);
RuleFor(x => x.AllotId).NotNull().GreaterThan(0);
RuleFor(x => x.Priority).NotNull().GreaterThan(0);
RuleFor(x => x.UnitType).NotNull().GreaterThan(0);
RuleFor(x => x.Target).NotEmpty();
});
}
}
......
......@@ -166,12 +166,12 @@ public List<cof_guarantee> GuarantUpdate(GuaranteeRequest request)
/// </summary>
/// <param name="allotId"></param>
/// <returns></returns>
public bool GuarantDelete(int id)
public bool GuarantDelete(GuaranteeRequest request)
{
var guarantee = perforCofguaranteeRepository.GetEntity(t => t.Id == id);
if (guarantee == null)
var list = perforCofguaranteeRepository.GetEntities(t => t.AllotId == request.AllotId && t.UnitType == request.UnitType && t.Target == request.Target && t.Priority == request.Priority);
if (list == null)
return false;
return perforCofguaranteeRepository.Remove(guarantee);
return perforCofguaranteeRepository.RemoveRange(list.ToArray());
}
/// <summary>
......
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