diff --git a/Yi.Framework/Yi.Framework.Interface/IMenuService.cs b/Yi.Framework/Yi.Framework.Interface/IMenuService.cs index 2b603862..cc13c920 100644 --- a/Yi.Framework/Yi.Framework.Interface/IMenuService.cs +++ b/Yi.Framework/Yi.Framework.Interface/IMenuService.cs @@ -40,5 +40,17 @@ namespace Yi.Framework.Interface /// /// Task SetMouldByMenu(int mouldId,int menuId); + /// + /// 添加菜单 + /// + /// + /// + Task AddMenu(menu _menu); + /// + /// 添加子菜单 + /// + /// + /// + Task AddChildrenMenu(menu _menu); } } diff --git a/Yi.Framework/Yi.Framework.Interface/IRoleService.cs b/Yi.Framework/Yi.Framework.Interface/IRoleService.cs index 6d9a47a7..943ae5c5 100644 --- a/Yi.Framework/Yi.Framework.Interface/IRoleService.cs +++ b/Yi.Framework/Yi.Framework.Interface/IRoleService.cs @@ -33,6 +33,12 @@ namespace Yi.Framework.Interface /// /// Task SetMenusByRolesId(List menuIds, int roleId); + /// + /// 添加角色 + /// + /// + /// + Task AddRole(role _role); } } diff --git a/Yi.Framework/Yi.Framework.Interface/IUserService.cs b/Yi.Framework/Yi.Framework.Interface/IUserService.cs index ccc67e8a..ba356f07 100644 --- a/Yi.Framework/Yi.Framework.Interface/IUserService.cs +++ b/Yi.Framework/Yi.Framework.Interface/IUserService.cs @@ -52,5 +52,6 @@ namespace Yi.Framework.Interface /// /// Task SetRolesByUserId(List roleIds,int userId); + } } diff --git a/Yi.Framework/Yi.Framework.Service/MenuService.cs b/Yi.Framework/Yi.Framework.Service/MenuService.cs index 275968ed..27b01c3c 100644 --- a/Yi.Framework/Yi.Framework.Service/MenuService.cs +++ b/Yi.Framework/Yi.Framework.Service/MenuService.cs @@ -13,6 +13,27 @@ namespace Yi.Framework.Service { public MenuService(DbContext Db) : base(Db) { } + public async Task 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 AddMenu(menu _menu) + { + var menu_data = await GetEntityById(_menu.id); + if (menu_data == null) + { + return false; + } + return await AddAsync(_menu); + } + public async Task DelListByUpdateAsync(List _ids) { var menuList = await GetEntitiesAsync(u=>_ids.Contains(u.id)); diff --git a/Yi.Framework/Yi.Framework.Service/RoleService.cs b/Yi.Framework/Yi.Framework.Service/RoleService.cs index a51873bc..79a62af8 100644 --- a/Yi.Framework/Yi.Framework.Service/RoleService.cs +++ b/Yi.Framework/Yi.Framework.Service/RoleService.cs @@ -15,6 +15,16 @@ namespace Yi.Framework.Service { } + public async Task AddRole(role _role) + { + var role_data = await GetEntityById(_role.id); + if(role_data==null) + { + return false; + } + return await AddAsync(_role); + } + public async Task DelListByUpdateAsync(List _ids) { var userList = await GetEntitiesAsync(u=>_ids.Contains(u.id));