using Yw.DAL.SQLite; namespace HStation.DAL.SQLite { /// /// /// public partial class TransferRevitFile : BaseDAL, ITransferRevitFile { /// /// /// public override ConnectionConfig ConnectionConfig { get { return ConfigHelper.SQLiteConnectionConfig; } } /// /// 获取模糊列表 /// public List GetFluzzyList ( string fileName, string fileCode, string fileSuffix, string uploadUserName, DateTime? startTime, DateTime? endTime ) { var exp = Expressionable.Create(); exp.AndIF(!string.IsNullOrEmpty(fileName), x => x.FileName.Contains(fileName)); exp.AndIF(!string.IsNullOrEmpty(fileCode), x => x.FileCode.Contains(fileCode)); exp.AndIF(!string.IsNullOrEmpty(fileSuffix), x => x.FileSuffix.Contains(fileSuffix)); exp.AndIF(!string.IsNullOrEmpty(uploadUserName), x => x.UploadUserName.Contains(uploadUserName)); exp.AndIF(startTime.HasValue, x => x.UploadTime >= startTime.Value); exp.AndIF(endTime.HasValue, x => x.UploadTime <= endTime.Value); using (var db = new SqlSugarClient(ConnectionConfig)) { return db.Queryable() .Where(exp.ToExpression()) .OrderBy(x => x.UploadTime, OrderByType.Desc) .ToList(); } } /// /// 获取模糊分页列表 /// public List GetFluzzyPageList ( string fileName, string fileCode, string fileSuffix, string uploadUserName, DateTime? startTime, DateTime? endTime, int PageIndex, int PageSize, ref int Total ) { if (PageIndex < 1) { PageIndex = 1; } if (PageSize < 1) { PageSize = 1; } var exp = Expressionable.Create(); exp.AndIF(!string.IsNullOrEmpty(fileName), x => x.FileName.Contains(fileName)); exp.AndIF(!string.IsNullOrEmpty(fileCode), x => x.FileCode.Contains(fileCode)); exp.AndIF(!string.IsNullOrEmpty(fileSuffix), x => x.FileSuffix.Contains(fileSuffix)); exp.AndIF(!string.IsNullOrEmpty(uploadUserName), x => x.UploadUserName.Contains(uploadUserName)); exp.AndIF(startTime.HasValue, x => x.UploadTime >= startTime.Value); exp.AndIF(endTime.HasValue, x => x.UploadTime <= endTime.Value); using (var db = new SqlSugarClient(ConnectionConfig)) { return db.Queryable() .Where(exp.ToExpression()) .OrderBy(x => x.UploadTime, OrderByType.Desc) .ToPageList(PageIndex, PageSize, ref Total); } } /// /// /// public bool IsExistFileCode(string FileCode) { using (var db = new SqlSugarClient(ConnectionConfig)) { return db.Queryable() .Where(x => x.FileCode == FileCode) .Count() > 0; } } /// /// /// public bool IsExistFileCodeExceptID(string FileCode, long ExceptID) { using (var db = new SqlSugarClient(ConnectionConfig)) { return db.Queryable() .Where(x => x.FileCode == FileCode && x.ID != ExceptID) .Count() > 0; } } } }