SysPostService.cs 1.4 KB

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