diff --git a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs index 4dc89a637..b7ed5517f 100644 --- a/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs +++ b/Src/Asp.NetCore2/SqlSugar/Abstract/QueryableProvider/QueryableProvider.cs @@ -1302,6 +1302,13 @@ namespace SqlSugar result = result.Where(y => y.Date >= begtinWeek&& y.Date <= endWeek).ToList(); } + else if (SplitType.Month_6 == type.SplitType) + { + var begtinWeek = beginTime.Month<=6?beginTime.ToString("yyyy-01-01"): beginTime.ToString("yyyy-06-01"); + var endWeek = endTime.Month <= 6 ? endTime.ToString("yyyy-07-01") : endTime.ToString("yyyy-12-01"); + result = result.Where(y => + y.Date >= begtinWeek.ObjToDate() && y.Date <= endWeek.ObjToDate().AddMonths(1).AddDays(-1)).ToList(); + } else if (SplitType.Season == type.SplitType) { diff --git a/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs b/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs index 0412abe6f..ddade7fb8 100644 --- a/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs +++ b/Src/Asp.NetCore2/SqlSugar/IntegrationServices/SplitTableService.cs @@ -102,6 +102,8 @@ namespace SqlSugar break; case SplitType.Year: break; + case SplitType.Month_6: + break; default: throw new Exception("DateSplitTableService no support " + splitType.ToString()); } @@ -222,6 +224,15 @@ namespace SqlSugar } case SplitType.Year: return Convert.ToDateTime(time.ToString("yyyy-01-01")); + case SplitType.Month_6: + if (time.Month <= 6) + { + return Convert.ToDateTime(time.ToString("yyyy-01-01")); + } + else + { + return Convert.ToDateTime(time.ToString("yyyy-07-01")); + } default: throw new Exception($"SplitType parameter error "); } diff --git a/Src/Asp.NetCore2/SqlSugar/SpliteTable/SplitType.cs b/Src/Asp.NetCore2/SqlSugar/SpliteTable/SplitType.cs index 2e1080c50..b11efa392 100644 --- a/Src/Asp.NetCore2/SqlSugar/SpliteTable/SplitType.cs +++ b/Src/Asp.NetCore2/SqlSugar/SpliteTable/SplitType.cs @@ -11,6 +11,7 @@ namespace SqlSugar Day = 0, Week = 1, Month = 2, + Month_6=1000, Season = 3, Year = 4, _Custom01 = 5,