Update SampleBy bug

This commit is contained in:
sunkaixuan 2024-05-13 03:13:34 +08:00
parent 37eb185202
commit 63b75c29b4

View File

@ -1235,8 +1235,16 @@ namespace SqlSugar
public ISugarQueryable<T> SampleBy(int timeNumber, SampleByUnit timeType) public ISugarQueryable<T> SampleBy(int timeNumber, SampleByUnit timeType)
{ {
SampleByUnit sampleBy = timeType; SampleByUnit sampleBy = timeType;
string sql = "SAMPLE BY "+timeNumber + sampleBy.ToString().Substring(0, 1).ToLower(); if (timeType == SampleByUnit.Month)
this.QueryBuilder.SampleBy = sql; {
string sql = "SAMPLE BY " + timeNumber + sampleBy.ToString().Substring(0, 1);
this.QueryBuilder.SampleBy = sql;
}
else
{
string sql = "SAMPLE BY "+timeNumber + sampleBy.ToString().Substring(0, 1).ToLower();
this.QueryBuilder.SampleBy = sql;
}
return this; return this;
} }
public ISugarQueryable<T> SampleBy(int timeNumber, string timeType) public ISugarQueryable<T> SampleBy(int timeNumber, string timeType)