diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 9ebefee4c..9ccddee7a 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -899,27 +899,20 @@ namespace SqlSugar var columnName = this.SqlBuilder.GetTranslationColumnName(splitColumn.DbColumnName); var sqlParameterKeyWord = this.SqlBuilder.SqlParameterKeyWord; return this.Where($" {columnName}>={sqlParameterKeyWord}spBeginTime AND {columnName}<= {sqlParameterKeyWord}spEndTime",new { spBeginTime = beginTime , spEndTime = endTime}).SplitTable(tas => { - - var dateNull = DateTime.MinValue; - var min = tas.Where(it => it.Date <= beginTime.Date).Select(it=>it.Date).OrderByDescending(it=>it.Date).FirstOrDefault(); - var max = tas.Where(it => it.Date >= endTime.Date).Select(it => it.Date).OrderBy(it => it.Date).FirstOrDefault(); - if (max == dateNull && min == dateNull) + var result = tas; + var type= this.EntityInfo.Type.GetCustomAttribute(); + if (SplitType.Month == type.SplitType) { - return tas.Take(1); + result = result.Where(y => y.Date >= beginTime.ToString("yyyy-MM").ObjToDate() && y.Date <= endTime.Date.ToString("yyyy-MM").ObjToDate().AddMonths(1).AddDays(-1)).ToList(); } - if (max == dateNull) + else if (SplitType.Month == type.SplitType) { - max = tas.Where(it => it.Date <= endTime).Select(it => it.Date).OrderByDescending(it => it.Date).FirstOrDefault(); + result = result.Where(y => y.Date.Year >= beginTime.Year && y.Date.Year <= endTime.Year).ToList(); } - if (max == dateNull) + else { - max = min; + result = result.Where(y => y.Date >= beginTime.Date && y.Date <= endTime.Date).ToList(); } - if (min == dateNull) - { - min = max; - } - var result= tas.Where(y => y.Date >= min && y.Date <= max); return result; }); } diff --git a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs index e78dd9351..5e780018e 100644 --- a/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs +++ b/Src/Asp.NetCore2/SqlSeverTest/SqlSugar/Abstract/SugarProvider/SqlSugarAccessory.cs @@ -388,9 +388,9 @@ namespace SqlSugar InstanceFactory.CustomDllName = SugarCompatible.IsFramework?"SqlSugar.Access": "SqlSugar.AccessCore"; break; case DbType.Custom: - Check.Exception(InstanceFactory.CustomDbName==null , "DbType.Custom: InstanceFactory.CustomDbName is not null "); - Check.Exception(InstanceFactory.CustomNamespace == null, "DbType.Custom: InstanceFactory.CustomNamespace is not null "); - Check.Exception(InstanceFactory.CustomDllName == null, "DbType.Custom: InstanceFactory.CustomDllName is not null "); + Check.Exception(InstanceFactory.CustomDbName.IsNullOrEmpty() , "DbType.Custom: InstanceFactory.CustomDbName is not null "); + Check.Exception(InstanceFactory.CustomNamespace.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomNamespace is not null "); + Check.Exception(InstanceFactory.CustomDllName.IsNullOrEmpty(), "DbType.Custom: InstanceFactory.CustomDllName is not null "); break; default: throw new Exception("ConnectionConfig.DbType is null");