mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-11-07 18:04:45 +08:00
32
OpenAuth.Repository/Core/LongEntity.cs
Normal file
32
OpenAuth.Repository/Core/LongEntity.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using System.ComponentModel;
|
||||
using Yitter.IdGenerator;
|
||||
|
||||
namespace OpenAuth.Repository.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 数据库Id为numberic类型的数据实体使用该基类,用法同Entity
|
||||
/// 数据库Id字段为numberic(16,0)或以上长度的整型,采用雪花算法生成Id。
|
||||
/// </summary>
|
||||
public class LongEntity :BaseEntity
|
||||
{
|
||||
[Browsable(false)]
|
||||
public long Id { get; set; }
|
||||
public override bool KeyIsNull()
|
||||
{
|
||||
return Id == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 采用雪花算法计算Id
|
||||
/// </summary>
|
||||
public override void GenerateDefaultKeyVal()
|
||||
{
|
||||
// 全局初始化设置WorkerId,默认最大2^16-1。(初始化过程全局只需一次,且必须最先设置)
|
||||
var options = new IdGeneratorOptions(){ WorkerId = 1};
|
||||
IIdGenerator IdHelper = new YitIdGenerator(options);
|
||||
|
||||
// 初始化以后,就可以在需要的地方调用方法生成ID。
|
||||
Id = IdHelper.NewLong();
|
||||
}
|
||||
}
|
||||
}
|
||||
31
OpenAuth.Repository/Core/StringEntity.cs
Normal file
31
OpenAuth.Repository/Core/StringEntity.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace OpenAuth.Repository.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键为字符串的实体基类,为系统默认的实体类型
|
||||
/// </summary>
|
||||
public class StringEntity : BaseEntity
|
||||
{
|
||||
[Browsable(false)]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 判断主键是否为空,常用做判定操作是【添加】还是【编辑】
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public override bool KeyIsNull()
|
||||
{
|
||||
return string.IsNullOrEmpty(Id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建默认的主键值
|
||||
/// </summary>
|
||||
public override void GenerateDefaultKeyVal()
|
||||
{
|
||||
Id = Guid.NewGuid().ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ namespace OpenAuth.Repository.Core
|
||||
/// <summary>
|
||||
/// 树状结构实体
|
||||
/// </summary>
|
||||
public abstract class TreeEntity: Entity
|
||||
public abstract class TreeEntity: StringEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 节点语义ID
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 应用
|
||||
/// </summary>
|
||||
[Table("Application")]
|
||||
public partial class Application : Entity
|
||||
public partial class Application : StringEntity
|
||||
{
|
||||
public Application()
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 代码生成器的表信息
|
||||
/// </summary>
|
||||
[Table("BuilderTable")]
|
||||
public partial class BuilderTable : Entity
|
||||
public partial class BuilderTable : StringEntity
|
||||
{
|
||||
public BuilderTable()
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 代码生成器的字段信息
|
||||
/// </summary>
|
||||
[Table("BuilderTableColumn")]
|
||||
public partial class BuilderTableColumn : Entity
|
||||
public partial class BuilderTableColumn : StringEntity
|
||||
{
|
||||
public BuilderTableColumn()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 分类表,也可用作数据字典。表示一个全集,比如:男、女、未知。关联的分类类型表示按什么进行的分类,如:按照性别对人类对象集
|
||||
/// </summary>
|
||||
[Table("Category")]
|
||||
public partial class Category : Entity
|
||||
public partial class Category : StringEntity
|
||||
{
|
||||
public Category()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 分类类型
|
||||
/// </summary>
|
||||
[Table("CategoryType")]
|
||||
public partial class CategoryType : Entity
|
||||
public partial class CategoryType : StringEntity
|
||||
{
|
||||
public CategoryType()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 系统授权规制表
|
||||
/// </summary>
|
||||
[Table("DataPrivilegeRule")]
|
||||
public partial class DataPrivilegeRule : Entity
|
||||
public partial class DataPrivilegeRule : StringEntity
|
||||
{
|
||||
public DataPrivilegeRule()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 工作流流程实例表
|
||||
/// </summary>
|
||||
[Table("FlowInstance")]
|
||||
public partial class FlowInstance : Entity
|
||||
public partial class FlowInstance : StringEntity
|
||||
{
|
||||
public FlowInstance()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 工作流实例操作记录
|
||||
/// </summary>
|
||||
[Table("FlowInstanceOperationHistory")]
|
||||
public partial class FlowInstanceOperationHistory : Entity
|
||||
public partial class FlowInstanceOperationHistory : StringEntity
|
||||
{
|
||||
public FlowInstanceOperationHistory()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 工作流实例流转历史记录
|
||||
/// </summary>
|
||||
[Table("FlowInstanceTransitionHistory")]
|
||||
public partial class FlowInstanceTransitionHistory : Entity
|
||||
public partial class FlowInstanceTransitionHistory : StringEntity
|
||||
{
|
||||
public FlowInstanceTransitionHistory()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 工作流模板信息表
|
||||
/// </summary>
|
||||
[Table("FlowScheme")]
|
||||
public partial class FlowScheme : Entity
|
||||
public partial class FlowScheme : StringEntity
|
||||
{
|
||||
public FlowScheme()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 表单模板表
|
||||
/// </summary>
|
||||
[Table("Form")]
|
||||
public partial class Form : Entity
|
||||
public partial class Form : StringEntity
|
||||
{
|
||||
public Form()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 模拟一个自定页面的表单,该数据会关联到流程实例FrmData,可用于复杂页面的设计及后期的数据分析
|
||||
/// </summary>
|
||||
[Table("FrmLeaveReq")]
|
||||
public partial class FrmLeaveReq : Entity
|
||||
public partial class FrmLeaveReq : StringEntity
|
||||
{
|
||||
public FrmLeaveReq()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 模块元素表(需要权限控制的按钮)
|
||||
/// </summary>
|
||||
[Table("ModuleElement")]
|
||||
public partial class ModuleElement : Entity
|
||||
public partial class ModuleElement : StringEntity
|
||||
{
|
||||
public ModuleElement()
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 定时任务
|
||||
/// </summary>
|
||||
[Table("OpenJob")]
|
||||
public partial class OpenJob : Entity
|
||||
public partial class OpenJob : StringEntity
|
||||
{
|
||||
public OpenJob()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 多对多关系集中映射
|
||||
/// </summary>
|
||||
[Table("Relevance")]
|
||||
public partial class Relevance : Entity
|
||||
public partial class Relevance : StringEntity
|
||||
{
|
||||
public Relevance()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
[Table("Role")]
|
||||
public partial class Role : Entity
|
||||
public partial class Role : StringEntity
|
||||
{
|
||||
public Role()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 系统日志
|
||||
/// </summary>
|
||||
[Table("SysLog")]
|
||||
public partial class SysLog : Entity
|
||||
public partial class SysLog : StringEntity
|
||||
{
|
||||
public SysLog()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 系统消息表
|
||||
/// </summary>
|
||||
[Table("SysMessage")]
|
||||
public partial class SysMessage : Entity
|
||||
public partial class SysMessage : StringEntity
|
||||
{
|
||||
public SysMessage()
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 文件
|
||||
/// </summary>
|
||||
[Table("UploadFile")]
|
||||
public partial class UploadFile : Entity
|
||||
public partial class UploadFile : StringEntity
|
||||
{
|
||||
public UploadFile()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 用户基本信息表
|
||||
/// </summary>
|
||||
[Table("User")]
|
||||
public partial class User : Entity
|
||||
public partial class User : StringEntity
|
||||
{
|
||||
public User()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 入库通知单明细
|
||||
/// </summary>
|
||||
[Table("WmsInboundOrderDtbl")]
|
||||
public partial class WmsInboundOrderDtbl : Entity
|
||||
public partial class WmsInboundOrderDtbl : StringEntity
|
||||
{
|
||||
public WmsInboundOrderDtbl()
|
||||
{
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace OpenAuth.Repository.Domain
|
||||
/// 入库通知单(入库订单)
|
||||
/// </summary>
|
||||
[Table("WmsInboundOrderTbl")]
|
||||
public partial class WmsInboundOrderTbl : Entity
|
||||
public partial class WmsInboundOrderTbl : StringEntity
|
||||
{
|
||||
public WmsInboundOrderTbl()
|
||||
{
|
||||
|
||||
@@ -113,7 +113,6 @@ namespace OpenAuth.Repository
|
||||
public virtual DbSet<OpenJob> OpenJobs { get; set; }
|
||||
public virtual DbSet<BuilderTable> BuilderTables { get; set; }
|
||||
public virtual DbSet<BuilderTableColumn> BuilderTableColumns { get; set; }
|
||||
|
||||
//非数据库表格
|
||||
public virtual DbQuery<SysTableColumn> SysTableColumns { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user