Commit b43aaf28 by tangzhongyang

职称标准保存 个人职称补贴结果查询 个人职称补贴结果保存 (修改)

parent 0f93c034
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
using Performance.Subsidy.Services.Repository; using Performance.Subsidy.Services.Repository;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Web.Http; using System.Web.Http;
...@@ -33,40 +35,26 @@ public class SubsidyService ...@@ -33,40 +35,26 @@ public class SubsidyService
public bool SaveJobTitle(int allotId, List<sub_jobtitle> jobtitle) public bool SaveJobTitle(int allotId, List<sub_jobtitle> jobtitle)
{ {
int i = 0; var CreateDefault = _factory.CreateDefault();
foreach (var item in jobtitle) var result = jobtitle.Select(t => new { AllotID = allotId, t.BasicPerforFee, t.JobTitle });
{ var modify= CreateDefault.Execute($" update `sub_jobtitle` set BasicPerforFee =@BasicPerforFee WHERE AllotID=@allotId and JobTitle=@JobTitle; ", result);
_factory.CreateDefault().Execute($" update `sub_jobtitle` set BasicPerforFee ={item.BasicPerforFee} WHERE AllotID={allotId} and JobTitle='{item.JobTitle}'; "); var storedProcedure= CreateDefault.Execute("call proc_performance_subsidy(@allotId) ;", result);
_factory.CreateDefault().Execute(@$" update sub_subsidy t1 INNER JOIN `sub_jobtitle` t2 on t1.AllotID=t2.AllotID and t1.JobTitle=t2.JobTitle set return modify>0 && storedProcedure>0;
t1.BasicPerforFee = t2.BasicPerforFee; ");
i++;
}
return i > 0;
} }
public List<sub_subsidy> GetJobTitleSubsidy(int allotId) 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 IEnumerable<sub_subsidy> _Subsidies = _factory.CreateDefault().Query<sub_subsidy>(@"
join sub_jobtitle t2 on t1.AllotID = t2.AllotID and t1.JobTitle = t2.JobTitle select*from sub_subsidy where RealAmount is not null and AllotID=@allotId and RealAmount is not null ", new { allotId });
where t1.AllotID = @allotid", new { allotId });
return _Subsidies?.ToList(); return _Subsidies?.ToList();
} }
public bool SaveJobTitleSubsidy(int allotId, List<sub_subsidy> subsidys) public bool SaveJobTitleSubsidy(int allotId, List<sub_subsidy> subsidys)
{ {
int i = 0; var result = subsidys.Select(t => new { t.RealAmount, AllotID = allotId, t.PersonnelNumber });
foreach (var item in subsidys) return _factory.CreateDefault().Execute(@$"update sub_subsidy set
{ GiveAmount = Attendance * BasicPerforFee, RealAmount = @RealAmount where AllotID=@allotId and PersonnelNumber=@PersonnelNumber;",result)>0;
_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