/// <summary> /// 模块角色维护,先删除本角色所有模块后批量新增 /// </summary> /// <param name="roleid"></param> /// <returns></returns> public bool AddModuleRole(string ids, string roleid) { bool blFlag = false; try { string[] strSql = new string[3]; //先删除 strSql[0] = " delete from bas_module_role where role_id=" + roleid; //插入子菜单 strSql[1] = " insert into bas_module_role(module_id,role_id) select distinct module_id," + roleid + " from bas_module where module_id in (" + ids + ")"; //插入主菜单 strSql[2] = " insert into bas_module_role(module_id,role_id) select distinct module_id," + roleid + " from bas_module where module_id in (select distinct module_father from bas_module where module_id in (" + ids + ") )"; blFlag = DataBase.Transaction(strSql); } catch (Exception exception) { throw exception; } return(blFlag); }