v3.4.6
This commit is contained in:
@@ -52,7 +52,7 @@ public abstract class CDEntityBase : EntityBase<string>, ICreatorTime, IDeleteTi
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
this.EnabledMark = this.EnabledMark == null ? 1 : this.EnabledMark;
|
||||
@@ -67,7 +67,7 @@ public abstract class CDEntityBase : EntityBase<string>, ICreatorTime, IDeleteTi
|
||||
/// </summary>
|
||||
public virtual void Create()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = this.Id == null ? SnowflakeIdHelper.NextId() : this.Id;
|
||||
this.EnabledMark = this.EnabledMark == null ? 1 : this.EnabledMark;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using JNPF.Common.Const;
|
||||
using JNPF.Common.Security;
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Common.Contracts;
|
||||
@@ -28,7 +29,7 @@ public abstract class CEntityBase : EntityBase<string>, ICreatorTime
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
if (!string.IsNullOrEmpty(userId))
|
||||
|
||||
@@ -64,7 +64,7 @@ public abstract class CLDEntityBase : EntityBase<string>, ICreatorTime, IDeleteT
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
this.EnabledMark = this.EnabledMark == null ? 1 : this.EnabledMark;
|
||||
|
||||
@@ -40,7 +40,7 @@ public class CLEntityBase : EntityBase<string>, ICreatorTime
|
||||
/// </summary>
|
||||
public virtual void Creator()
|
||||
{
|
||||
var userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
var userId = App.User?.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
|
||||
this.CreatorTime = DateTime.Now;
|
||||
this.Id = SnowflakeIdHelper.NextId();
|
||||
if (!string.IsNullOrEmpty(userId))
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using JNPF.DependencyInjection;
|
||||
using JNPF.Extras.DatabaseAccessor.SqlSugar.Models;
|
||||
using SqlSugar;
|
||||
|
||||
namespace JNPF.Common.Contracts;
|
||||
@@ -7,7 +8,7 @@ namespace JNPF.Common.Contracts;
|
||||
/// 实体类基类.
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public abstract class EntityBase<TKey> : IEntity<TKey>
|
||||
public abstract class EntityBase<TKey> : ITenantFilter, IEntity<TKey>
|
||||
where TKey : IEquatable<TKey>
|
||||
{
|
||||
/// <summary>
|
||||
@@ -15,4 +16,10 @@ public abstract class EntityBase<TKey> : IEntity<TKey>
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_Id", ColumnDescription = "主键", IsPrimaryKey = true)]
|
||||
public TKey Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获取或设置 租户id.
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "F_TenantId", ColumnDescription = "租户id")]
|
||||
public string TenantId { get; set; }
|
||||
}
|
||||
Reference in New Issue
Block a user