优化仓储、Service
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
using Infrastructure.Attribute;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using ZR.Model.System;
|
||||
using ZR.Repository;
|
||||
using ZR.Repository.System;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Service.System
|
||||
@@ -15,12 +11,6 @@ namespace ZR.Service.System
|
||||
[AppService(ServiceType = typeof(ISysPostService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class SysPostService : BaseService<SysPost>, ISysPostService
|
||||
{
|
||||
public SysPostRepository PostRepository;
|
||||
public SysPostService(SysPostRepository postRepository)
|
||||
{
|
||||
PostRepository = postRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 校验岗位编码是否唯一
|
||||
/// </summary>
|
||||
@@ -28,7 +18,7 @@ namespace ZR.Service.System
|
||||
/// <returns></returns>
|
||||
public string CheckPostCodeUnique(SysPost post)
|
||||
{
|
||||
SysPost info = PostRepository.GetFirst(it => it.PostCode.Equals(post.PostCode));
|
||||
SysPost info = GetFirst(it => it.PostCode.Equals(post.PostCode));
|
||||
if (info != null && info.PostId != post.PostId)
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
@@ -43,7 +33,7 @@ namespace ZR.Service.System
|
||||
/// <returns></returns>
|
||||
public string CheckPostNameUnique(SysPost post)
|
||||
{
|
||||
SysPost info = PostRepository.GetFirst(it => it.PostName.Equals(post.PostName));
|
||||
SysPost info = GetFirst(it => it.PostName.Equals(post.PostName));
|
||||
if (info != null && info.PostId != post.PostId)
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
@@ -53,7 +43,7 @@ namespace ZR.Service.System
|
||||
|
||||
public List<SysPost> GetAll()
|
||||
{
|
||||
return PostRepository.GetAll();
|
||||
return GetAll(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user