|
|
|
@ -51,6 +51,7 @@ namespace Tiobon.Core.Services |
|
|
|
|
public override async Task<bool> Update(long Id, EditGhra_StaffGroupInput editModel) |
|
|
|
|
{ |
|
|
|
|
await _StaffGroupDetailServices.Delete(x => x.StaffGroupID == Id); |
|
|
|
|
|
|
|
|
|
editModel.StaffGroupDetail.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
x.StaffGroupID = Id; |
|
|
|
@ -59,6 +60,25 @@ namespace Tiobon.Core.Services |
|
|
|
|
|
|
|
|
|
return await base.Update(Id, editModel); |
|
|
|
|
} |
|
|
|
|
public override async Task<bool> DeleteById1(object id) |
|
|
|
|
{ |
|
|
|
|
var entity = await BaseDal.QueryById(id); |
|
|
|
|
BasePoco ent = entity as BasePoco; |
|
|
|
|
ent.IsEnable = 0; |
|
|
|
|
HttpRequest request = UserContext.Context.Request; |
|
|
|
|
var api = request.Path.ObjToString().TrimEnd('/').ToLower(); |
|
|
|
|
var ip = GetUserIp(UserContext.Context); |
|
|
|
|
string sql = @$"update Ghra_StaffGroupDetail
|
|
|
|
|
set IsEnable=0, |
|
|
|
|
UpdateBy={App.User.ID.ToString()}, |
|
|
|
|
UpdateIP={ip}, |
|
|
|
|
UpdateProg={api}, |
|
|
|
|
UpdateTime=GETDATE() |
|
|
|
|
where StaffGroupID={id.ToString()} |
|
|
|
|
and IsEnable= 1";
|
|
|
|
|
|
|
|
|
|
return await BaseDal.Update(entity); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public override async Task<ServiceFormResult<Ghra_StaffGroupDto>> QueryForm(QueryForm body) |
|
|
|
|
{ |
|
|
|
@ -148,9 +168,10 @@ namespace Tiobon.Core.Services |
|
|
|
|
return ServiceResult<object>.OprateSuccess("查询成功!", result); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public async Task<ServiceResult<Dictionary<string, object>>> GetStaffGroupInfoByID(long Id,string BaseDate) |
|
|
|
|
public async Task<ServiceResult<Dictionary<string, object>>> GetStaffGroupInfoByID(long Id,JObject FBody) |
|
|
|
|
{ |
|
|
|
|
string LangID = App.User.GetLangId().ToString(); |
|
|
|
|
string BaseDate = FBody["BaseDate"]?.Value<string>() ?? DateTime.Now.ToString("yyyy-MM-dd"); |
|
|
|
|
if (LangID == "0") LangID = "1"; |
|
|
|
|
string sql = @$"select case when Operator not in ('IsNull','NotNull') then iif(IsChangeColumn = 1,'b.','a.')+StaffField
|
|
|
|
|
+ case when Operator = 'Equal' |
|
|
|
@ -230,17 +251,18 @@ namespace Tiobon.Core.Services |
|
|
|
|
; if ( !staffInfoColumns.Any(x => x.StaffInfoColumnNo == dr["ColumnNo"].ToString())) |
|
|
|
|
{ |
|
|
|
|
staffInfoColumns.Add(staffInfo); |
|
|
|
|
SqlStr += ","+dr["SqlStr"].ToString()+ $" [{dr["ColumnNo"].ToString()}] "; |
|
|
|
|
SqlStr += ","+dr["SqlStr"].ToString(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
string StaffSql = @$"select a.StaffID,a.StaffNo,a.StaffName,
|
|
|
|
|
dbo.FA_StaffInfoRepItemStaffInfo(a.StaffID,null,{LangID},'DeptFullPateName') DeptFullPateName |
|
|
|
|
from Ghra_Staff a inner join (select * from Ghra_StaffChange where IsEnable=1 and ChangeDate= [dbo].[FLatestStaffChangeDate](StaffID,{(string.IsNullOrEmpty(BaseDate) ? "getdate()" : "'" + BaseDate + "'")}) )b |
|
|
|
|
{SqlStr} |
|
|
|
|
from Ghra_Staff a inner join (select * from Ghra_StaffChange where IsEnable=1 and ChangeDate= [dbo].[FLatestStaffChangeDate](StaffID,'{BaseDate}') )b |
|
|
|
|
on a.StaffID = b.StaffID |
|
|
|
|
where a.IsEnable=1 |
|
|
|
|
and a.InDate <= {(string.IsNullOrEmpty(BaseDate) ? "getdate()" : "'" + BaseDate + "'")} |
|
|
|
|
and (a.OutDate is null or a.OutDate>= {(string.IsNullOrEmpty(BaseDate) ? "getdate()" : "'" + BaseDate + "'")} ) "
|
|
|
|
|
and a.InDate <= '{BaseDate}' |
|
|
|
|
and (a.OutDate is null or a.OutDate>= '{BaseDate}' ) "
|
|
|
|
|
+ WhereSQL; |
|
|
|
|
|
|
|
|
|
DataTable staffTable = await Db.Ado.GetDataTableAsync(StaffSql); |
|
|
|
|