SysPostService.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Infrastructure.Attribute;
  2. using ZR.Model.System;
  3. namespace ZR.ServiceCore.Services
  4. {
  5. /// <summary>
  6. /// 岗位管理
  7. /// </summary>
  8. [AppService(ServiceType = typeof(ISysPostService), ServiceLifetime = LifeTime.Transient)]
  9. public class SysPostService : BaseService<SysPost>, ISysPostService
  10. {
  11. /// <summary>
  12. /// 校验岗位编码是否唯一
  13. /// </summary>
  14. /// <param name="post"></param>
  15. /// <returns></returns>
  16. public string CheckPostCodeUnique(SysPost post)
  17. {
  18. SysPost info = GetFirst(it => it.PostCode.Equals(post.PostCode));
  19. if (info != null && info.PostId != post.PostId)
  20. {
  21. return UserConstants.NOT_UNIQUE;
  22. }
  23. return UserConstants.UNIQUE;
  24. }
  25. /// <summary>
  26. /// 校验岗位名称是否唯一
  27. /// </summary>
  28. /// <param name="post"></param>
  29. /// <returns></returns>
  30. public string CheckPostNameUnique(SysPost post)
  31. {
  32. SysPost info = GetFirst(it => it.PostName.Equals(post.PostName));
  33. if (info != null && info.PostId != post.PostId)
  34. {
  35. return UserConstants.NOT_UNIQUE;
  36. }
  37. return UserConstants.UNIQUE;
  38. }
  39. public List<SysPost> GetAll()
  40. {
  41. return GetAll(false);
  42. }
  43. }
  44. }