示例#1
0
        public async Task <List <RoleEntity> > GetPageList(RoleListParam param, Pagination pagination)
        {
            var expression = ListFilter(param);
            var list       = await this.BaseRepository().FindList(expression, pagination);

            return(list.ToList());
        }
示例#2
0
        public JsonResult List([FromUri] RoleListParam p)
        {
            var total = 0;
            var list  = bll.List(p, out total);

            return(base.List <Role>(total, list));
        }
示例#3
0
        private Expression <Func <RoleEntity, bool> > ListFilter(RoleListParam param)
        {
            var expression = LinqExtensions.True <RoleEntity>();

            if (param != null)
            {
                if (!string.IsNullOrEmpty(param.RoleName))
                {
                    expression = expression.And(t => t.RoleName.Contains(param.RoleName));
                }
                if (!string.IsNullOrEmpty(param.RoleIds))
                {
                    long[] roleIdArr = TextHelper.SplitToArray <long>(param.RoleIds, ',');
                    expression = expression.And(t => roleIdArr.Contains(t.Id.Value));
                }
                if (!string.IsNullOrEmpty(param.RoleName))
                {
                    expression = expression.And(t => t.RoleName.Contains(param.RoleName));
                }
                if (param.RoleStatus > -1)
                {
                    expression = expression.And(t => t.RoleStatus == param.RoleStatus);
                }
                if (!string.IsNullOrEmpty(param.StartTime.ParseToString()))
                {
                    expression = expression.And(t => t.BaseModifyTime >= param.StartTime);
                }
                if (!string.IsNullOrEmpty(param.EndTime.ParseToString()))
                {
                    param.EndTime = (param.EndTime.Value.ToString("yyyy-MM-dd") + " 23:59:59").ParseToDateTime();
                    expression    = expression.And(t => t.BaseModifyTime <= param.EndTime);
                }
            }
            return(expression);
        }
示例#4
0
        public async Task <TData <List <RoleEntity> > > GetPageListJson([FromQuery] RoleListParam param,
                                                                        [FromQuery] Pagination pagination)
        {
            var obj = await _roleBLL.GetPageList(param, pagination);

            return(obj);
        }
示例#5
0
        public async Task <IActionResult> GetPageListJson(RoleListRequest paramRequest)
        {
            RoleListParam param            = paramRequest.param;
            Pagination    pagination       = paramRequest.pagination;
            TData <List <RoleEntity> > obj = await sysRoleBLL.GetPageList(param, pagination);

            return(Json(obj));
        }
示例#6
0
        public async Task <TData <List <RoleEntity> > > GetList(RoleListParam param)
        {
            var obj = new TData <List <RoleEntity> >();

            obj.Data = await _roleService.GetList(param);

            obj.Tag = 1;
            return(obj);
        }
示例#7
0
        public async Task <TData <List <RoleEntity> > > GetPageList(RoleListParam param, Pagination pagination)
        {
            TData <List <RoleEntity> > obj = new TData <List <RoleEntity> >();

            obj.Result = await roleService.GetPageList(param, pagination);

            obj.TotalCount = pagination.TotalCount;
            obj.Tag        = 1;
            return(obj);
        }
示例#8
0
        public async Task <TData <List <RoleEntity> > > GetList(RoleListParam param)
        {
            TData <List <RoleEntity> > obj = new TData <List <RoleEntity> >();

            obj.Result = await roleService.GetList(param);

            obj.TotalCount = obj.Result.Count;
            obj.Tag        = 1;
            return(obj);
        }
示例#9
0
        public async Task <IActionResult> GetRoleName(RoleListParam param)
        {
            TData <string> obj  = new TData <string>();
            var            list = await sysRoleBLL.GetList(param);

            if (list.Tag == 1)
            {
                obj.Result = string.Join(",", list.Result.Select(p => p.RoleName));
                obj.Tag    = 1;
            }
            return(Json(obj));
        }
示例#10
0
        public async Task MultiSortTest()
        {
            RoleService   roleService   = new RoleService();
            RoleListParam roleListParam = new RoleListParam {
            };
            Pagination pagination       = new Pagination
            {
                Sort = "Id desc,RoleSort asc"
            };
            List <RoleEntity> list = await roleService.GetPageList(roleListParam, pagination);

            Assert.IsTrue(list[0].Id > list[1].Id);
        }
示例#11
0
        /// <summary>
        ///     带条件查询所有
        /// </summary>
        public async Task <List <RoleEntity> > GetList(RoleListParam param)
        {
            #region 查询条件

            var query = _roleEntityDB.AsQueryable();

            /*
             *
             */

            #endregion

            var data = await query.ToListAsync();

            return(data);
        }
示例#12
0
        /// <summary>
        ///     分页查询
        /// </summary>
        public async Task <List <RoleEntity> > GetPageList(RoleListParam param, Pagination pagination)
        {
            #region 查询条件

            var query = _roleEntityDB.AsQueryable();

            /*
             *
             */
            var data = await query.OrderByDescending(a => a.Id)
                       .ToPagedListAsync(pagination.PageIndex, pagination.PageSize);

            #endregion

            // 分页参数赋值
            pagination.TotalCount = data.TotalCount;
            return(data.Items.ToList());
        }
示例#13
0
        /// <summary>
        /// 列表
        /// </summary>
        /// <param name="p"></param>
        /// <param name="total"></param>
        /// <returns></returns>
        public IList <Role> List(RoleListParam p, out int total)
        {
            ICriterion query = Restrictions.Gt("Status", -1);

            // 编码、名称
            if (!string.IsNullOrEmpty(p.Name))
            {
                var query1 = Restrictions.Like("Code", p.Name, MatchMode.Anywhere);
                var query2 = Restrictions.Like("Name", p.Name, MatchMode.Anywhere);
                var query3 = Restrictions.Or(query1, query2);
                query = Restrictions.And(query, query3);
            }

            // 状态
            if (p.Status != null)
            {
                var query1 = Restrictions.Eq("Status", p.Status);
                query = Restrictions.And(query, query1);
            }

            var list = dal.List(p.firstResult, p.maxResults, out total);

            return(list);
        }
示例#14
0
        public async Task <IActionResult> GetPageListJson(RoleListParam param, Pagination pagination)
        {
            TData <List <RoleEntity> > obj = await sysRoleBLL.GetPageList(param, pagination);

            return(Json(obj));
        }
示例#15
0
        public async Task <IActionResult> GetListJson(RoleListParam param)
        {
            TData <List <RoleEntity> > obj = await roleBLL.GetList(param);

            return(Json(obj));
        }
示例#16
0
        public async Task <TData <List <RoleEntity> > > GetListJson([FromQuery] RoleListParam param)
        {
            var obj = await _roleBLL.GetList(param);

            return(obj);
        }