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