mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-12-17 17:41:28 +08:00
Merge branch 'SqlSugar5' of github.com:donet5/SqlSugar
This commit is contained in:
@@ -114,11 +114,17 @@ namespace SqlSugar
|
||||
Check.Exception(attribute == null, $"{typeof(T).Name} need SplitTableAttribute");
|
||||
groupModels = new List<GroupModel>();
|
||||
var db = FastestProvider.context;
|
||||
var hasSplitField = typeof(T).GetProperties().Any(it => it.GetCustomAttribute<SplitFieldAttribute>() != null);
|
||||
foreach (var item in datas)
|
||||
{
|
||||
var value = db.SplitHelper<T>().GetValue(attribute.SplitType, item);
|
||||
var tableName = db.SplitHelper<T>().GetTableName(attribute.SplitType,value);
|
||||
groupModels.Add(new GroupModel() { GroupName = tableName, Item = item });
|
||||
if (groupModels.Count > 0 && !hasSplitField)
|
||||
groupModels.Add(new GroupModel() { GroupName = groupModels[0].GroupName, Item = item });
|
||||
else
|
||||
{
|
||||
var value = db.SplitHelper<T>().GetValue(attribute.SplitType, item);
|
||||
var tableName = db.SplitHelper<T>().GetTableName(attribute.SplitType, value);
|
||||
groupModels.Add(new GroupModel() { GroupName = tableName, Item = item });
|
||||
}
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user