public Tuple <List <AtomLoggerModel>, long> GetLogList(AtomLoggerModel request) { var where = new StringBuilder(" where 1=1 "); if (!string.IsNullOrWhiteSpace(request.LogType)) { where.AppendFormat(" and LogType='{0}'", request.LogType); } if (request.LogLevel != 0) { where.AppendFormat(" and LogLevel={0}", request.LogLevel); } if (request.StartTime.HasValue) { where.AppendFormat(" and AddTime>='{0}'", request.StartTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); } if (request.EndTime.HasValue) { where.AppendFormat(" and AddTime<='{0}'", request.EndTime.Value.ToString("yyyy-MM-dd HH:mm:ss")); } if (!string.IsNullOrWhiteSpace(request.LogUser)) { where.AppendFormat(" and LogUser='******'", request.LogUser); } if (!string.IsNullOrWhiteSpace(request.LogUrl)) { where.AppendFormat(" and LogUrl like '%{0}%'", request.LogUrl); } if (!string.IsNullOrWhiteSpace(request.LogTxt)) { where.AppendFormat(" and LogTxt like '%{0}%'", request.LogTxt); } var sql = $@" with cte as (select ROW_NUMBER() over (order by AddTime desc) NumId,* from AtomLogger {where} )"; var sqlCnt = $"{sql} select count(1) NumId from cte "; var sqlData = $"{sql} select top {request.PageSize} * from cte where NumId>{(request.PageIndex-1)*request.PageSize}"; var cnt = SonFact.Cur.ExecuteQuery <AtomLoggerModel>(sqlCnt).First(); var data = SonFact.Cur.ExecuteQuery <AtomLoggerModel>(sqlData); return(new Tuple <List <AtomLoggerModel>, long>(data, cnt.NumId)); }
public Tuple <List <AtomLoggerModel>, long> GetLogList(AtomLoggerModel request) { var result = Logmgt.GetLogList(request); return(result); }
public Br <List <AtomLoggerModel> > Logs([FromBody] AtomLoggerModel model) { var result = logger.GetLogList(model); return(new Br <List <AtomLoggerModel> >(result.Item1, extData: result.Item2)); }