Commit 35815337 by 李承祥

删除保底绩效

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