master_sxs_new #1
|
|
@ -17,27 +17,7 @@ namespace langguanApi.Controllers
|
||||||
{
|
{
|
||||||
_meuaService = meauService;
|
_meuaService = meauService;
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// 获取菜单列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpGet("GetMenuList")]
|
|
||||||
public async Task<IActionResult> GetMenuList([FromQuery] reqpage input)
|
|
||||||
{
|
|
||||||
var result = await _meuaService.GetMeauList(input);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 新增菜单
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("AddMeau")]
|
|
||||||
public async Task<IActionResult> AddMeau([FromBody] MeauDto input)
|
|
||||||
{
|
|
||||||
var result = await _meuaService.AddMeau(input);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -90,16 +90,6 @@ namespace langguanApi.Controllers
|
||||||
Select(s => new { s.Id, s.RoleName })
|
Select(s => new { s.Id, s.RoleName })
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
///新增角色
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
[HttpPost("AddRole")]
|
|
||||||
public async Task<IActionResult> AddRole([FromBody] RoleDto input)
|
|
||||||
{
|
|
||||||
var result = await _roleService.AddRole(input);
|
|
||||||
return Ok(result);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,32 +0,0 @@
|
||||||
namespace langguanApi.Model.SystemConfigurationEntity
|
|
||||||
{
|
|
||||||
//菜单实体类
|
|
||||||
public class Meau : BaseModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 父菜单ID 默认首页为1级,有组织为2级,无组织为2级,下面的子菜单为3级
|
|
||||||
/// </summary>
|
|
||||||
public string ParentId { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 菜单编码
|
|
||||||
/// </summary>
|
|
||||||
public string MenuCode { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 菜单名称
|
|
||||||
/// </summary>
|
|
||||||
public string MenuName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 可空,菜单跳转路径
|
|
||||||
/// </summary>
|
|
||||||
public string Url { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 排序
|
|
||||||
/// </summary>
|
|
||||||
public int Sort { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否激活
|
|
||||||
/// </summary>
|
|
||||||
public bool IsActive { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
namespace langguanApi.Model.SystemConfigurationEntity
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 角色实体类
|
|
||||||
/// </summary>
|
|
||||||
public class UserRole : BaseModel
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// 角色名称
|
|
||||||
/// </summary>
|
|
||||||
public string RoleName { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 多个菜单用,隔开
|
|
||||||
/// </summary>
|
|
||||||
public string Meaus { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 是否管理员
|
|
||||||
/// </summary>
|
|
||||||
public bool IsAdmin { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
/// 角色描述
|
|
||||||
/// </summary>
|
|
||||||
public string Description { get; set; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using langguanApi.Extensions.AutoDI;
|
using langguanApi.Extensions.AutoDI;
|
||||||
using langguanApi.Model;
|
using langguanApi.Model;
|
||||||
using langguanApi.Model.Dto.SystemConfigurationDto;
|
using langguanApi.Model.Dto.SystemConfigurationDto;
|
||||||
using langguanApi.Model.SystemConfigurationEntity;
|
using langguanApi.Model.Entity;
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
||||||
|
|
@ -11,62 +11,12 @@ namespace langguanApi.Service
|
||||||
/// 菜单服务
|
/// 菜单服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ServiceInjection(InjectionType.Transient)]
|
[ServiceInjection(InjectionType.Transient)]
|
||||||
public class MeauService : BaseService<Meau>
|
public class MeauService : BaseService<Menu>
|
||||||
{
|
{
|
||||||
public MeauService(IConfiguration config) : base(config, nameof(Meau))
|
public MeauService(IConfiguration config) : base(config, nameof(Menu))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 获取菜单列表
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<object> GetMeauList(reqpage input)
|
|
||||||
{
|
|
||||||
Expression<Func<Meau, bool>> exp = filter =>filter.IsDelete == false;
|
|
||||||
if (!string.IsNullOrEmpty(input.key))
|
|
||||||
{
|
|
||||||
exp=filter => filter.MenuName.Contains(input.key);
|
|
||||||
}
|
|
||||||
return await base.GetPager(new ReqPaing()
|
|
||||||
{
|
|
||||||
pageSize = input.pageSize,
|
|
||||||
current = input.current
|
|
||||||
}, exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 新加
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<ApiResult> AddMeau(MeauDto input)
|
|
||||||
{
|
|
||||||
if (await Exist(input))
|
|
||||||
{
|
|
||||||
return new ApiResult { code = 1, msg = $"{input.MenuName}的菜单已存在" };
|
|
||||||
}
|
|
||||||
var entity = input.Adapt<Meau>();
|
|
||||||
if (entity != null)
|
|
||||||
{
|
|
||||||
await base.CreateAsync(entity);
|
|
||||||
return new ApiResult { code = 0, msg = "" };
|
|
||||||
}
|
|
||||||
return new ApiResult { code = 1, msg = "菜单添加失败" }; ;
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 是否存在
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<bool> Exist(MeauDto input)
|
|
||||||
{
|
|
||||||
var entity = input.Adapt<MeauDto>();
|
|
||||||
Expression<Func<Meau, bool>> exp = filter => filter.MenuName == entity.MenuName;
|
|
||||||
return await base.Exist(exp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@ using langguanApi.Extensions.AutoDI;
|
||||||
using langguanApi.Model.Dto.SystemConfigurationDto;
|
using langguanApi.Model.Dto.SystemConfigurationDto;
|
||||||
using langguanApi.Model;
|
using langguanApi.Model;
|
||||||
using langguanApi.Model.Entity;
|
using langguanApi.Model.Entity;
|
||||||
using langguanApi.Model.SystemConfigurationEntity;
|
|
||||||
using Mapster;
|
using Mapster;
|
||||||
using NPOI.SS.Formula.Functions;
|
using NPOI.SS.Formula.Functions;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
|
|
@ -14,7 +13,7 @@ using System.Collections.Generic;
|
||||||
namespace langguanApi.Service
|
namespace langguanApi.Service
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 校色服务
|
/// 角色服务
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ServiceInjection(InjectionType.Transient)]
|
[ServiceInjection(InjectionType.Transient)]
|
||||||
public class RoleService : BaseService<Role>
|
public class RoleService : BaseService<Role>
|
||||||
|
|
@ -100,35 +99,15 @@ namespace langguanApi.Service
|
||||||
}, exp);
|
}, exp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region 用户管理角色相关
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户是否存在
|
/// 根据id获取角色信息
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input"></param>
|
/// <param name="roleId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> Exist(RoleDto input)
|
public async Task<Role> GetRoleById(string roleId)
|
||||||
{
|
{
|
||||||
var entity = input.Adapt<Role>();
|
return await base.GetAsync(roleId);
|
||||||
Expression<Func<Role, bool>> exp = filter => filter.RoleName == entity.RoleName;
|
|
||||||
return await base.Exist(exp);
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
/// 新加角色
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<ApiResult> AddRole(RoleDto input)
|
|
||||||
{
|
|
||||||
if (await Exist(input))
|
|
||||||
{
|
|
||||||
return new ApiResult { code = 1, msg = $"{input.RoleName}的角色已存在" };
|
|
||||||
}
|
|
||||||
var entity = input.Adapt<Role>();
|
|
||||||
if (entity != null)
|
|
||||||
{
|
|
||||||
await base.CreateAsync(entity);
|
|
||||||
return new ApiResult { code = 0, msg = "" };
|
|
||||||
}
|
|
||||||
return new ApiResult { code = 1, msg = "菜单添加失败" }; ;
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 根据Id,获取多个校色信息
|
/// 根据Id,获取多个校色信息
|
||||||
|
|
@ -141,17 +120,6 @@ namespace langguanApi.Service
|
||||||
var list = (await base.GetListWithExp(exp)).ToList();
|
var list = (await base.GetListWithExp(exp)).ToList();
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region 用户管理角色相关
|
|
||||||
/// <summary>
|
|
||||||
/// 根据id获取角色信息
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="roleId"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public async Task<Role> GetRoleById(string roleId)
|
|
||||||
{
|
|
||||||
return await base.GetAsync(roleId);
|
|
||||||
}
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue