Exemple #1
0
        /// <summary>
        /// 加载列表
        /// </summary>
        public async Task <TableResp <BuilderTable> > Load(QueryBuilderTableListReq request)
        {
            var loginContext = _auth.GetCurrentUser();

            if (loginContext == null)
            {
                throw new CommonException("登录已过期", Define.INVALID_TOKEN);
            }

            var result = new TableResp <BuilderTable>();
            var objs   = UnitWork.Find <BuilderTable>(null);

            if (!string.IsNullOrEmpty(request.key))
            {
                objs = objs.Where(u => u.Id.Contains(request.key));
            }

            result.data = await objs.OrderBy(u => u.Id)
                          .Skip((request.page - 1) * request.limit)
                          .Take(request.limit).ToListAsync();

            result.count = await objs.CountAsync();

            return(result);
        }
Exemple #2
0
        /// <summary>
        /// 获取所有的角色
        /// 为了控制权限,通常只用于流程实例选择执行角色,其他地方请使用Load
        /// </summary>
        public async Task <TableResp <Role> > LoadAll(QueryRoleListReq request)
        {
            var result = new TableResp <Role>();
            var objs   = UnitWork.Find <Role>(null);

            if (!string.IsNullOrEmpty(request.key))
            {
                objs = objs.Where(u => u.Name.Contains(request.key));
            }

            result.data = await objs.OrderBy(u => u.Name)
                          .Skip((request.page - 1) * request.limit)
                          .Take(request.limit).ToListAsync();

            result.count = await objs.CountAsync();

            return(result);
        }
Exemple #3
0
        /// <summary>
        /// 加载列表
        /// </summary>
        public async Task <TableResp <BuilderTableColumn> > Load(QueryBuilderTableColumnListReq request)
        {
            if (string.IsNullOrEmpty(request.BuilderTableId))
            {
                throw new Exception($"缺少必要的参数BuilderTableId");
            }
            var result = new TableResp <BuilderTableColumn>();
            var objs   = UnitWork.Find <BuilderTableColumn>(u => u.TableId == request.BuilderTableId);

            if (!string.IsNullOrEmpty(request.key))
            {
                objs = objs.Where(u => u.ColumnName.Contains(request.key));
            }

            result.data = objs.OrderBy(u => u.ColumnName)
                          .Skip((request.page - 1) * request.limit)
                          .Take(request.limit).ToList();
            result.count = objs.Count();
            return(result);
        }