Esempio n. 1
0
        public ActionResult SearchAuthorityOperation(AuthorityOperationFilterDto filter)
        {
            var authorityOperationPaging = authService.GetAuthorityOperationPaging(filter).ConvertTo <AuthorityOperationViewModel>();
            var result = new
            {
                authorityOperationPaging.TotalCount,
                Datas = authorityOperationPaging.ToList()
            };

            return(Json(result));
        }
Esempio n. 2
0
 public ActionResult EditAuthorityOperation(EditAuthorityOperationViewModel authorityOperation, long groupSysNo = 0)
 {
     if (IsPost)
     {
         SaveAuthorityOperationCmdDto saveInfo = new SaveAuthorityOperationCmdDto()
         {
             AuthorityOperation = authorityOperation.MapTo <AuthorityOperationCmdDto>()
         };
         Result <AuthorityOperationDto> result = authService.SaveAuthorityOperation(saveInfo);
         var ajaxResult = AjaxResult.CopyFromResult(result);
         ajaxResult.SuccessClose = true;
         return(Json(ajaxResult));
     }
     else
     {
         if (authorityOperation.SysNo > 0)
         {
             AuthorityOperationFilterDto filter = new AuthorityOperationFilterDto()
             {
                 SysNos = new List <long>()
                 {
                     authorityOperation.SysNo
                 },
                 LoadGroup = true
             };
             authorityOperation = authService.GetAuthorityOperation(filter).MapTo <EditAuthorityOperationViewModel>();
             if (authorityOperation == null)
             {
                 return(Content("没有指定要操作的数据"));
             }
         }
         else if (groupSysNo > 0)
         {
             authorityOperation.Group = authService.GetAuthorityOperationGroup(new AuthorityOperationGroupFilterDto()
             {
                 SysNos = new List <long>()
                 {
                     groupSysNo
                 }
             })?.MapTo <EditAuthorityOperationGroupViewModel>();
         }
     }
     return(View(authorityOperation));
 }
Esempio n. 3
0
 /// <summary>
 /// 获取授权操作分页
 /// </summary>
 /// <param name="filter">查询对象</param>
 /// <returns></returns>
 public IPaging <AuthorityOperationDto> GetAuthorityOperationPaging(AuthorityOperationFilterDto filter)
 {
     return(authBusiness.GetAuthorityOperationPaging(filter));
 }
Esempio n. 4
0
 /// <summary>
 /// 获取授权操作列表
 /// </summary>
 /// <param name="filter">查询对象</param>
 /// <returns></returns>
 public List <AuthorityOperationDto> GetAuthorityOperationList(AuthorityOperationFilterDto filter)
 {
     return(authBusiness.GetAuthorityOperationList(filter));
 }
Esempio n. 5
0
 /// <summary>
 /// 获取授权操作
 /// </summary>
 /// <param name="filter">查询对象</param>
 /// <returns></returns>
 public AuthorityOperationDto GetAuthorityOperation(AuthorityOperationFilterDto filter)
 {
     return(authBusiness.GetAuthorityOperation(filter));
 }
Esempio n. 6
0
        /// <summary>
        /// 获取授权操作分页
        /// </summary>
        /// <param name="filter">查询对象</param>
        /// <returns></returns>
        public IPaging <AuthorityOperationDto> GetAuthorityOperationPaging(AuthorityOperationFilterDto filter)
        {
            var authorityOperationPaging = authorityOperationService.GetAuthorityOperationPaging(CreateAuthorityOperationQueryObject(filter));

            return(authorityOperationPaging.ConvertTo <AuthorityOperationDto>());
        }
Esempio n. 7
0
        /// <summary>
        /// 获取授权操作列表
        /// </summary>
        /// <param name="filter">查询对象</param>
        /// <returns></returns>
        public List <AuthorityOperationDto> GetAuthorityOperationList(AuthorityOperationFilterDto filter)
        {
            var authorityOperationList = authorityOperationService.GetAuthorityOperationList(CreateAuthorityOperationQueryObject(filter));

            return(authorityOperationList.Select(c => c.MapTo <AuthorityOperationDto>()).ToList());
        }
Esempio n. 8
0
        /// <summary>
        /// 获取授权操作
        /// </summary>
        /// <param name="filter">查询对象</param>
        /// <returns></returns>
        public AuthorityOperationDto GetAuthorityOperation(AuthorityOperationFilterDto filter)
        {
            var authorityOperation = authorityOperationService.GetAuthorityOperation(CreateAuthorityOperationQueryObject(filter));

            return(authorityOperation.MapTo <AuthorityOperationDto>());
        }
Esempio n. 9
0
        /// <summary>
        /// 根据授权操作查询条件生成查询对象
        /// </summary>
        /// <param name="filter">查询条件</param>
        /// <returns></returns>
        IQuery CreateAuthorityOperationQueryObject(AuthorityOperationFilterDto filter, bool useBaseFilter = false)
        {
            if (filter == null)
            {
                return(null);
            }
            IQuery query = null;

            if (useBaseFilter)
            {
                query = QueryFactory.Create <AuthorityOperationQuery>(filter);

                #region 数据筛选

                if (!filter.SysNos.IsNullOrEmpty())
                {
                    query.In <AuthorityOperationQuery>(c => c.SysNo, filter.SysNos);
                }
                if (!filter.OperationMateKey.IsNullOrEmpty())
                {
                    query.And <AuthorityOperationQuery>(QueryOperator.OR, CriteriaOperator.Like, filter.OperationMateKey, null, u => u.Name, u => u.ControllerCode, u => u.ActionCode);
                }
                if (!filter.ControllerCode.IsNullOrEmpty())
                {
                    query.Equal <AuthorityOperationQuery>(c => c.ControllerCode, filter.ControllerCode);
                }
                if (!filter.ActionCode.IsNullOrEmpty())
                {
                    query.Equal <AuthorityOperationQuery>(c => c.ActionCode, filter.ActionCode);
                }
                if (filter.Method.HasValue)
                {
                    query.Equal <AuthorityOperationQuery>(c => c.Method, filter.Method.Value);
                }
                if (!filter.Name.IsNullOrEmpty())
                {
                    query.Equal <AuthorityOperationQuery>(c => c.Name, filter.Name);
                }
                if (filter.Status.HasValue)
                {
                    query.Equal <AuthorityOperationQuery>(c => c.Status, filter.Status.Value);
                }
                if (filter.Sort.HasValue)
                {
                    query.Equal <AuthorityOperationQuery>(c => c.Sort, filter.Sort.Value);
                }
                if (filter.Group.HasValue)
                {
                    query.Equal <AuthorityOperationQuery>(c => c.Group, filter.Group.Value);
                }
                //if (filter.AuthorizeType.HasValue)
                //{
                //    query.Equal<AuthorityOperationQuery>(c => c.AuthorizeType, filter.AuthorizeType.Value);
                //}
                //if (!filter.Application.IsNullOrEmpty())
                //{
                //    query.Equal<AuthorityOperationQuery>(c => c.Application, filter.Application);
                //}
                if (!filter.Remark.IsNullOrEmpty())
                {
                    query.Equal <AuthorityOperationQuery>(c => c.Remark, filter.Remark);
                }

                #endregion

                #region 数据加载

                if (filter.LoadGroup)
                {
                    query.SetLoadPropertys <AuthorityOperation>(true, c => c.Group);
                }

                #endregion
            }
            else
            {
                if (filter is AuthorityBindOperationFilterDto)
                {
                    query = CreateAuthorityOperationQueryObject(filter as AuthorityBindOperationFilterDto);
                }
                else
                {
                    query = CreateAuthorityOperationQueryObject(filter, true);
                }
            }
            return(query);
        }