shgx_tz_mom/ZR.Service/System/SysPostService.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2021-08-23 16:57:25 +08:00
using Infrastructure.Attribute;
using System.Collections.Generic;
using ZR.Model.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
{
/// <summary>
/// 校验岗位编码是否唯一
/// </summary>
/// <param name="sysPost"></param>
/// <returns></returns>
public string CheckPostCodeUnique(SysPost post)
{
2022-09-21 21:43:05 +08:00
SysPost info = 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)
{
2022-09-21 21:43:05 +08:00
SysPost info = 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;
}
2022-03-19 08:04:08 +08:00
public List<SysPost> GetAll()
{
2022-09-21 21:43:05 +08:00
return GetAll(false);
2022-03-19 08:04:08 +08:00
}
2021-08-23 16:57:25 +08:00
}
}