mirror of
https://gitee.com/dotnetchina/SqlSugar.git
synced 2025-07-17 19:37:34 +08:00
-
This commit is contained in:
parent
8d7caf6a5c
commit
d1782a3bbe
@ -77,7 +77,11 @@ namespace OrmTest.Demo
|
|||||||
.EnableDiffLogEvent(new { title = "delete student" })
|
.EnableDiffLogEvent(new { title = "delete student" })
|
||||||
.ExecuteCommand();
|
.ExecuteCommand();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//primary key guid
|
||||||
|
db.Insertable(new DataTestInfo2() { Bool1=true, Bool2=false, PK=Guid.NewGuid(), Text1="a" })
|
||||||
|
.EnableDiffLogEvent(new { title = "add DataTestInfo2" })
|
||||||
|
.ExecuteReturnIdentity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ namespace OrmTest.Models
|
|||||||
/// Desc:
|
/// Desc:
|
||||||
/// Default:
|
/// Default:
|
||||||
/// Nullable:False
|
/// Nullable:False
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Guid PK {get;set;}
|
public Guid PK {get;set;}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -449,13 +449,13 @@ namespace SqlSugar
|
|||||||
List<DiffLogTableInfo> result = new List<DiffLogTableInfo>();
|
List<DiffLogTableInfo> result = new List<DiffLogTableInfo>();
|
||||||
var whereSql = string.Empty;
|
var whereSql = string.Empty;
|
||||||
List<IConditionalModel> cons = new List<IConditionalModel>();
|
List<IConditionalModel> cons = new List<IConditionalModel>();
|
||||||
if (identity != null)
|
if (identity != null&&identity>0)
|
||||||
{
|
{
|
||||||
var fieldName = EntityInfo.Columns.Last(it => it.IsIdentity).DbColumnName;
|
var fieldName = GetIdentityKeys().Last();
|
||||||
cons.Add(new ConditionalModel() { ConditionalType=ConditionalType.Equal, FieldName= fieldName, FieldValue=identity.ToString() });
|
cons.Add(new ConditionalModel() { ConditionalType=ConditionalType.Equal, FieldName= fieldName, FieldValue=identity.ToString() });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach(var item in this.EntityInfo.Columns.Where(it => it.IsIgnore == false&&it.IsPrimarykey==true)) {
|
foreach(var item in this.EntityInfo.Columns.Where(it => it.IsIgnore == false&&GetPrimaryKeys().Any(pk=>pk.Equals(it.DbColumnName,StringComparison.CurrentCultureIgnoreCase)))) {
|
||||||
var fielddName = item.DbColumnName;
|
var fielddName = item.DbColumnName;
|
||||||
var fieldValue = this.EntityInfo.Columns.FirstOrDefault(it => it.PropertyName == item.PropertyName).PropertyInfo.GetValue(this.InsertObjs.Last(), null).ObjToString();
|
var fieldValue = this.EntityInfo.Columns.FirstOrDefault(it => it.PropertyName == item.PropertyName).PropertyInfo.GetValue(this.InsertObjs.Last(), null).ObjToString();
|
||||||
cons.Add(new ConditionalModel() { ConditionalType = ConditionalType.Equal, FieldName = fielddName, FieldValue =fieldValue });
|
cons.Add(new ConditionalModel() { ConditionalType = ConditionalType.Equal, FieldName = fielddName, FieldValue =fieldValue });
|
||||||
|
Loading…
Reference in New Issue
Block a user