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.
49 lines
2.0 KiB
49 lines
2.0 KiB
using MathNet.Numerics.Distributions;
|
|
using Tiobon.Core.Common.DB.Dapper.Extensions;
|
|
|
|
namespace Tiobon.Core.Services;
|
|
|
|
/// <summary>
|
|
/// 多岗维护 (服务)
|
|
/// </summary>
|
|
public class Ghre_MultipleTitleServices : BaseServices<Ghre_MultipleTitle, Ghre_MultipleTitleDto, InsertGhre_MultipleTitleInput, EditGhre_MultipleTitleInput>, IGhre_MultipleTitleServices
|
|
{
|
|
private readonly IBaseRepository<Ghre_MultipleTitle> _dal;
|
|
public Ghre_MultipleTitleServices(ICaching caching, IBaseRepository<Ghre_MultipleTitle> dal)
|
|
{
|
|
this._dal = dal;
|
|
base.BaseDal = dal;
|
|
base._caching = caching;
|
|
}
|
|
|
|
public override async Task<long> Add(InsertGhre_MultipleTitleInput entity)
|
|
{
|
|
|
|
await Db.Updateable<Ghre_MultipleTitle>()
|
|
.SetColumns(it => new Ghre_MultipleTitle() { IsEnable = 0 })
|
|
.Where(it => it.StaffId == entity.StaffId)
|
|
.ExecuteCommandAsync();
|
|
|
|
entity.TitleId1 = entity.TitleIds.Count > 0 ? entity.TitleIds[0] : null;
|
|
entity.TitleId2 = entity.TitleIds.Count > 1 ? entity.TitleIds[1] : null;
|
|
entity.TitleId3 = entity.TitleIds.Count > 2 ? entity.TitleIds[2] : null;
|
|
entity.TitleId4 = entity.TitleIds.Count > 3 ? entity.TitleIds[3] : null;
|
|
entity.TitleId5 = entity.TitleIds.Count > 4 ? entity.TitleIds[4] : null;
|
|
|
|
var result = await base.Add(entity);
|
|
|
|
return result;
|
|
}
|
|
|
|
public override async Task<bool> Update(long Id, EditGhre_MultipleTitleInput entity)
|
|
{
|
|
|
|
entity.TitleId1 = entity.TitleIds.Count > 0 ? entity.TitleIds[0] : null;
|
|
entity.TitleId2 = entity.TitleIds.Count > 1 ? entity.TitleIds[1] : null;
|
|
entity.TitleId3 = entity.TitleIds.Count > 2 ? entity.TitleIds[2] : null;
|
|
entity.TitleId4 = entity.TitleIds.Count > 3 ? entity.TitleIds[3] : null;
|
|
entity.TitleId5 = entity.TitleIds.Count > 4 ? entity.TitleIds[4] : null;
|
|
var result = await base.Update(Id, entity);
|
|
return result;
|
|
}
|
|
} |