You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Tiobon.Web.Core/Tiobon.Core.Services/Ghrp/Ghrp_PerformanceItemService...

53 lines
2.3 KiB

namespace Tiobon.Core.Services;
/// <summary>
/// 考核指标 (服务)
/// </summary>
public class Ghrp_PerformanceItemServices : BaseServices<Ghrp_PerformanceItem, Ghrp_PerformanceItemDto, InsertGhrp_PerformanceItemInput, EditGhrp_PerformanceItemInput>, IGhrp_PerformanceItemServices
{
private readonly IBaseRepository<Ghrp_PerformanceItem> _dal;
public Ghrp_PerformanceItemServices(ICaching caching, IBaseRepository<Ghrp_PerformanceItem> dal)
{
this._dal = dal;
base.BaseDal = dal;
base._caching = caching;
}
public override async Task<ServicePageResult<Ghrp_PerformanceItemDto>> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true)
{
string? ItemStatus = null;
if (filter.jsonParam != null)
foreach (JProperty jProperty in filter.jsonParam.Properties())
{
var name = jProperty.Name;
var value = jProperty.Value.ToString();
if (name == "ItemStatus")
{
var jsonParam = JsonHelper.JsonToObj<JsonParam>(value);
ItemStatus = jsonParam.columnValue.ToString();
}
}
if (!string.IsNullOrEmpty(ItemStatus))
{
condition = $@" (case when BeginDate > convert(date,getdate()) then '2'
when convert(date,getdate()) between ISNULL(BeginDate,'1900-01-01') and ISNULL(EndDate,'2099-01-01') then '1'
else '0' end ) = '{ItemStatus}' ";
}
var result = await base.QueryFilterPage(filter, condition, IsEnable);
result.result.DT_TableDataT1.ForEach(async x =>
{
x.ItemType1 = await GetParaLabel("PerformanceItemType1", x.ItemType1);
x.ItemType2 = await GetParaLabel("PerformanceItemType2", x.ItemType2);
x.ItemType3 = await GetParaLabel("PerformanceItemType3", x.ItemType3);
x.ItemKind = await GetParaLabel("PerformanceItemKind", x.ItemKind);
x.DeptType = await GetParaLabel("PerformanceDeptType", x.DeptType);
x.Tag1 = await GetParaLabel("PerformanceTag1", x.Tag1);
x.Tag2 = await GetParaLabel("PerformanceTag2", x.Tag2);
x.Tag3 = await GetParaLabel("PerformanceTag3", x.Tag3);
});
return result;
}
}