SysPostService.cs 1.4 KB

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