去掉多余代码
This commit is contained in:
parent
0541f5d08d
commit
0f9ab916fa
|
|
@ -4,7 +4,6 @@ using langguanApi.Model.Dto.SystemConfigurationDto;
|
|||
using langguanApi.Model;
|
||||
using langguanApi.Model.Entity;
|
||||
using langguanApi.Model.SystemConfigurationEntity;
|
||||
using StackExchange.Redis;
|
||||
using Mapster;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System.Linq.Expressions;
|
||||
|
|
@ -14,6 +13,9 @@ using System.Collections.Generic;
|
|||
|
||||
namespace langguanApi.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 校色服务
|
||||
/// </summary>
|
||||
[ServiceInjection(InjectionType.Transient)]
|
||||
public class RoleService : BaseService<Role>
|
||||
{
|
||||
|
|
@ -105,8 +107,8 @@ namespace langguanApi.Service
|
|||
/// <returns></returns>
|
||||
public async Task<bool> Exist(RoleDto input)
|
||||
{
|
||||
var entity = input.Adapt<UserRole>();
|
||||
Expression<Func<UserRole, bool>> exp = filter => filter.RoleName == entity.RoleName;
|
||||
var entity = input.Adapt<Role>();
|
||||
Expression<Func<Role, bool>> exp = filter => filter.RoleName == entity.RoleName;
|
||||
return await base.Exist(exp);
|
||||
}
|
||||
/// <summary>
|
||||
|
|
@ -120,7 +122,7 @@ namespace langguanApi.Service
|
|||
{
|
||||
return new ApiResult { code = 1, msg = $"{input.RoleName}的角色已存在" };
|
||||
}
|
||||
var entity = input.Adapt<UserRole>();
|
||||
var entity = input.Adapt<Role>();
|
||||
if (entity != null)
|
||||
{
|
||||
await base.CreateAsync(entity);
|
||||
|
|
@ -133,9 +135,9 @@ namespace langguanApi.Service
|
|||
/// </summary>
|
||||
/// <param name="ids"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<UserRole>> GetRoleListByIds(IEnumerable<string> ids)
|
||||
public async Task<List<Role>> GetRoleListByIds(IEnumerable<string> ids)
|
||||
{
|
||||
Expression<Func<UserRole, bool>> exp = filter => ids.Contains(filter.Id) && filter.IsDelete == false;
|
||||
Expression<Func<Role, bool>> exp = filter => ids.Contains(filter.Id) && filter.IsDelete == false;
|
||||
var list = (await base.GetListWithExp(exp)).ToList();
|
||||
return list;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -186,18 +186,6 @@ namespace langguanApi.Service
|
|||
{
|
||||
exp = filter => filter.Username.Contains(input.Username);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.Tel))
|
||||
{
|
||||
exp = filter => filter.Tel.Contains(input.Tel);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.HiredateStart))
|
||||
{
|
||||
exp = filter => filter.Hiredate.Value >= DateTime.Parse(input.HiredateStart);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(input.HiredateEnd))
|
||||
{
|
||||
exp = filter => filter.Hiredate.Value <= DateTime.Parse(input.HiredateEnd);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取数据
|
||||
|
|
@ -211,17 +199,8 @@ namespace langguanApi.Service
|
|||
list.Add(new UserListDto
|
||||
{
|
||||
Username = item.Username,
|
||||
Education = item.Education,
|
||||
Tel = item.Tel,
|
||||
Email = item.Email,
|
||||
roleName = roleList.FirstOrDefault(s => s.Id == item.roleId)?.RoleName,
|
||||
Sex = item.Sex == 0 ? "男" : "女",
|
||||
Address = item.Address,
|
||||
IsAdmin = item.IsAdmin == 0 ? "否" : "是",
|
||||
Native = item.Native,
|
||||
University = item.University,
|
||||
Hiredate = item.Hiredate.HasValue == true ? item.Hiredate.Value.ToString("yyyy-MM-dd") : "",
|
||||
Brithday = item.Brithday.HasValue == true ? item.Brithday.Value.ToString("yyyy-MM-dd") : "",
|
||||
});
|
||||
}
|
||||
#endregion
|
||||
|
|
|
|||
Loading…
Reference in New Issue