😎排除自增类型赋值
This commit is contained in:
parent
584c2cf49f
commit
1d159ccca6
@ -170,8 +170,8 @@ public static class SqlSugarSetup
|
||||
// 新增/插入
|
||||
if (entityInfo.OperationType == DataFilterType.InsertByObject)
|
||||
{
|
||||
// 若主键是长整型且空则赋值雪花Id
|
||||
if (entityInfo.EntityColumnInfo.IsPrimarykey && entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
|
||||
// 若主键是长整型且空且不是自增类型则赋值雪花Id
|
||||
if (entityInfo.EntityColumnInfo.IsPrimarykey && !entityInfo.EntityColumnInfo.IsIdentity && entityInfo.EntityColumnInfo.PropertyInfo.PropertyType == typeof(long))
|
||||
{
|
||||
var id = entityInfo.EntityColumnInfo.PropertyInfo.GetValue(entityInfo.EntityValue);
|
||||
if (id == null || (long)id == 0)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user