Exemplo n.º 1
0
        public ContentResult datasourcelist(DataSourceQueryRequest request)
        {
            var data = _dataSourceService.List(request);
            var res  = new ResultDto <DataSourceResponse>
            {
                page    = request.PageIndex,
                total   = request.Total,
                records = request.Records,
                rows    = data
            };

            return(Content(res.Serialize()));
        }
Exemplo n.º 2
0
        public List <DataSourceResponse> List(DataSourceQueryRequest request)
        {
            List <DataSourceResponse> list = new List <DataSourceResponse>();

            try
            {
                StringBuilder join = new StringBuilder();
                if (request.Title.IsNotEmpty())
                {
                    request.Title = $"%{request.Title}%";
                    join.Append(" and title like @Title");
                }
                var sql        = $@"select * from t_sys_datasource where isdelete=0 {join.ToString()} order by createtime desc";
                int totalCount = 0;
                list            = _dbContext.Page <DataSourceResponse>(sql, out totalCount, request.PageIndex, request.PageSize, request);
                request.Records = totalCount;
            }
            catch (Exception ex)
            {
                LogUtils.LogError("DataSourceService.List", ex);
            }
            return(list);
        }