|
|
@ -485,6 +485,18 @@ namespace SqlSugar |
|
|
|
FieldName = column.DbColumnName, |
|
|
|
FieldValue = value.ObjToString() |
|
|
|
}); |
|
|
|
if (value != null && value.GetType().IsEnum()) |
|
|
|
{ |
|
|
|
if (this.Context.CurrentConnectionConfig?.MoreSettings?.TableEnumIsString == true) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
data.Value.FieldValue = Convert.ToInt64(value).ObjToString(); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
cons.ConditionalList.Add(data); |
|
|
|
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL) |
|
|
|
{ |
|
|
@ -1136,16 +1148,16 @@ namespace SqlSugar |
|
|
|
var parentIdName = UtilConvert.ToMemberExpression((parentIdExpression as LambdaExpression).Body).Member.Name; |
|
|
|
var ParentInfo = entity.Columns.First(it => it.PropertyName == parentIdName); |
|
|
|
var parentPropertyName = ParentInfo.DbColumnName; |
|
|
|
var current =await this.Context.Queryable<T>().InSingleAsync(primaryKeyValue); |
|
|
|
var current =await this.Context.Queryable<T>().AS(this.QueryBuilder.GetTableNameString).InSingleAsync(primaryKeyValue); |
|
|
|
if (current != null) |
|
|
|
{ |
|
|
|
result.Add(current); |
|
|
|
object parentId = ParentInfo.PropertyInfo.GetValue(current, null); |
|
|
|
int i = 0; |
|
|
|
while (parentId != null &&await this.Context.Queryable<T>().In(parentId).AnyAsync()) |
|
|
|
while (parentId != null &&await this.Context.Queryable<T>().AS(this.QueryBuilder.GetTableNameString).In(parentId).AnyAsync()) |
|
|
|
{ |
|
|
|
Check.Exception(i > 100, ErrorMessage.GetThrowMessage("Dead cycle", "出现死循环或超出循环上限(100),检查最顶层的ParentId是否是null或者0")); |
|
|
|
var parent =await this.Context.Queryable<T>().InSingleAsync(parentId); |
|
|
|
var parent =await this.Context.Queryable<T>().AS(this.QueryBuilder.GetTableNameString).InSingleAsync(parentId); |
|
|
|
result.Add(parent); |
|
|
|
parentId = ParentInfo.PropertyInfo.GetValue(parent, null); |
|
|
|
++i; |
|
|
@ -2161,6 +2173,10 @@ namespace SqlSugar |
|
|
|
Check.Exception(true, ".Mapper() parameter error"); |
|
|
|
} |
|
|
|
List<string> inValues = entitys.Select(it => it.GetType().GetProperty(filedName).GetValue(it, null).ObjToString()).ToList(); |
|
|
|
if (inValues!=null&& inValues.Any()&&UtilMethods.GetUnderType(entitys.First().GetType().GetProperty(filedName).PropertyType) == UtilConstants.GuidType) |
|
|
|
{ |
|
|
|
inValues = inValues.Select(x => x == "" ? "null" : x).Distinct().ToList(); |
|
|
|
} |
|
|
|
List<IConditionalModel> wheres = new List<IConditionalModel>() |
|
|
|
{ |
|
|
|
new ConditionalModel() |
|
|
|