/// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="queryParam"></param>
        /// <returns></returns>
        public new QueryResult <SysMenuDto> Query(SysMenuQueryParam queryParam)
        {
            QueryResult <SysMenuDto> result = new QueryResult <SysMenuDto>();
            var r = SysMenuRepository.Query(queryParam);

            result.List  = QueryLevelMenus(r.List);
            result.Total = r.Total;
            return(result);
        }
Example #2
0
        public override async Task <MessageModel <bool> > AddOne(SysMenu saveModel)
        {
            MessageModel <int> messageModel = MessageModel <int> .Fail();

            //新增前验证
            base.AddOnExecute = async(SysMenu save) =>
            {
                //List<SysMenu> sysMenus = await _dal.Query(x => x.MenuId.Equals(save.MenuId) && x.ParentId.Equals(save.ParentId) );
                List <SysMenu> sysMenus = await _dal.Query(x => x.MenuId.Equals(save.MenuId));

                if (sysMenus != null && sysMenus.Count > 0)
                {
                    return(MessageModel <bool> .Fail(false, "已经存在该菜单"));
                }

                return(MessageModel <bool> .Success(true));
            };

            return(await base.AddOne(saveModel));
        }