Esempio n. 1
0
        public Task <IEnumerable <dynamic> > GetByConditions(string tableName, ISelectRequest request)
        {
            var whereSql = _pageSqlHelper.OutDefaultParams(request.Queries, out var whereParams);

            var sql =
                $"SELECT * FROM {tableName} WHERE 1=1 {whereSql} {request.Sort?.ToSql()} {(request.TopCount > 0 ? $"limit 0,{request.TopCount}" : "")} ";

            return(Connection().QueryAsync(sql, whereParams));
        }
Esempio n. 2
0
        public async Task <IEnumerable <dynamic> > GetByConditions(ISelectRequest request)
        {
            var columnField = request.GetQueryField("columnNum");

            if (columnField == null || columnField.Value.ToStr().IsEmpty())
            {
                return(null);
            }

            var cm = await _columnService.GetModelByNum(columnField.Value.ToStr());

            if (cm == null)
            {
                return(null);
            }

            return(await GetByConditions(cm?.ModelTable.SqlTableName, request));
        }
Esempio n. 3
0
        public async Task <ContentData> GetFirstByColumnNum(string columnNum, ISelectRequest request)
        {
            var columnModel = await _columnService.GetModelByNum(columnNum);

            if (columnModel == null)
            {
                return(null);
            }

            request?.Queries.Add(new DefaultQuery(columnNum, new DefaultQuerySql("ColumnNum")));

            var list = (await _dapper.GetByConditions(columnModel?.ModelTable.SqlTableName, request)).ToList();

            if (list.Count > 0)
            {
                return(list[0] != null ? new ContentData(list[0]) : null);
            }
            return(null);
        }
Esempio n. 4
0
 public Task <IEnumerable <dynamic> > GetByConditions(string tableName, ISelectRequest request)
 {
     return(_dapper.GetByConditions(tableName, request));
 }