Commit 0f93c034 by tangzhongyang

职称标准保存 个人职称补贴结果查询 个人职称补贴结果保存

parent bb491167
...@@ -44,26 +44,30 @@ public class SubsidyController : ControllerBase ...@@ -44,26 +44,30 @@ public class SubsidyController : ControllerBase
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
//1
// 职称标准保存 // 职称标准保存
[HttpPost("{allotId}/jobtitle")] [HttpPost("{allotId}/jobtitle")]
public async Task SaveJobTitle(int allotId) public ApiResponse SaveJobTitle(int allotId,[FromBody]List<sub_jobtitle> sub_Jobtitle)
{ {
throw new NotImplementedException(); bool a =_service.SaveJobTitle(allotId, sub_Jobtitle);
return new ApiResponse(Status.Ok, a);
} }
// 个人职称补贴结果查询 // 个人职称补贴结果查询
[HttpGet("{allotId}/jobtitle/subsidy")] [HttpGet("{allotId}/jobtitle/subsidy")]
public Task<ApiResponse> GetJobTitleSubsidy(int allotId) public ApiResponse GetJobTitleSubsidy(int allotId)
{ {
throw new NotImplementedException(); List<sub_subsidy> a=_service.GetJobTitleSubsidy(allotId);
return new ApiResponse(Status.Ok, a);
} }
// 个人职称补贴结果保存 // 个人职称补贴结果保存
[HttpPost("{allotId}/jobtitle/subsidy")] [HttpPost("{allotId}/jobtitle/subsidy")]
public async Task SaveJobTitleSubsidy(int allotId) public ApiResponse SaveJobTitleSubsidy(int allotId, [FromBody] List<sub_subsidy> subsidys)
{ {
throw new NotImplementedException(); bool a = _service.SaveJobTitleSubsidy(allotId, subsidys);
return new ApiResponse(Status.Ok, a);
} }
} }
} }
...@@ -6,7 +6,9 @@ ...@@ -6,7 +6,9 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="2.0.90" /> <PackageReference Include="Dapper" Version="2.0.90" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" /> <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0" />
<PackageReference Include="MySql.Data" Version="8.0.24" /> <PackageReference Include="MySql.Data" Version="8.0.24" />
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" /> <PackageReference Include="Oracle.ManagedDataAccess.Core" Version="3.21.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.2" /> <PackageReference Include="System.Data.SqlClient" Version="4.8.2" />
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
using Performance.Subsidy.Services.Repository; using Performance.Subsidy.Services.Repository;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Http;
namespace Performance.Subsidy.Services namespace Performance.Subsidy.Services
{ {
...@@ -28,5 +30,43 @@ public class SubsidyService ...@@ -28,5 +30,43 @@ public class SubsidyService
{ {
return await _factory.CreateDefault().QueryAsync<sub_jobtitle>("SELECT * FROM sub_jobtitle WHERE AllotID=@allotId", new { allotId }); return await _factory.CreateDefault().QueryAsync<sub_jobtitle>("SELECT * FROM sub_jobtitle WHERE AllotID=@allotId", new { allotId });
} }
public bool SaveJobTitle(int allotId, List<sub_jobtitle> jobtitle)
{
int i = 0;
foreach (var item in jobtitle)
{
_factory.CreateDefault().Execute($" update `sub_jobtitle` set BasicPerforFee ={item.BasicPerforFee} WHERE AllotID={allotId} and JobTitle='{item.JobTitle}'; ");
_factory.CreateDefault().Execute(@$" update sub_subsidy t1 INNER JOIN `sub_jobtitle` t2 on t1.AllotID=t2.AllotID and t1.JobTitle=t2.JobTitle set
t1.BasicPerforFee = t2.BasicPerforFee; ");
i++;
}
return i > 0;
}
public List<sub_subsidy> GetJobTitleSubsidy(int allotId)
{
IEnumerable<sub_subsidy> _Subsidies = _factory.CreateDefault().Query<sub_subsidy>(@" select t1.ID,t1.AllotID,Department,PersonnelNumber,PersonnelName,t1.JobTitle,t2.BasicPerforFee,Attendance,t2.BasicPerforFee*Attendance GiveAmount,t2.BasicPerforFee*Attendance RealAmount from sub_subsidy t1
join sub_jobtitle t2 on t1.AllotID = t2.AllotID and t1.JobTitle = t2.JobTitle
where t1.AllotID = @allotid", new { allotId });
return _Subsidies?.ToList();
}
public bool SaveJobTitleSubsidy(int allotId, List<sub_subsidy> subsidys)
{
int i = 0;
foreach (var item in subsidys)
{
_factory.CreateDefault().Execute(@$"
update sub_subsidy set
GiveAmount = Attendance * BasicPerforFee, RealAmount = {item.RealAmount} where AllotID={allotId} and PersonnelNumber={item.PersonnelNumber};");
i++;
}
return i > 0;
}
} }
} }
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