2021-08-23 16:57:25 +08:00
|
|
|
|
using Infrastructure.Attribute;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using ZR.Model.System;
|
2021-09-27 08:06:09 +08:00
|
|
|
|
using ZR.Repository;
|
|
|
|
|
|
using ZR.Repository.System;
|
2021-09-16 19:35:17 +08:00
|
|
|
|
using ZR.Service.System.IService;
|
2021-08-23 16:57:25 +08:00
|
|
|
|
|
|
|
|
|
|
namespace ZR.Service.System
|
|
|
|
|
|
{
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 岗位管理
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
[AppService(ServiceType = typeof(ISysPostService), ServiceLifetime = LifeTime.Transient)]
|
2021-09-27 16:07:55 +08:00
|
|
|
|
public class SysPostService : BaseService<SysPost>, ISysPostService
|
2021-08-23 16:57:25 +08:00
|
|
|
|
{
|
2021-09-27 08:06:09 +08:00
|
|
|
|
public SysPostRepository PostRepository;
|
2021-11-27 09:43:04 +08:00
|
|
|
|
public SysPostService(SysPostRepository postRepository): base(postRepository)
|
2021-09-27 08:06:09 +08:00
|
|
|
|
{
|
|
|
|
|
|
PostRepository = postRepository;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2021-08-23 16:57:25 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 校验岗位编码是否唯一
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sysPost"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public string CheckPostCodeUnique(SysPost post)
|
|
|
|
|
|
{
|
2021-09-27 08:06:09 +08:00
|
|
|
|
SysPost info = PostRepository.GetFirst(it => it.PostCode.Equals(post.PostCode));
|
2021-08-23 16:57:25 +08:00
|
|
|
|
if (info != null && info.PostId != post.PostId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 校验岗位名称是否唯一
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sysPost"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
public string CheckPostNameUnique(SysPost post)
|
|
|
|
|
|
{
|
2021-09-27 08:06:09 +08:00
|
|
|
|
SysPost info = PostRepository.GetFirst(it => it.PostName.Equals(post.PostName));
|
2021-08-23 16:57:25 +08:00
|
|
|
|
if (info != null && info.PostId != post.PostId)
|
|
|
|
|
|
{
|
|
|
|
|
|
return UserConstants.NOT_UNIQUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
return UserConstants.UNIQUE;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|