添加接口实现接口

This commit is contained in:
lzw
2021-10-12 22:19:53 +08:00
parent d159cce849
commit 17f632298f
5 changed files with 50 additions and 0 deletions

View File

@@ -40,5 +40,17 @@ namespace Yi.Framework.Interface
/// <param name="menuId"></param>
/// <returns></returns>
Task<bool> SetMouldByMenu(int mouldId,int menuId);
/// <summary>
/// 添加菜单
/// </summary>
/// <param name="_menu"></param>
/// <returns></returns>
Task<bool> AddMenu(menu _menu);
/// <summary>
/// 添加子菜单
/// </summary>
/// <param name="_menu"></param>
/// <returns></returns>
Task<bool> AddChildrenMenu(menu _menu);
}
}

View File

@@ -33,6 +33,12 @@ namespace Yi.Framework.Interface
/// <param name="menuId"></param>
/// <returns></returns>
Task<bool> SetMenusByRolesId(List<int> menuIds, int roleId);
/// <summary>
/// 添加角色
/// </summary>
/// <param name="_role"></param>
/// <returns></returns>
Task<bool> AddRole(role _role);
}
}

View File

@@ -52,5 +52,6 @@ namespace Yi.Framework.Interface
/// <param name="userId"></param>
/// <returns></returns>
Task<bool> SetRolesByUserId(List<int> roleIds,int userId);
}
}

View File

@@ -13,6 +13,27 @@ namespace Yi.Framework.Service
{
public MenuService(DbContext Db) : base(Db) { }
public async Task<bool> AddChildrenMenu(menu _menu)
{
var menu_data = await GetEntity(u=>u.id==_menu.id&& u.is_delete == (short)Common.Enum.DelFlagEnum.Normal);
if (menu_data == null)
{
return false;
}
menu_data.children.Add(new menu()) ;
return await AddAsync(_menu);
}
public async Task<bool> AddMenu(menu _menu)
{
var menu_data = await GetEntityById(_menu.id);
if (menu_data == null)
{
return false;
}
return await AddAsync(_menu);
}
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var menuList = await GetEntitiesAsync(u=>_ids.Contains(u.id));

View File

@@ -15,6 +15,16 @@ namespace Yi.Framework.Service
{
}
public async Task<bool> AddRole(role _role)
{
var role_data = await GetEntityById(_role.id);
if(role_data==null)
{
return false;
}
return await AddAsync(_role);
}
public async Task<bool> DelListByUpdateAsync(List<int> _ids)
{
var userList = await GetEntitiesAsync(u=>_ids.Contains(u.id));