招聘后台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

40 lines
1.3 KiB

using System.Threading.Tasks;
using Znyc.Recruitment.Admin.Commons.IDbContext;
using Znyc.Recruitment.Admin.Commons.Repositories;
using Znyc.Recruitment.Admin.Security.Entitys;
using Znyc.Recruitment.Admin.Security.IRepositories;
namespace Znyc.Recruitment.Admin.Security.Repositories
{
public class DictionaryRepository : BaseRepository<DictionaryEntity, long>, IDictionaryRepository
{
public DictionaryRepository()
{
}
public DictionaryRepository(IDbContextCore dbContext) : base(dbContext)
{
}
/// <summary>
/// 根据编码查询字典分类
/// </summary>
/// <param name="enCode"></param>
/// <returns></returns>
public async Task<DictionaryEntity> GetByEnCodAsynce(string enCode)
{
return await DbContext.GetSingleOrDefaultAsync<DictionaryEntity>(u => u.Code == enCode);
}
/// <summary>
/// 更新时判断分类编码是否存在(排除自己)
/// </summary>
/// <param name="enCode">分类编码</param
/// <param name="id">主键Id</param>
/// <returns></returns>
public async Task<DictionaryEntity> GetByEnCodAsynce(string enCode, long id)
{
return await DbContext.GetSingleOrDefaultAsync<DictionaryEntity>(u => u.Code == enCode && u.Id != id);
}
}
}