|
|
@ -825,11 +825,13 @@ namespace SqlSugar |
|
|
|
item.Columns = new List<DiffLogColumnInfo>(); |
|
|
|
foreach (DataColumn col in dt2.Columns) |
|
|
|
{ |
|
|
|
|
|
|
|
var sugarColumn = this.EntityInfo.Columns.Where(it => it.DbColumnName != null).FirstOrDefault(it => |
|
|
|
it.DbColumnName.Equals(col.ColumnName, StringComparison.CurrentCultureIgnoreCase)); |
|
|
|
DiffLogColumnInfo addItem = new DiffLogColumnInfo(); |
|
|
|
addItem.Value = row[col.ColumnName]; |
|
|
|
addItem.ColumnName = col.ColumnName; |
|
|
|
addItem.ColumnDescription = this.EntityInfo.Columns.Where(it => it.DbColumnName != null).FirstOrDefault(it => it.DbColumnName.Equals(col.ColumnName, StringComparison.CurrentCultureIgnoreCase))?.ColumnDescription; |
|
|
|
addItem.IsPrimaryKey = sugarColumn?.IsPrimarykey ?? false; |
|
|
|
addItem.ColumnDescription = sugarColumn?.ColumnDescription; |
|
|
|
item.Columns.Add(addItem); |
|
|
|
} |
|
|
|
result.Add(item); |
|
|
@ -846,6 +848,15 @@ namespace SqlSugar |
|
|
|
if (identity != null && identity > 0 && GetIdentityKeys().HasValue()) |
|
|
|
{ |
|
|
|
var fieldName = GetIdentityKeys().Last(); |
|
|
|
|
|
|
|
if (this.Context.CurrentConnectionConfig.DbType == DbType.PostgreSQL) |
|
|
|
{ |
|
|
|
var fieldObjectType = this.EntityInfo.Columns.FirstOrDefault(x => x.DbColumnName == fieldName) |
|
|
|
.PropertyInfo.PropertyType; |
|
|
|
cons.Add(new ConditionalModel() { ConditionalType = ConditionalType.Equal, FieldName = fieldName, FieldValue = identity.ToString(), |
|
|
|
FieldValueConvertFunc = it => UtilMethods.ChangeType2(it, fieldObjectType) }); |
|
|
|
} |
|
|
|
else |
|
|
|
cons.Add(new ConditionalModel() { ConditionalType = ConditionalType.Equal, FieldName = fieldName, FieldValue = identity.ToString() }); |
|
|
|
} |
|
|
|
else |
|
|
@ -880,10 +891,13 @@ namespace SqlSugar |
|
|
|
item.Columns = new List<DiffLogColumnInfo>(); |
|
|
|
foreach (DataColumn col in dt.Columns) |
|
|
|
{ |
|
|
|
var sugarColumn = this.EntityInfo.Columns.Where(it => it.DbColumnName != null).First(it => |
|
|
|
it.DbColumnName.Equals(col.ColumnName, StringComparison.CurrentCultureIgnoreCase)); |
|
|
|
DiffLogColumnInfo addItem = new DiffLogColumnInfo(); |
|
|
|
addItem.Value = row[col.ColumnName]; |
|
|
|
addItem.ColumnName = col.ColumnName; |
|
|
|
addItem.ColumnDescription = this.EntityInfo.Columns.Where(it => it.DbColumnName != null).First(it => it.DbColumnName.Equals(col.ColumnName, StringComparison.CurrentCultureIgnoreCase)).ColumnDescription; |
|
|
|
addItem.IsPrimaryKey = sugarColumn.IsPrimarykey; |
|
|
|
addItem.ColumnDescription = sugarColumn.ColumnDescription; |
|
|
|
item.Columns.Add(addItem); |
|
|
|
} |
|
|
|
result.Add(item); |
|
|
@ -899,7 +913,8 @@ namespace SqlSugar |
|
|
|
{ |
|
|
|
ColumnDescription = it.ColumnDescription, |
|
|
|
ColumnName = it.DbColumnName, |
|
|
|
Value = it.PropertyInfo.GetValue(this.InsertObjs.Last(), null) |
|
|
|
Value = it.PropertyInfo.GetValue(this.InsertObjs.Last(), null), |
|
|
|
IsPrimaryKey = it.IsPrimarykey |
|
|
|
}).ToList(); |
|
|
|
return new List<DiffLogTableInfo>() { diffTable }; |
|
|
|
} |
|
|
|