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.
60 lines
2.8 KiB
60 lines
2.8 KiB
|
|
using Tiobon.Core.IServices;
|
|
using Tiobon.Core.Model.Models;
|
|
using Tiobon.Core.Services.BASE;
|
|
using Tiobon.Core.IRepository.Base;
|
|
using Tiobon.Core.Common.Caches;
|
|
using Tiobon.Core.Common.DB.Dapper.Extensions;
|
|
|
|
namespace Tiobon.Core.Services
|
|
{
|
|
/// <summary>
|
|
/// 考核模板 (服务)
|
|
/// </summary>
|
|
public class Ghrp_PerformanceTemplateServices : BaseServices<Ghrp_PerformanceTemplate, Ghrp_PerformanceTemplateDto, InsertGhrp_PerformanceTemplateInput, EditGhrp_PerformanceTemplateInput>, IGhrp_PerformanceTemplateServices
|
|
{
|
|
private readonly IBaseRepository<Ghrp_PerformanceTemplate> _dal;
|
|
public Ghrp_PerformanceTemplateServices(ICaching caching, IBaseRepository<Ghrp_PerformanceTemplate> dal)
|
|
{
|
|
this._dal = dal;
|
|
base.BaseDal = dal;
|
|
base._caching = caching;
|
|
}
|
|
|
|
public override async Task<ServicePageResult<Ghrp_PerformanceTemplateDto>> QueryFilterPage(QueryBody filter, string condition, bool? IsEnable = true)
|
|
{
|
|
|
|
var result = await base.QueryFilterPage(filter, condition, IsEnable);
|
|
|
|
result.result.DT_TableDataT1.ForEach(async x =>
|
|
{
|
|
x.StageItem = await GetParaLabel("PerformanceStageItem", x.StageItem);
|
|
x.MGShowType = await GetParaLabelListString("Performance", "PerformanceMGShowType", x.MGShowType);
|
|
x.TemplateType = await GetParaLabelListString("Performance", "PerformanceTemplateType", x.TemplateType);
|
|
x.StaffGroupName = Db.Ado.GetString("select StaffGroupName from Ghra_StaffGroup where StaffGroupID=@StaffGroupID"
|
|
, new { StaffGroupID = x.StaffGroupID });
|
|
x.PeriodTypeName = Db.Ado.GetString("select PeriodTypeName from Ghrp_PerformancePeriodType where PerformancePeriodTypeID=@PerformancePeriodTypeID"
|
|
, new { PerformancePeriodTypeID = x.PerformancePeriodTypeID });
|
|
});
|
|
return result;
|
|
}
|
|
|
|
public override async Task<long> Add(InsertGhrp_PerformanceTemplateInput entity)
|
|
{
|
|
if (entity.PerformancePeriodTypeID != null)
|
|
entity.PeriodTypeNo = await Db.Queryable<Ghrp_PerformancePeriodType>().Where(a => a.Id == entity.PerformancePeriodTypeID).Select(x => x.PeriodTypeNo).FirstAsync();
|
|
var result = await base.Add(entity);
|
|
|
|
return result;
|
|
}
|
|
|
|
public override async Task<bool> Update(long Id, EditGhrp_PerformanceTemplateInput editModel)
|
|
{
|
|
if (editModel.PerformancePeriodTypeID != null)
|
|
editModel.PeriodTypeNo = await Db.Queryable<Ghrp_PerformancePeriodType>().Where(a => a.Id == editModel.PerformancePeriodTypeID).Select(x => x.PeriodTypeNo).FirstAsync();
|
|
|
|
var result = await base.Update(Id, editModel, null, ["Status"]);
|
|
return result;
|
|
}
|
|
}
|
|
} |