修复按年的时间lessthan判断bug
This commit is contained in:
parent
d328fcfdfb
commit
6281772eb1
|
@ -47,7 +47,7 @@ namespace ShardingCore.VirtualRoutes.Years
|
||||||
return tail => String.Compare(tail, t, StringComparison.Ordinal) >= 0;
|
return tail => String.Compare(tail, t, StringComparison.Ordinal) >= 0;
|
||||||
case ShardingOperatorEnum.LessThan:
|
case ShardingOperatorEnum.LessThan:
|
||||||
{
|
{
|
||||||
var currentYear =new DateTime(shardingKey.Year);
|
var currentYear =new DateTime(shardingKey.Year,1,1);
|
||||||
//处于临界值 o=>o.time < [2021-01-01 00:00:00] 尾巴20210101不应该被返回
|
//处于临界值 o=>o.time < [2021-01-01 00:00:00] 尾巴20210101不应该被返回
|
||||||
if (currentYear == shardingKey)
|
if (currentYear == shardingKey)
|
||||||
return tail => String.Compare(tail, t, StringComparison.Ordinal) < 0;
|
return tail => String.Compare(tail, t, StringComparison.Ordinal) < 0;
|
||||||
|
|
|
@ -71,7 +71,7 @@ namespace ShardingCore.VirtualRoutes.Years
|
||||||
case ShardingOperatorEnum.LessThan:
|
case ShardingOperatorEnum.LessThan:
|
||||||
{
|
{
|
||||||
var datetime = ShardingCoreHelper.ConvertLongToDateTime(shardingKey);
|
var datetime = ShardingCoreHelper.ConvertLongToDateTime(shardingKey);
|
||||||
var currentYear = new DateTime(datetime.Year);
|
var currentYear = new DateTime(datetime.Year,1,1);
|
||||||
//处于临界值 o=>o.time < [2021-01-01 00:00:00] 尾巴20210101不应该被返回
|
//处于临界值 o=>o.time < [2021-01-01 00:00:00] 尾巴20210101不应该被返回
|
||||||
if (currentYear == datetime)
|
if (currentYear == datetime)
|
||||||
return tail => String.Compare(tail, t, StringComparison.Ordinal) < 0;
|
return tail => String.Compare(tail, t, StringComparison.Ordinal) < 0;
|
||||||
|
|
Loading…
Reference in New Issue