@@ -363,16 +363,45 @@ public static IList<JobTask> FindAllByDataTime(DateTime dataTime)
363363 }
364364 #endregion
365365
366+ #region 高级查询
367+ /// <summary>高级查询</summary>
368+ /// <param name="appId">应用</param>
369+ /// <param name="jobId">作业</param>
370+ /// <param name="client">客户端。IP加进程</param>
371+ /// <param name="status">状态</param>
372+ /// <param name="createTime">创建时间</param>
373+ /// <param name="updateTime">更新时间</param>
374+ /// <param name="start">数据时间开始</param>
375+ /// <param name="end">数据时间结束</param>
376+ /// <param name="key">关键字</param>
377+ /// <param name="page">分页参数信息。可携带统计和数据权限扩展查询等信息</param>
378+ /// <returns>实体列表</returns>
379+ public static IList < JobTask > Search ( Int32 appId , Int32 jobId , String client , JobStatus status , DateTime createTime , DateTime updateTime , DateTime start , DateTime end , String key , PageParameter page )
380+ {
381+ var exp = new WhereExpression ( ) ;
382+
383+ if ( appId >= 0 ) exp &= _ . AppID == appId ;
384+ if ( jobId >= 0 ) exp &= _ . JobID == jobId ;
385+ if ( ! client . IsNullOrEmpty ( ) ) exp &= _ . Client == client ;
386+ if ( status >= 0 ) exp &= _ . Status == status ;
387+ exp &= _ . DataTime . Between ( start , end ) ;
388+ if ( ! key . IsNullOrEmpty ( ) ) exp &= SearchWhereByKeys ( key ) ;
389+
390+ return FindAll ( exp , page ) ;
391+ }
392+ #endregion
393+
366394 #region 数据清理
367395 /// <summary>清理指定时间段内的数据</summary>
368396 /// <param name="start">开始时间。未指定时清理小于指定时间的所有数据</param>
369397 /// <param name="end">结束时间</param>
398+ /// <param name="maximumRows">最大删除行数。清理历史数据时,避免一次性删除过多导致数据库IO跟不上,0表示所有</param>
370399 /// <returns>清理行数</returns>
371- public static Int32 DeleteWith ( DateTime start , DateTime end )
400+ public static Int32 DeleteWith ( DateTime start , DateTime end , Int32 maximumRows = 0 )
372401 {
373402 if ( start == end ) return Delete ( _ . DataTime == start ) ;
374403
375- return Delete ( _ . DataTime . Between ( start , end ) ) ;
404+ return Delete ( _ . DataTime . Between ( start , end ) , maximumRows ) ;
376405 }
377406 #endregion
378407
0 commit comments