public static void Delete(List <string> list) { using (var db = Pub.DB) { var sql = "delete from WF_M_ROLE where RoleId=@RoleId"; db.Execute(sql, list.Select(a => new { RoleId = a })); AuthLoader.DeleteAuthData(db, list); AuthLoader.DeleteAuthModule(db, list); } }
public static List <Menu1VM> GetConfig(string currentUserId) { var auth = AuthLoader.QueryAuthModuleByUserId(currentUserId); using (var db = Pub.DB) { var menu1List = WF_M_MENULoader.Query(null, null, "ROOT").Select(a => new Menu1VM() { id = a.MenuId, ModuleId = a.ModuleId, text = a.ModuleDisplayText.GetRes(), items = new List <Menu2VM>(), icon = a.Icon, collapsed = a.Expanded.GetValueOrDefault() == 1 ? false : true }).ToList(); Filter(menu1List, auth); foreach (var menu1 in menu1List) { // 查询一级菜单的子菜单 menu1.items = WF_M_MENULoader.Query(null, null, menu1.id).Select(a => new Menu2VM() { childs = new List <Menu2VM>(), href = a.ModuleLink, id = a.MenuId, ModuleId = a.ModuleId, text = a.ModuleDisplayText.GetRes() }).ToList(); Filter(menu1.items, auth); foreach (var menu2 in menu1.items) { // 查询二级菜单的子菜单 menu2.childs = WF_M_MENULoader.Query(null, null, menu2.id).Select(a => new Menu2VM() { childs = new List <Menu2VM>(), href = a.ModuleLink, id = a.MenuId, ModuleId = a.ModuleId, text = a.ModuleDisplayText.GetRes() }).ToList(); Filter(menu2.childs, auth); } } return(menu1List); } }