From b3aa899cd112f9137becb9268c3cf3b53da3e58e Mon Sep 17 00:00:00 2001 From: sunkaixuan <610262374@qq.com> Date: Sat, 11 Jun 2022 16:49:46 +0800 Subject: [PATCH] Update ExecuteReturnSnowflakeId --- .../Abstract/InsertableProvider/InsertableProvider.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs index 2d87dc836..0058a1973 100644 --- a/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs +++ b/Src/Asp.Net/SqlSugar/Abstract/InsertableProvider/InsertableProvider.cs @@ -136,6 +136,11 @@ namespace SqlSugar public virtual long ExecuteReturnSnowflakeId() { + if (this.InsertObjs.Length > 1) + { + return this.ExecuteReturnSnowflakeIdList().First(); + } + var id = SnowFlakeSingle.instance.getID(); var entity = this.Context.EntityMaintenance.GetEntityInfo(); var snowProperty=entity.Columns.FirstOrDefault(it => it.IsPrimarykey && it.PropertyInfo.PropertyType == UtilConstants.LongType);