Пример #1
0
        public virtual List <TDbModel> SearchRawSignalByCdrIndex(DateTime dateTime, long cdrIndex, System.Threading.CancellationToken token)
        {
            var    tableNames = new List <String>();
            string tableName  = RawSignalDbService.TableName;
            //查询前后的一张表的数据记录,共三张表
            string tableName0 = tableName + dateTime.AddDays(-1).ToString(FixedParamsPub.TIME_FORMAT_YMD);

            tableNames.Add(tableName0);
            string tableName1 = tableName + dateTime.ToString(FixedParamsPub.TIME_FORMAT_YMD);

            tableNames.Add(tableName1);
            if (dateTime.Date < DateTime.Now.Date)
            {
                string tableName2 = tableName + dateTime.AddDays(1).ToString(FixedParamsPub.TIME_FORMAT_YMD);
                tableNames.Add(tableName2);
            }
            var sb = new StringBuilder();

            sb.Append(string.Format("where {0}={1} ", RawSignalCdrIndexKeyword(), cdrIndex));

            string rawSignalSqlTablePart = RawSignalDbService.SqlTablePart;
            int    totalCount;
            var    tableNamesDic = SqlHelper.GetTablesCount(tableNames, sb.ToString(), token, out totalCount);

            tableNamesDic = tableNamesDic ?? new Dictionary <string, int>();
            tableNames    = tableNamesDic.Keys.ToList();
            List <int> totalCountList = tableNamesDic.Values.ToList();

            return(SearchDataService.SearchAllData(tableNames, totalCountList, SqlTablePart, sb.ToString(), totalCount, SearchRawSignalMappedResults, token));
        }
Пример #2
0
 /// <summary>
 /// 分页查询数据
 /// </summary>
 /// <param name="tableNames">待查询表集合</param>
 /// <param name="totalCountList">待查询表对应的数量</param>
 /// <param name="sqlWherePart">查询条件部分,即从"where"起及之后的部分</param>
 /// <param name="totalCount">查询总数</param>
 /// <param name="lineNum">每页数量</param>
 /// <param name="pageNum">页数</param>
 /// <param name="token">token</param>
 /// <returns></returns>
 public List <T> SearchDataForPager(List <string> tableNames, List <int> totalCountList, string sqlWherePart, int totalCount, int lineNum, int pageNum, CancellationToken token)
 {
     return(SearchDataService.SearchDataForPager(tableNames, totalCountList, SqlTablePart, sqlWherePart, totalCount, lineNum, pageNum, SearchMappedResults, token));
 }
Пример #3
0
        public virtual List <T> SearchMappedResults(MySqlConnection conn, string strSql)
        {
            var list = SearchDataService.SearchData <T>(conn, strSql);

            return(list == null ? null : list.ToList());
        }