init commit

This commit is contained in:
路 范
2022-03-30 17:54:33 +08:00
parent df01841625
commit 904bdd16cd
500 changed files with 217251 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 自定义实体基类
/// </summary>
public abstract class DEntityBase : IEntity
{
/// <summary>
/// 主键Id
/// </summary>
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Comment("Id主键")]
[Column("Id", TypeName = "varchar(36)")]
public virtual string Id { get; set; } = String.Empty;
/// <summary>
/// 创建时间
/// </summary>
[Comment("创建时间")]
public virtual DateTime? CreatedTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[Comment("更新时间")]
public virtual DateTime? UpdatedTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
[Comment("创建者Id")]
[Column("CreatedUserId", TypeName = "varchar(36)")]
public virtual string CreatedUserId { get; set; }
/// <summary>
/// 创建者名称
/// </summary>
[Comment("创建者名称")]
[MaxLength(20)]
public virtual string CreatedUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
[Comment("修改者Id")]
[Column("UpdatedUserId", TypeName = "varchar(36)")]
public virtual string UpdatedUserId { get; set; }
/// <summary>
/// 修改者名称
/// </summary>
[Comment("修改者名称")]
[MaxLength(20)]
public virtual string UpdatedUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
[JsonIgnore]
[Comment("软删除标记")]
[Column("IsDeleted", TypeName = "bit")]
public virtual bool IsDeleted { get; set; } = false;
}
}

View File

@@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 系统应用表
/// </summary>
[Table("sys_app")]
[Comment("系统应用表")]
public class SysApp : DEntityBase
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 图标
/// </summary>
[Comment("图标")]
public string Icon { get; set; }
/// <summary>
/// 图标颜色
/// </summary>
[Comment("图标颜色")]
public string Color { get; set; }
/// <summary>
/// 是否默认激活Y-是N-否),只能有一个系统默认激活
/// 用户登录后默认展示此系统菜单
/// </summary>
[Comment("是否默认激活")]
[Column("Active", TypeName = "bit")]
public bool Active { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; }
}
}

View File

@@ -0,0 +1,83 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Ewide.Core
{
[Table("sys_area_code")]
[Comment("区域表")]
public class SysAreaCode: IEntity
{
[Key]
[Comment("系统使用的区域编码")]
[MaxLength(50)]
public string Code { get; set; }
[Comment("区域的行政编码")]
[MaxLength(50)]
public string AdCode { get; set; }
[Comment("名称")]
[Required]
[MaxLength(100)]
public string Name { get; set; }
[Comment("备注")]
[MaxLength(1000)]
public string Note { get; set; }
[Comment("类别")]
[Required]
public int LevelType { get; set; }
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 父节点就是去掉后面两位
/// </summary>
public string ParentCode => LevelType switch
{
// 市级 => 没有父级 3302
1 => string.Empty,
// 区级 => 6位取4位得到市级 330201
2 => Code[0..(Code.Length - 2)],
// 其他 => 去除后3位得到上级 330201001
_ => Code[0..(Code.Length - 3)],
};
/// <summary>
/// 多个区域有多个用户绑定自定义数据
/// </summary>
[XmlIgnore]
public ICollection<SysUser> SysUsers { get; set; }
/// <summary>
/// 中间表
/// </summary>
[XmlIgnore]
public List<SysUserArea> SysUserAreas { get; set; }
/// <summary>
/// 多个区域有多个角色绑定权限数据
/// </summary>
[XmlIgnore]
public ICollection<SysRole> SysRoles { get; set; }
/// <summary>
/// 中间表
/// </summary>
[XmlIgnore]
public List<SysRoleArea> SysRoleAreas { get; set; }
/// <summary>
/// 一个区域有多个组织
/// </summary>
[XmlIgnore]
public ICollection<SysOrg> SysOrgs { get; set; }
}
}

View File

@@ -0,0 +1,49 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 代码生成表
/// </summary>
[Table("sys_code_gen")]
[Comment("代码生成表")]
public class SysCodeGen : DEntityBase
{
/// <summary>
/// 作者姓名
/// </summary>
[Comment("作者姓名")]
public string AuthorName { get; set; }
/// <summary>
/// 是否移除表前缀
/// </summary>
[Comment("是否移除表前缀")]
public string TablePrefix { get; set; }
/// <summary>
/// 生成方式
/// </summary>
[Comment("生成方式")]
public string GenerateType { get; set; }
/// <summary>
/// 数据库表名
/// </summary>
[Comment("数据库表名")]
public string TableName { get; set; }
/// <summary>
/// 命名空间
/// </summary>
[Comment("命名空间")]
public string NameSpace { get; set; }
/// <summary>
/// 业务名
/// </summary>
[Comment("业务名")]
public string BusName { get; set; }
}
}

View File

@@ -0,0 +1,104 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 代码生成字段配置表
/// </summary>
[Table("sys_code_gen_config")]
[Comment("代码生成字段配置表")]
public class SysCodeGenConfig : DEntityBase
{
/// <summary>
/// 代码生成主表ID
/// </summary>
[Comment("代码生成主表ID")]
[Column("CodeGenId", TypeName = "varchar(36)")]
public string CodeGenId { get; set; }
/// <summary>
/// 数据库字段名
/// </summary>
[Comment("数据库字段名")]
public string ColumnName { get; set; }
/// <summary>
/// 字段描述
/// </summary>
[Comment("字段描述")]
public string ColumnComment { get; set; }
/// <summary>
/// .NET数据类型
/// </summary>
[Comment(".NET数据类型")]
public string NetType { get; set; }
/// <summary>
/// 作用类型(字典)
/// </summary>
[Comment("作用类型")]
public string EffectType { get; set; }
/// <summary>
/// 字典code
/// </summary>
[Comment("字典Code")]
public string DictTypeCode { get; set; }
/// <summary>
/// 列表是否缩进(字典)
/// </summary>
[Comment("列表是否缩进")]
public string WhetherRetract { get; set; }
/// <summary>
/// 是否必填(字典)
/// </summary>
[Comment("是否必填")]
public string WhetherRequired { get; set; }
/// <summary>
/// 是否是查询条件
/// </summary>
[Comment("是否是查询条件")]
public string QueryWhether { get; set; }
/// <summary>
/// 查询方式
/// </summary>
[Comment("查询方式")]
public string QueryType { get; set; }
/// <summary>
/// 列表显示
/// </summary>
[Comment("列表显示")]
public string WhetherTable { get; set; }
/// <summary>
/// 增改
/// </summary>
[Comment("增改")]
public string WhetherAddUpdate { get; set; }
/// <summary>
/// 主外键
/// </summary>
[Comment("主外键")]
public string ColumnKey { get; set; }
/// <summary>
/// 数据库中类型(物理类型)
/// </summary>
[Comment("数据库中类型")]
public string DataType { get; set; }
/// <summary>
/// 是否通用字段
/// </summary>
[Comment("是否通用字段")]
public string WhetherCommon { get; set; }
}
}

View File

@@ -0,0 +1,73 @@
using Ewide.Core.Service;
using Furion;
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 参数配置表
/// </summary>
[Table("sys_config")]
[Comment("参数配置表")]
public class SysConfig : DEntityBase, IEntityChangedListener<SysConfig>
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 属性值
/// </summary>
[Comment("属性值")]
public string Value { get; set; }
/// <summary>
/// 是否是系统参数Y-是N-否)
/// </summary>
[Comment("是否是系统参数")]
public string SysFlag { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 常量所属分类的编码,来自于“常量的分类”字典
/// </summary>
[Comment("常量所属分类的编码")]
public string GroupCode { get; set; }
/// <summary>
/// 监听实体更改之后
/// </summary>
/// <param name="newEntity"></param>
/// <param name="oldEntity"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
/// <param name="state"></param>
public void OnChanged(SysConfig newEntity, SysConfig oldEntity, DbContext dbContext, Type dbContextLocator, EntityState state)
{
// 刷新配置缓存
App.GetService<ISysConfigService>().UpdateConfigCache(newEntity.Code, newEntity.Value);
}
}
}

View File

@@ -0,0 +1,60 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 字典值表
/// </summary>
[Table("sys_dict_data")]
[Comment("字典值表")]
public class SysDictData : DEntityBase
{
/// <summary>
/// 字典类型Id
/// </summary>
[Comment("字典类型Id")]
[Column("TypeId", TypeName = "varchar(36)")]
public string TypeId { get; set; }
/// <summary>
/// 值
/// </summary>
[Comment("值")]
public string Value { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
[Comment("扩展编码以json形式存储")]
public string ExtCode { get; set; }
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 所属类型
/// </summary>
[XmlIgnore]
public SysDictType SysDictType { get; set; }
}
}

View File

@@ -0,0 +1,73 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 字典类型表
/// </summary>
[Table("sys_dict_type")]
[Comment("字典类型表")]
public class SysDictType : DEntityBase, IEntityTypeBuilder<SysDictType>
{
/// <summary>
/// 父Id
/// </summary>
[Comment("父Id")]
[Column("Pid", TypeName = "varchar(36)")]
public string Pid { get; set; }
/// <summary>
/// 父Ids
/// </summary>
[Comment("父Ids")]
public string Pids { get; set; }
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 字典数据
/// </summary>
[XmlIgnore]
public ICollection<SysDictData> SysDictDatas { get; set; }
public void Configure(EntityTypeBuilder<SysDictType> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasMany(x => x.SysDictDatas)
.WithOne(x => x.SysDictType)
.HasForeignKey(x => x.TypeId);
}
}
}

View File

@@ -0,0 +1,74 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 员工表
/// </summary>
[Table("sys_emp")]
[Comment("员工表")]
public class SysEmp : IEntity, IEntityTypeBuilder<SysEmp>
{
/// <summary>
/// 用户Id
/// </summary>
[DatabaseGenerated(DatabaseGeneratedOption.None)]
[Comment("用户Id")]
[Column("Id", TypeName = "varchar(36)")]
public string Id { get; set; }
/// <summary>
/// 工号
/// </summary>
[Comment("工号")]
public string JobNum { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[Comment("机构Id")]
[Column("OrgId", TypeName = "varchar(36)")]
public string OrgId { get; set; }
/// <summary>
/// 机构名称
/// </summary>
[Comment("机构名称")]
public string OrgName { get; set; }
/// <summary>
/// 多对多(职位)
/// </summary>
[XmlIgnore]
public ICollection<SysPos> SysPos { get; set; }
/// <summary>
/// 多对多中间表(员工-职位)
/// </summary>
[XmlIgnore]
public List<SysEmpPos> SysEmpPos { get; set; }
/// <summary>
/// 多对多配置关系
/// </summary>
/// <param name="entityBuilder"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
public void Configure(EntityTypeBuilder<SysEmp> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasMany(p => p.SysPos).WithMany(p => p.SysEmps).UsingEntity<SysEmpPos>(
u => u.HasOne(c => c.SysPos).WithMany(c => c.SysEmpPos).HasForeignKey(c => c.SysPosId),
u => u.HasOne(c => c.SysEmp).WithMany(c => c.SysEmpPos).HasForeignKey(c => c.SysEmpId),
u =>
{
u.HasKey(c => new { c.SysEmpId, c.SysPosId });
});
}
}
}

View File

@@ -0,0 +1,74 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 员工附属机构职位表
/// </summary>
[Table("sys_emp_ext_org_pos")]
[Comment("员工附属机构职位表")]
public class SysEmpExtOrgPos : IEntity, IEntityTypeBuilder<SysEmpExtOrgPos>
{
/// <summary>
/// 员工Id
/// </summary>
[Comment("员工Id")]
[Column("SysEmpId", TypeName = "varchar(36)")]
public string SysEmpId { get; set; }
/// <summary>
/// 一对一引用(员工)
/// </summary>
[XmlIgnore]
public SysEmp SysEmp { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[Comment("机构Id")]
[Column("SysOrgId", TypeName = "varchar(36)")]
public string SysOrgId { get; set; }
/// <summary>
/// 一对一引用(机构)
/// </summary>
[XmlIgnore]
public SysOrg SysOrg { get; set; }
/// <summary>
/// 职位Id
/// </summary>
[Comment("职位Id")]
[Column("SysPosId", TypeName = "varchar(36)")]
public string SysPosId { get; set; }
/// <summary>
/// 一对一引用(职位)
/// </summary>
[XmlIgnore]
public SysPos SysPos { get; set; }
public void Configure(EntityTypeBuilder<SysEmpExtOrgPos> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasKey(c => new { c.SysEmpId, c.SysOrgId, c.SysPosId });
}
//public IEnumerable<SysEmpExtOrgPos> HasData(DbContext dbContext, Type dbContextLocator)
//{
// return new[]
// {
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "12d888de-f55d-4c88-b0a0-7c3510664d97", SysPosId = "269236c4-d74e-4e54-9d50-f6f61580a197" },
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "8a2271d6-5bda-4544-bdd3-27e53a8b418e", SysPosId = "46c68a62-f119-4ff7-b621-0bbd77504538" },
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "127c0a5d-43ac-4370-b313-082361885aca", SysPosId = "5bd8c466-2bca-4386-a551-daac78e3cee8" },
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "f236ab2d-e1b5-4e9d-844f-a59ec32c20e4", SysPosId = "d89a3afe-e6ba-4018-bdae-3c98bb47ad66" },
// new SysEmpExtOrgPos { SysEmpId = "16a74726-e156-499f-9942-0e0e24ad0c3f", SysOrgId = "f236ab2d-e1b5-4e9d-844f-a59ec32c20e4", SysPosId = "269236c4-d74e-4e54-9d50-f6f61580a197" }
// };
//}
}
}

View File

@@ -0,0 +1,41 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 员工职位表
/// </summary>
[Table("sys_emp_pos")]
[Comment("员工职位表")]
public class SysEmpPos : IEntity
{
/// <summary>
/// 员工Id
/// </summary>
[Comment("员工Id")]
[Column("SysEmpId", TypeName = "varchar(36)")]
public string SysEmpId { get; set; }
/// <summary>
/// 一对一引用(员工)
/// </summary>
[XmlIgnore]
public SysEmp SysEmp { get; set; }
/// <summary>
/// 职位Id
/// </summary>
[Comment("职位Id")]
[Column("SysPosId", TypeName = "varchar(36)")]
public string SysPosId { get; set; }
/// <summary>
/// 一对一引用(职位)
/// </summary>
[XmlIgnore]
public SysPos SysPos { get; set; }
}
}

View File

@@ -0,0 +1,61 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 文件信息表
/// </summary>
[Table("sys_file")]
[Comment("文件信息表")]
public class SysFile : DEntityBase
{
/// <summary>
/// 文件存储位置1:阿里云2:腾讯云3:minio4:本地)
/// </summary>
[Comment("文件存储位置")]
public int FileLocation { get; set; }
/// <summary>
/// 文件仓库
/// </summary>
[Comment("文件仓库")]
public string FileBucket { get; set; }
/// <summary>
/// 文件名称(上传时候的文件名)
/// </summary>
[Comment("文件名称")]
public string FileOriginName { get; set; }
/// <summary>
/// 文件后缀
/// </summary>
[Comment("文件后缀")]
public string FileSuffix { get; set; }
/// <summary>
/// 文件大小kb
/// </summary>
[Comment("文件大小kb")]
public long FileSizeKb { get; set; }
/// <summary>
/// 文件大小信息,计算后的
/// </summary>
[Comment("文件大小信息")]
public string FileSizeInfo { get; set; }
/// <summary>
/// 存储到bucket的名称文件唯一标识id
/// </summary>
[Comment("存储到bucket的名称")]
public string FileObjectName { get; set; }
/// <summary>
/// 存储路径
/// </summary>
[Comment("存储路径")]
public string FilePath { get; set; }
}
}

View File

@@ -0,0 +1,64 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 系统操作/审计日志表
/// </summary>
[Table("sys_log_audit")]
[Comment("审计日志表")]
public class SysLogAudit : EntityBase
{
/// <summary>
/// 表名
/// </summary>
[Comment("表名")]
public string TableName { get; set; }
/// <summary>
/// 列名
/// </summary>
[Comment("列名")]
public string ColumnName { get; set; }
/// <summary>
/// 新值
/// </summary>
[Comment("新值")]
public string NewValue { get; set; }
/// <summary>
/// 旧值
/// </summary>
[Comment("旧值")]
public string OldValue { get; set; }
/// <summary>
/// 操作时间
/// </summary>
[Comment("操作时间")]
public DateTime CreatedTime { get; set; }
/// <summary>
/// 操作人Id
/// </summary>
[Comment("操作人Id")]
[Column("UserId", TypeName = "varchar(36)")]
public string UserId { get; set; }
/// <summary>
/// 操作人名称
/// </summary>
[Comment("操作人名称")]
public string UserName { get; set; }
/// <summary>
/// 操作方式:新增、更新、删除
/// </summary>
[Comment("操作方式")]
public string Operate { get; set; }
}
}

View File

@@ -0,0 +1,117 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 操作日志表
/// </summary>
[Table("sys_log_op")]
[Comment("操作日志表")]
public class SysLogOp : EntityBase
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 操作类型0其他 1增加 2删除 3编辑见LogAnnotionOpTypeEnum
/// </summary>
[Comment("操作类型")]
public int? OpType { get; set; }
/// <summary>
/// 是否执行成功Y-是N-否)
/// </summary>
[Comment("是否执行成功")]
public bool? Success { get; set; }
/// <summary>
/// 具体消息
/// </summary>
[Comment("具体消息")]
public string Message { get; set; }
/// <summary>
/// IP
/// </summary>
[Comment("IP")]
public string Ip { get; set; }
/// <summary>
/// 地址
/// </summary>
[Comment("地址")]
public string Location { get; set; }
/// <summary>
/// 浏览器
/// </summary>
[Comment("浏览器")]
public string Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
[Comment("操作系统")]
public string Os { get; set; }
/// <summary>
/// 请求地址
/// </summary>
[Comment("请求地址")]
public string Url { get; set; }
/// <summary>
/// 类名称
/// </summary>
[Comment("类名称")]
public string ClassName { get; set; }
/// <summary>
/// 方法名称
/// </summary>
[Comment("方法名称")]
public string MethodName { get; set; }
/// <summary>
/// 请求方式GET POST PUT DELETE)
/// </summary>
[Comment("请求方式")]
public string ReqMethod { get; set; }
/// <summary>
/// 请求参数
/// </summary>
[Comment("请求参数")]
public string Param { get; set; }
/// <summary>
/// 返回结果
/// </summary>
[Comment("返回结果")]
public string Result { get; set; }
/// <summary>
/// 耗时(毫秒)
/// </summary>
[Comment("耗时")]
public long ElapsedTime { get; set; }
/// <summary>
/// 操作时间
/// </summary>
[Comment("操作时间")]
public DateTime OpTime { get; set; }
/// <summary>
/// 操作人
/// </summary>
[Comment("操作人")]
public string Account { get; set; }
}
}

View File

@@ -0,0 +1,75 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 访问日志表
/// </summary>
[Table("sys_log_vis")]
[Comment("访问日志表")]
public class SysLogVis : EntityBase
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 是否执行成功Y-是N-否)
/// </summary>
[Comment("是否执行成功")]
public bool Success { get; set; }
/// <summary>
/// 具体消息
/// </summary>
[Comment("具体消息")]
public string Message { get; set; }
/// <summary>
/// IP
/// </summary>
[Comment("IP")]
public string Ip { get; set; }
/// <summary>
/// 地址
/// </summary>
[Comment("地址")]
public string Location { get; set; }
/// <summary>
/// 浏览器
/// </summary>
[Comment("浏览器")]
public string Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
[Comment("操作系统")]
public string Os { get; set; }
/// <summary>
/// 访问类型(字典 1登入 2登出
/// </summary>
[Comment("访问类型")]
public int? VisType { get; set; }
/// <summary>
/// 访问时间
/// </summary>
[Comment("访问时间")]
public DateTime VisTime { get; set; }
/// <summary>
/// 访问人
/// </summary>
[Comment("访问人")]
public string Account { get; set; }
}
}

View File

@@ -0,0 +1,142 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 菜单表
/// </summary>
[Table("sys_menu")]
[Comment("菜单表")]
public class SysMenu : DEntityBase
{
/// <summary>
/// 父Id
/// </summary>
[Comment("父Id")]
[Column("Pid", TypeName = "varchar(36)")]
public string Pid { get; set; }
/// <summary>
/// 父Ids
/// </summary>
[Comment("父Ids")]
public string Pids { get; set; }
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 菜单类型(字典 0目录 1菜单 2按钮
/// </summary>
[Comment("菜单类型")]
public int Type { get; set; }
/// <summary>
/// 图标
/// </summary>
[Comment("图标")]
public string Icon { get; set; }
/// <summary>
/// 路由地址
/// </summary>
[Comment("路由地址")]
public string Router { get; set; }
/// <summary>
/// 组件地址
/// </summary>
[Comment("组件地址")]
public string Component { get; set; }
/// <summary>
/// 权限标识
/// </summary>
[Comment("权限标识")]
public string Permission { get; set; }
/// <summary>
/// 应用分类(应用编码)
/// </summary>
[Comment("应用分类")]
public string Application { get; set; }
/// <summary>
/// 打开方式(字典 0无 1组件 2内链 3外链
/// </summary>
[Comment("打开方式")]
public int OpenType { get; set; } = 0;
/// <summary>
/// 是否可见Y-是N-否)
/// </summary>
[Comment("是否可见")]
[Column("Visible", TypeName = "bit")]
public bool Visible { get; set; } = true;
/// <summary>
/// 内链地址
/// </summary>
[Comment("内链地址")]
public string Link { get; set; }
/// <summary>
/// 重定向地址
/// </summary>
[Comment("重定向地址")]
public string Redirect { get; set; }
/// <summary>
/// 权重(字典 1系统权重 2业务权重
/// </summary>
[Comment("权重")]
public int Weight { get; set; } = 2;
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 关联上级菜单显示 0表示不需要关联菜单 1表示关联 仅按钮有效
/// </summary>
[Comment("关联菜单显示")]
[Column("VisibleParent", TypeName = "bit")]
public bool VisibleParent { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 多对多(角色)
/// </summary>
[XmlIgnore]
public ICollection<SysRole> SysRoles { get; set; }
/// <summary>
/// 多对多中间表(用户角色)
/// </summary>
[XmlIgnore]
public List<SysRoleMenu> SysRoleMenus { get; set; }
}
}

View File

@@ -0,0 +1,81 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 通知公告表
/// </summary>
[Table("sys_notice")]
[Comment("通知公告表")]
public class SysNotice : DEntityBase
{
/// <summary>
/// 标题
/// </summary>
[Comment("标题")]
public string Title { get; set; }
/// <summary>
/// 内容
/// </summary>
[Comment("内容")]
public string Content { get; set; }
/// <summary>
/// 类型(字典 1通知 2公告
/// </summary>
[Comment("类型")]
public int Type { get; set; }
/// <summary>
/// 发布人Id
/// </summary>
[Comment("发布人Id")]
[Column("PublicUserId", TypeName = "varchar(36)")]
public string PublicUserId { get; set; }
/// <summary>
/// 发布人姓名
/// </summary>
[Comment("发布人姓名")]
public string PublicUserName { get; set; }
/// <summary>
/// 发布机构Id
/// </summary>
[Comment("发布机构Id")]
[Column("PublicOrgId", TypeName = "varchar(36)")]
public string PublicOrgId { get; set; }
/// <summary>
/// 发布机构名称
/// </summary>
[Comment("发布机构名称")]
public string PublicOrgName { get; set; }
/// <summary>
/// 发布时间
/// </summary>
[Comment("发布时间")]
public DateTime? PublicTime { get; set; }
/// <summary>
/// 撤回时间
/// </summary>
[Comment("撤回时间")]
public DateTime? CancelTime { get; set; }
/// <summary>
/// 状态(字典 0草稿 1发布 2撤回 3删除
/// </summary>
[Comment("状态")]
public int Status { get; set; }
/// <summary>
/// 上传文件ids
/// </summary>
[Comment("上传文件id集合")]
public string Attachments { set; get; }
}
}

View File

@@ -0,0 +1,47 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 通知公告用户表
/// </summary>
[Table("sys_notice_user")]
[Comment("通知公告用户表")]
public class SysNoticeUser : DEntityBase
{
/// <summary>
/// 通知公告Id
/// </summary>
[Comment("通知公告Id")]
[Column("NoticeId", TypeName = "varchar(36)")]
public string NoticeId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
[Comment("用户Id")]
[Column("UserId", TypeName = "varchar(36)")]
public string UserId { get; set; }
/// <summary>
/// 阅读时间
/// </summary>
[Comment("阅读时间")]
public DateTime? ReadTime { get; set; }
/// <summary>
/// 状态(字典 0未读 1已读
/// </summary>
[Comment("状态")]
public int ReadStatus { get; set; }
public void Configure(EntityTypeBuilder<SysNoticeUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasNoKey();
}
}
}

View File

@@ -0,0 +1,85 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// Oauth登录用户表
/// </summary>
[Table("sys_oauth_user")]
[Comment("Oauth登录用户表")]
public class SysOauthUser : DEntityBase
{
/// <summary>
/// 第三方平台的用户唯一Id
/// </summary>
[Comment("UUID")]
public string Uuid { get; set; }
/// <summary>
/// 用户授权的token
/// </summary>
[Comment("Token")]
public string AccessToken { get; set; }
/// <summary>
/// 昵称
/// </summary>
[Comment("昵称")]
public string NickName { get; set; }
/// <summary>
/// 头像
/// </summary>
[Comment("头像")]
public string Avatar { get; set; }
/// <summary>
/// 性别
/// </summary>
[Comment("性别")]
public string Gender { get; set; }
/// <summary>
/// 电话
/// </summary>
[Comment("电话")]
public string Phone { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[Comment("邮箱")]
public string Email { get; set; }
/// <summary>
/// 位置
/// </summary>
[Comment("位置")]
public string Location { get; set; }
/// <summary>
/// 用户网址
/// </summary>
[Comment("用户网址")]
public string Blog { get; set; }
/// <summary>
/// 所在公司
/// </summary>
[Comment("所在公司")]
public string Company { get; set; }
/// <summary>
/// 用户来源
/// </summary>
[Comment("用户来源")]
public string Source { get; set; }
/// <summary>
/// 用户备注(各平台中的用户个人介绍)
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,112 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 组织机构表
/// </summary>
[Table("sys_org")]
[Comment("组织机构表")]
public class SysOrg : DEntityBase
{
/// <summary>
/// 父Id
/// </summary>
[Comment("父Id")]
[Column("Pid", TypeName = "varchar(36)")]
public string Pid { get; set; }
/// <summary>
/// 父Ids
/// </summary>
[Comment("Pids")]
public string Pids { get; set; }
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
[MaxLength(20)]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 机构类型
/// </summary>
[Comment("机构类型")]
public int Type { get; set; }
/// <summary>
/// 联系人
/// </summary>
[Comment("联系人")]
public string Contacts { get; set; }
/// <summary>
/// 电话
/// </summary>
[Comment("电话")]
public string Tel { get; set; }
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
public string AreaCode { get; set; }
/// <summary>
/// 一对一 一个组织对应一个区域代码
/// </summary>
[XmlIgnore]
public SysAreaCode Area { get; set; }
/// <summary>
/// 多对多(用户)
/// </summary>
[XmlIgnore]
public ICollection<SysUser> SysUsers { get; set; }
/// <summary>
/// 多对多中间表(用户数据范围)
/// </summary>
[XmlIgnore]
public List<SysUserDataScope> SysUserDataScopes { get; set; }
/// <summary>
/// 多对多(角色)
/// </summary>
[XmlIgnore]
public ICollection<SysRole> SysRoles { get; set; }
/// <summary>
/// 多对多中间表(角色数据范围)
/// </summary>
[XmlIgnore]
public List<SysRoleDataScope> SysRoleDataScopes { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 职位表
/// </summary>
[Table("sys_pos")]
[Comment("职位表")]
public class SysPos : DEntityBase
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 多对多(员工)
/// </summary>
[XmlIgnore]
public ICollection<SysEmp> SysEmps { get; set; }
/// <summary>
/// 多对多中间表(员工职位)
/// </summary>
[XmlIgnore]
public List<SysEmpPos> SysEmpPos { get; set; }
}
}

View File

@@ -0,0 +1,133 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 角色表
/// </summary>
[Table("sys_role")]
[Comment("角色表")]
public class SysRole : DEntityBase, IEntityTypeBuilder<SysRole>
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Comment("编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 数据范围类型(字典 1全部数据 2本部门及以下数据 3本部门数据 4仅本人数据 5自定义数据
/// </summary>
[Comment("数据范围类型")]
public int DataScopeType { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[Comment("状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 多对多(用户)
/// </summary>
[XmlIgnore]
public ICollection<SysUser> SysUsers { get; set; }
/// <summary>
/// 多对多中间表(用户角色)
/// </summary>
[XmlIgnore]
public List<SysUserRole> SysUserRoles { get; set; }
/// <summary>
/// 多对多(机构)
/// </summary>
[XmlIgnore]
public ICollection<SysOrg> SysOrgs { get; set; }
/// <summary>
/// 多对多中间表(角色-机构 数据范围)
/// </summary>
[XmlIgnore]
public List<SysRoleDataScope> SysRoleDataScopes { get; set; }
[XmlIgnore]
public ICollection<SysAreaCode> AreaCodes { get; set; }
[XmlIgnore]
public List<SysRoleArea> SysRoleAreas { get; set; }
/// <summary>
/// 多对多(菜单)
/// </summary>
[XmlIgnore]
public ICollection<SysMenu> SysMenus { get; set; }
/// <summary>
/// 多对多中间表(角色-菜单)
/// </summary>
[XmlIgnore]
public List<SysRoleMenu> SysRoleMenus { get; set; }
/// <summary>
/// 配置多对多关系
/// </summary>
/// <param name="entityBuilder"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
public void Configure(EntityTypeBuilder<SysRole> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasMany(p => p.SysOrgs)
.WithMany(p => p.SysRoles)
.UsingEntity<SysRoleDataScope>(
u => u.HasOne(c => c.SysOrg).WithMany(c => c.SysRoleDataScopes).HasForeignKey(c => c.SysOrgId),
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleDataScopes).HasForeignKey(c => c.SysRoleId),
u =>
{
u.HasKey(c => new { c.SysRoleId, c.SysOrgId });
});
entityBuilder.HasMany(p => p.AreaCodes)
.WithMany(p => p.SysRoles)
.UsingEntity<SysRoleArea>(
u => u.HasOne(c => c.Area).WithMany(c => c.SysRoleAreas).HasForeignKey(c => c.AreaCode),
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleAreas).HasForeignKey(c => c.SysRoleId),
u =>
{
u.HasKey(c => new { c.SysRoleId, c.AreaCode });
});
entityBuilder.HasMany(p => p.SysMenus)
.WithMany(p => p.SysRoles)
.UsingEntity<SysRoleMenu>(
u => u.HasOne(c => c.SysMenu).WithMany(c => c.SysRoleMenus).HasForeignKey(c => c.SysMenuId),
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleMenus).HasForeignKey(c => c.SysRoleId),
u =>
{
u.HasKey(c => new { c.SysRoleId, c.SysMenuId });
});
}
}
}

View File

@@ -0,0 +1,31 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace Ewide.Core
{
[Table("sys_role_area")]
[Comment("角色区域自定义数据")]
public class SysRoleArea: IEntity
{
/// <summary>
/// 角色Id
/// </summary>
[Comment("角色Id")]
public string SysRoleId { get; set; }
[XmlIgnore]
public SysRole SysRole { get; set; }
[Comment("系统使用的区域代码")]
public string AreaCode { get; set; }
[XmlIgnore]
public SysAreaCode Area { get; set; }
}
}

View File

@@ -0,0 +1,40 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 角色数据范围表
/// </summary>
[Table("sys_role_data_scope")]
[Comment("角色数据范围表")]
public class SysRoleDataScope : IEntity
{
/// <summary>
/// 角色Id
/// </summary>
[Comment("角色Id")]
[Column("SysRoleId", TypeName = "varchar(36)")]
public string SysRoleId { get; set; }
/// <summary>
/// 一对一引用(系统角色)
/// </summary>
public SysRole SysRole { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[Comment("机构Id")]
[Column("SysOrgId", TypeName = "varchar(36)")]
public string SysOrgId { get; set; }
/// <summary>
/// 一对一引用(系统机构)
/// </summary>
[XmlIgnore]
public SysOrg SysOrg { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 角色菜单表
/// </summary>
[Table("sys_role_menu")]
[Comment("角色菜单表")]
public class SysRoleMenu : IEntity
{
/// <summary>
/// 角色Id
/// </summary>
[Comment("角色Id")]
[Column("SysRoleId", TypeName = "varchar(36)")]
public string SysRoleId { get; set; }
/// <summary>
/// 一对一引用(系统用户)
/// </summary>
[XmlIgnore]
public SysRole SysRole { get; set; }
/// <summary>
/// 菜单Id
/// </summary>
[Comment("菜单Id")]
[Column("SysMenuId", TypeName = "varchar(36)")]
public string SysMenuId { get; set; }
/// <summary>
/// 一对一引用(系统菜单)
/// </summary>
[XmlIgnore]
public SysMenu SysMenu { get; set; }
}
}

View File

@@ -0,0 +1,56 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 租户表
/// </summary>
[Table("sys_tenant")]
[Comment("租户表")]
public class SysTenant : DEntityBase, IEntity<MultiTenantDbContextLocator>
{
/// <summary>
/// 名称
/// </summary>
[Comment("名称")]
public string Name { get; set; }
/// <summary>
/// 主机
/// </summary>
[Comment("主机")]
public string Host { get; set; }
/// <summary>
/// 电子邮箱
/// </summary>
[Comment("电子邮箱")]
public string Email { get; set; }
/// <summary>
/// 电话
/// </summary>
[Comment("电话")]
public string Phone { get; set; }
/// <summary>
/// 数据库连接
/// </summary>
[Comment("数据库连接")]
public string Connection { get; set; }
/// <summary>
/// 架构
/// </summary>
[Comment("架构")]
public string Schema { get; set; }
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,126 @@
using Furion.TaskScheduler;
using Microsoft.EntityFrameworkCore;
using System;
using System.ComponentModel.DataAnnotations.Schema;
namespace Ewide.Core
{
/// <summary>
/// 定时任务
/// </summary>
[Table("sys_timer")]
[Comment("定时任务表")]
public class SysTimer : DEntityBase
{
/// <summary>
/// 任务名称
/// </summary>
/// <example>ewide</example>
[Comment("任务名称")]
public string JobName { get; set; }
/// <summary>
/// 只执行一次
/// </summary>
[Comment("只执行一次")]
public bool DoOnce { get; set; } = false;
/// <summary>
/// 任务分组
/// </summary>
/// <example>ewide</example>
//[Comment("任务分组")]
//public string JobGroup { get; set; }
/// <summary>
/// 立即执行(默认等待启动)
/// </summary>
[Comment("立即执行")]
public bool StartNow { get; set; } = false;
// <summary>
/// 执行类型(并行、列队)
/// </summary>
[Comment("执行类型")]
public SpareTimeExecuteTypes ExecuteType { get; set; } = SpareTimeExecuteTypes.Parallel;
/// <summary>
/// 开始时间
/// </summary>
[Comment("开始时间")]
public DateTime BeginTime { get; set; } = DateTime.Now;
/// <summary>
/// 结束时间
/// </summary>
/// <example>null</example>
[Comment("结束时间")]
public DateTime? EndTime { get; set; }
/// <summary>
/// Cron表达式
/// </summary>
/// <example></example>
[Comment("Cron表达式")]
public string Cron { get; set; }
/// <summary>
/// 执行次数(默认无限循环)
/// </summary>
/// <example>10</example>
[Comment("执行次数")]
public int? RunNumber { get; set; }
/// <summary>
/// 执行间隔时间单位秒如果有Cron则IntervalSecond失效
/// </summary>
/// <example>5</example>
[Comment("执行间隔时间")]
public int? Interval { get; set; } = 5;
/// <summary>
/// 触发器类型
/// </summary>
//[Comment("触发器类型")]
//public TriggerTypeEnum TriggerType { get; set; } = TriggerTypeEnum.Simple;
/// <summary>
/// 定时器类型
/// </summary>
[Comment("定时器类型")]
public SpareTimeTypes TimerType { get; set; } = SpareTimeTypes.Interval;
/// <summary>
/// 请求url
/// </summary>
[Comment("请求url")]
public string RequestUrl { get; set; }
/// <summary>
/// 请求参数PostPut请求用
/// </summary>
[Comment("请求参数")]
public string RequestParameters { get; set; }
/// <summary>
/// Headers(可以包含如Authorization授权认证)
/// 格式:{"Authorization":"userpassword.."}
/// </summary>
[Comment("Headers")]
public string Headers { get; set; }
/// <summary>
/// 请求类型
/// </summary>
/// <example>2</example>
[Comment("请求类型")]
public RequestTypeEnum RequestType { get; set; } = RequestTypeEnum.Post;
/// <summary>
/// 备注
/// </summary>
[Comment("备注")]
public string Remark { get; set; }
}
}

View File

@@ -0,0 +1,181 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 用户表
/// </summary>
[Table("sys_user")]
[Comment("用户表")]
public class SysUser : DEntityBase, IEntityTypeBuilder<SysUser>
{
/// <summary>
/// 账号
/// </summary>
[Comment("账号")]
[Required, MaxLength(20)]
public string Account { get; set; }
/// <summary>
/// 密码采用MD5加密
/// </summary>
[Comment("密码")]
[Required]
public string Password { get; set; }
/// <summary>
/// 密码安全级别,在注册和修改密码时生成
/// </summary>
[Comment("密码安全级别")]
[Required]
public int SecurityLevel { get; set; }
/// <summary>
/// 昵称
/// </summary>
[Comment("昵称")]
[MaxLength(20)]
public string NickName { get; set; }
/// <summary>
/// 姓名
/// </summary>
[Comment("姓名")]
[MaxLength(20)]
public string Name { get; set; }
/// <summary>
/// 头像
/// </summary>
[Comment("头像")]
public string Avatar { get; set; }
/// <summary>
/// 生日
/// </summary>
[Comment("生日")]
public DateTime? Birthday { get; set; }
/// <summary>
/// 性别-男_1、女_2
/// </summary>
[Comment("性别-男_1、女_2")]
public int Sex { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[Comment("邮箱")]
[MaxLength(30)]
public string Email { get; set; }
/// <summary>
/// 手机
/// </summary>
[Comment("手机")]
[MaxLength(30)]
public string Phone { get; set; }
/// <summary>
/// 电话
/// </summary>
[Comment("电话")]
[MaxLength(30)]
public string Tel { get; set; }
/// <summary>
/// 最后登录IP
/// </summary>
[Comment("最后登录IP")]
[MaxLength(30)]
public string LastLoginIp { get; set; }
/// <summary>
/// 最后登录时间
/// </summary>
[Comment("最后登录时间")]
public DateTime LastLoginTime { get; set; }
/// <summary>
/// 管理员类型-超级管理员_1、非管理员_2
/// </summary>
[Comment("管理员类型-超级管理员_1、非管理员_2")]
public AdminType AdminType { get; set; } = AdminType.None;
/// <summary>
/// 状态-正常_0、停用_1、删除_2
/// </summary>
[Comment("状态-正常_0、停用_1、删除_2")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 多对多(角色)
/// </summary>
[XmlIgnore]
public ICollection<SysRole> SysRoles { get; set; }
/// <summary>
/// 多对多中间表(用户-角色)
/// </summary>
[XmlIgnore]
public List<SysUserRole> SysUserRoles { get; set; }
/// <summary>
/// 多对多(机构)
/// </summary>
[XmlIgnore]
public ICollection<SysOrg> SysOrgs { get; set; }
/// <summary>
/// 多对多中间表(用户-机构 数据范围)
/// </summary>
[XmlIgnore]
public List<SysUserDataScope> SysUserDataScopes { get; set; }
[XmlIgnore]
public ICollection<SysAreaCode> AreaCodes { get; set; }
/// <summary>
/// 多对多中间表(用户-区域 数据范围)
/// </summary>
[XmlIgnore]
public List<SysUserArea> SysUserAreas { get; set; }
/// <summary>
/// 配置多对多关系
/// </summary>
/// <param name="entityBuilder"></param>
/// <param name="dbContext"></param>
/// <param name="dbContextLocator"></param>
public void Configure(EntityTypeBuilder<SysUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
{
entityBuilder.HasMany(p => p.SysRoles).WithMany(p => p.SysUsers).UsingEntity<SysUserRole>(
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysUserRoles).HasForeignKey(c => c.SysRoleId),
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserRoles).HasForeignKey(c => c.SysUserId),
u =>
{
u.HasKey(c => new { c.SysUserId, c.SysRoleId });
});
entityBuilder.HasMany(p => p.SysOrgs).WithMany(p => p.SysUsers).UsingEntity<SysUserDataScope>(
u => u.HasOne(c => c.SysOrg).WithMany(c => c.SysUserDataScopes).HasForeignKey(c => c.SysOrgId),
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserDataScopes).HasForeignKey(c => c.SysUserId),
u =>
{
u.HasKey(c => new { c.SysUserId, c.SysOrgId });
});
entityBuilder.HasMany(p => p.AreaCodes).WithMany(p => p.SysUsers).UsingEntity<SysUserArea>(
u => u.HasOne(c => c.Area).WithMany(c => c.SysUserAreas).HasForeignKey(c => c.AreaCode),
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserAreas).HasForeignKey(c => c.SysUserId),
u =>
{
u.HasKey(c => new { c.SysUserId, c.AreaCode });
});
}
}
}

View File

@@ -0,0 +1,27 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
[Table("sys_user_area")]
[Comment("用户授权区域信息")]
public class SysUserArea: IEntity
{
/// <summary>
/// 用户Id
/// </summary>
[Comment("用户Id")]
[Column("SysUserId", TypeName = "varchar(36)")]
public string SysUserId { get; set; }
[XmlIgnore]
public SysUser SysUser { get; set; }
[Comment("系统使用的区域代码")]
[MaxLength(10)]
public string AreaCode { get; set; }
[XmlIgnore]
public SysAreaCode Area { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 用户数据范围表
/// </summary>
[Table("sys_user_data_scope")]
[Comment("用户数据范围表")]
public class SysUserDataScope : IEntity
{
/// <summary>
/// 用户Id
/// </summary>
[Comment("用户Id")]
[Column("SysUserId", TypeName = "varchar(36)")]
public string SysUserId { get; set; }
/// <summary>
/// 一对一引用(系统用户)
/// </summary>
[XmlIgnore]
public SysUser SysUser { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[Comment("机构Id")]
[Column("SysOrgId", TypeName = "varchar(36)")]
public string SysOrgId { get; set; }
/// <summary>
/// 一对一引用(系统机构)
/// </summary>
[XmlIgnore]
public SysOrg SysOrg { get; set; }
}
}

View File

@@ -0,0 +1,41 @@
using Furion.DatabaseAccessor;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace Ewide.Core
{
/// <summary>
/// 用户角色表
/// </summary>
[Table("sys_user_role")]
[Comment("用户角色表")]
public class SysUserRole : IEntity
{
/// <summary>
/// 用户Id
/// </summary>
[Comment("用户Id")]
[Column("SysUserId", TypeName = "varchar(36)")]
public string SysUserId { get; set; }
/// <summary>
/// 一对一引用(系统用户)
/// </summary>
[XmlIgnore]
public SysUser SysUser { get; set; }
/// <summary>
/// 系统角色Id
/// </summary>
[Comment("角色Id")]
[Column("SysRoleId", TypeName = "varchar(36)")]
public string SysRoleId { get; set; }
/// <summary>
/// 一对一引用(系统角色)
/// </summary>
[XmlIgnore]
public SysRole SysRole { get; set; }
}
}