Update split date

This commit is contained in:
sunkaixuan 2023-10-27 11:15:33 +08:00
parent 55a327e536
commit 0e1004d601

View File

@ -1556,7 +1556,7 @@ namespace SqlSugar
Check.ExceptionEasy(splitColumn==null,"[SplitFieldAttribute] need to be added to the table field", "需要在分表字段加上属性[SplitFieldAttribute]");
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 result= this.Where($" {columnName}>={sqlParameterKeyWord}spBeginTime AND {columnName}<= {sqlParameterKeyWord}spEndTime",new { spBeginTime = beginTime , spEndTime = endTime}).SplitTable(tas => {
var result = tas;
var type= this.EntityInfo.Type.GetCustomAttribute<SplitTableAttribute>();
Check.ExceptionEasy(type == null, $"{this.EntityInfo.EntityName}need SplitTableAttribute", $"{this.EntityInfo.EntityName}需要特性 SplitTableAttribute");
@ -1596,6 +1596,17 @@ namespace SqlSugar
}
return result;
});
if (splitColumn.SqlParameterDbType is System.Data.DbType)
{
foreach (var item in this.QueryBuilder.Parameters)
{
if (item.ParameterName.IsContainsIn("spBeginTime", "spEndTime"))
{
item.DbType =(System.Data.DbType)splitColumn.SqlParameterDbType;
}
}
}
return result;
}
public ISugarQueryable<T> SplitTable(Func<List<SplitTableInfo>, IEnumerable<SplitTableInfo>> getTableNamesFunc)
{