예제 #1
0
        /// <summary>
        /// 批量删除权限分组
        /// </summary>
        /// <param name="groupIds">分组编号</param>
        /// <returns></returns>
        public static Result RemoveAuthorityGroup(IEnumerable <long> groupIds)
        {
            #region 参数判断

            if (groupIds.IsNullOrEmpty())
            {
                return(Result.FailedResult("没有指定任何要删除的权限分组"));
            }

            #endregion

            //删除分组信息
            IQuery parentRemoveCondition = QueryFactory.Create();
            parentRemoveCondition.In <AuthorityGroupQuery>(r => r.SysNo, groupIds);
            authorityGroupRepository.Remove(parentRemoveCondition);
            //删除下级
            IQuery childQuery = QueryFactory.Create();
            childQuery.In <AuthorityGroupQuery>(r => r.Parent, groupIds);
            childQuery.AddQueryFields <AuthorityGroupQuery>(r => r.SysNo);
            List <AuthorityGroup> authorityGroupList = authorityGroupRepository.GetList(childQuery);
            if (authorityGroupList.IsNullOrEmpty())
            {
                return(Result.SuccessResult("没有需要删除的下级分组"));
            }
            RemoveAuthorityGroup(authorityGroupList.Select(r => r.SysNo));
            return(Result.SuccessResult("删除成功"));
        }
예제 #2
0
        /// <summary>
        /// 修改下级分组
        /// </summary>
        void ModifyChildAuthorityGroupParentGroup()
        {
            if (IsNew)
            {
                return;
            }
            IQuery query = QueryFactory.Create <AuthorityGroupQuery>(r => r.Parent == SysNo);
            List <AuthorityGroup> childGroupList = authorityGroupRepository.GetList(query);

            foreach (var group in childGroupList)
            {
                group.SetParentGroup(this);
                group.Save();
            }
        }
예제 #3
0
        /// <summary>
        /// 获取权限分组列表
        /// </summary>
        /// <param name="query">查询对象</param>
        /// <returns></returns>
        public List <AuthorityGroup> GetAuthorityGroupList(IQuery query)
        {
            var authorityGroupList = authorityGroupRepository.GetList(query);

            return(authorityGroupList);
        }