/// <summary> /// 获取日志总记录数 /// </summary> /// <param name="QueryCondition"></param> /// <returns></returns> public int GetJobLogCount(SchedulerLogModel logModel) { using (IDbConnection connection = new SqlConnection(DBConnectionStringConfig.Default.JMGGConnectionString)) { DynamicParameters dp = new DynamicParameters(); StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append(" SELECT COUNT(1) FROM SchedulerLog rclf WITH(NOLOCK) WHERE 1=1 "); if (logModel.Status >= 0) { sqlQuery.Append(" AND rclf.Status=@Status "); dp.Add("@Status", logModel.Status, DbType.Int32, ParameterDirection.Input); } if (!string.IsNullOrEmpty(logModel.JobName)) { sqlQuery.Append(" AND rclf.JobName=@JobName "); dp.Add("@JobName", logModel.JobName, DbType.String, ParameterDirection.Input); } if (!string.IsNullOrEmpty(logModel.StartTime)) { sqlQuery.Append(" AND rclf.CreateTime>=@StartTime "); dp.Add("@StartTime", logModel.StartTime, DbType.String, ParameterDirection.Input); } if (!string.IsNullOrEmpty(logModel.EndTime)) { sqlQuery.Append(" AND rclf.CreateTime<=@EndTime "); dp.Add("@EndTime", logModel.EndTime, DbType.String, ParameterDirection.Input); } return(connection.ExecuteScalar <int>(sqlQuery.ToString(), dp)); } }
/// <summary> /// 获取日志分页数据 /// </summary> /// <param name="QueryCondition"></param> /// <returns></returns> public List <SchedulerLogModel> QueryListByLogPage(SchedulerLogModel logModel) { using (IDbConnection connection = new SqlConnection(DBConnectionStringConfig.Default.JMGGConnectionString)) { DynamicParameters dp = new DynamicParameters(); StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append(" SELECT * FROM SchedulerLog rclf WITH(NOLOCK) WHERE 1=1 "); if (logModel.Status >= 0) { sqlQuery.Append(" AND rclf.Status=@Status "); dp.Add("@Status", logModel.Status, DbType.Int32, ParameterDirection.Input); } if (!string.IsNullOrEmpty(logModel.JobName)) { sqlQuery.Append(" AND rclf.JobName=@JobName "); dp.Add("@JobName", logModel.JobName, DbType.String, ParameterDirection.Input); } if (!string.IsNullOrEmpty(logModel.StartTime)) { sqlQuery.Append(" AND rclf.CreateTime>=@StartTime "); dp.Add("@StartTime", logModel.StartTime, DbType.String, ParameterDirection.Input); } if (!string.IsNullOrEmpty(logModel.EndTime)) { sqlQuery.Append(" AND rclf.CreateTime<=@EndTime "); dp.Add("@EndTime", logModel.EndTime, DbType.String, ParameterDirection.Input); } sqlQuery.Append(" ORDER BY rclf.ID DESC "); sqlQuery.Append(" OFFSET (@PageSize * (@PageIndex -1)) ROWS FETCH NEXT @PageSize ROWS ONLY "); dp.Add("@PageSize", logModel.PageSize, DbType.Int32, ParameterDirection.Input); dp.Add("@PageIndex", logModel.PageIndex, DbType.Int32, ParameterDirection.Input); return(connection.Query <SchedulerLogModel>(sqlQuery.ToString(), dp).ToList()); } }
/// <summary> /// 获取日志分页数据 /// </summary> /// <param name="QueryScheduler"></param> /// <returns></returns> public List<SchedulerLogModel> QueryListByLogPage(SchedulerLogModel QueryScheduler) { return schedulerDal.QueryListByLogPage(QueryScheduler); }
/// <summary> /// 获取日志总记录数 /// </summary> /// <param name="QueryScheduler"></param> /// <returns></returns> public int GetJobLogCount(SchedulerLogModel QueryScheduler) { return schedulerDal.GetJobLogCount(QueryScheduler); }