using JNPF.Common.Const;
using SqlSugar;
using Yitter.IdGenerator;
namespace JNPF.VisualData.Entity;
///
/// 可视化数据源配置表.
///
[SugarTable("BLADE_VISUAL_DB")]
[Tenant(ClaimConst.TENANTID)]
public class VisualDBEntity
{
///
/// 主键.
///
[SugarColumn(ColumnName = "ID", ColumnDescription = "主键", IsPrimaryKey = true)]
public string Id { get; set; }
///
/// 名称.
///
[SugarColumn(ColumnName = "Name", ColumnDescription = "名称")]
public string Name { get; set; }
///
/// 驱动类.
///
[SugarColumn(ColumnName = "DRIVER_CLASS", ColumnDescription = "驱动类")]
public string DriverClass { get; set; }
///
/// 连接地址.
///
[SugarColumn(ColumnName = "URL", ColumnDescription = "连接地址")]
public string Url { get; set; }
///
/// 用户名.
///
[SugarColumn(ColumnName = "USERNAME", ColumnDescription = "用户名")]
public string UserName { get; set; }
///
/// 密码.
///
[SugarColumn(ColumnName = "PASSWORD", ColumnDescription = "密码")]
public string Password { get; set; }
///
/// 备注.
///
[SugarColumn(ColumnName = "REMARK", ColumnDescription = "备注")]
public string Remark { get; set; }
///
/// 创建人.
///
[SugarColumn(ColumnName = "CREATE_USER", ColumnDescription = "创建人")]
public string CreateUser { get; set; }
///
/// 创建部门.
///
[SugarColumn(ColumnName = "CREATE_DEPT", ColumnDescription = "创建部门")]
public string CreateDept { get; set; }
///
/// 创建时间.
///
[SugarColumn(ColumnName = "CREATE_TIME", ColumnDescription = "创建时间")]
public DateTime CreateTime { get; set; }
///
/// 修改人.
///
[SugarColumn(ColumnName = "UPDATE_USER", ColumnDescription = "修改人")]
public string UpdateUser { get; set; }
///
/// 修改时间.
///
[SugarColumn(ColumnName = "UPDATE_TIME", ColumnDescription = "修改时间")]
public DateTime UpdateTime { get; set; }
///
/// 修改时间.
///
[SugarColumn(ColumnName = "STATUS", ColumnDescription = "状态")]
public string Status { get; set; }
///
/// 是否已删除.
///
[SugarColumn(ColumnName = "IS_DELETED", ColumnDescription = "是否已删除")]
public int IsDeleted { get; set; }
///
/// 创建.
///
public virtual void Create()
{
string? userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
this.CreateTime = DateTime.Now;
this.IsDeleted = 0;
this.Id = YitIdHelper.NextId().ToString();
if (!string.IsNullOrEmpty(userId))
{
this.CreateUser = userId;
}
}
///
/// 修改.
///
public virtual void LastModify()
{
string? userId = App.User.FindFirst(ClaimConst.CLAINMUSERID)?.Value;
this.UpdateTime = DateTime.Now;
if (!string.IsNullOrEmpty(userId))
{
this.UpdateUser = userId;
}
}
///
/// 删除.
///
public virtual void Delete()
{
this.IsDeleted = 1;
}
}