/// <summary> /// 获取角色权限对应关系 /// </summary> /// <param name="roleEntity"></param> /// <param name="privilegEntity"></param> /// <returns></returns> public SystemPrivilegeInRolesEntity GetRelationByRoleAndPrivilege(SystemRoleEntity roleEntity, SystemPrivilegeEntity privilegEntity) { NHibernateDynamicQueryGenerator <SystemPrivilegeInRolesEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_ROLEID.Eq(roleEntity)); dynamicQueryGenerator.AddWhereClause(PROPERTY_PRIVILEGEID.Eq(privilegEntity)); return(FindSingleEntityByQueryBuilder(dynamicQueryGenerator)); }
public bool RolesHasPermission(List <SystemRoleEntity> roleEntities, SystemPrivilegeEntity permission) { NHibernateDynamicQueryGenerator <SystemPrivilegeInRolesEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_ROLEID.In(roleEntities)); dynamicQueryGenerator.AddWhereClause(PROPERTY_PRIVILEGEID.Eq(permission)); List <SystemPrivilegeInRolesEntity> list = FindListByQueryBuilder(dynamicQueryGenerator); return(list != null && list.Count > 0); }