添加项目文件。

master
Administrator 2 years ago
parent fcd0eace22
commit 3a0254a65c

@ -0,0 +1,47 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Magic.Core.Entity;
namespace Magic.Application.Entity
{
/// <summary>
/// 求职信息
/// </summary>
[SugarTable("jobhunt_message")]
[Description("求职信息")]
public class JobhuntMessage : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 求职详情
/// </summary>
public string PositionInfo { get; set; }
/// <summary>
/// 求职标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 求职状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 经验
/// </summary>
public int Experience { get; set; }
/// <summary>
/// 标签
/// </summary>
public string Tag { get; set; }
/// <summary>
/// 省份
/// </summary>
public int ProvinceId { get; set; }
/// <summary>
/// 城市
/// </summary>
public int CityId { get; set; }
}
}

@ -0,0 +1,63 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Magic.Core.Entity;
namespace Magic.Application.Entity
{
/// <summary>
/// 招聘消息
/// </summary>
[SugarTable("recruit_message")]
[Description("招聘消息")]
public class RecruitMessage : DEntityBase
{
/// <summary>
/// 租户Id
/// </summary>
public long TenantId { get; set; }
/// <summary>
/// 职位详情
/// </summary>
public string PositionInfo { get; set; }
/// <summary>
/// 标题
/// </summary>
public string Title { get; set; }
/// <summary>
/// 状态
/// </summary>
public int Status { get; set; }
/// <summary>
/// 省份
/// </summary>
public int ProvinceId { get; set; }
/// <summary>
/// 城市
/// </summary>
public int CityId { get; set; }
/// <summary>
/// 区
/// </summary>
public int AreaId { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public int Address { get; set; }
/// <summary>
/// 联系电话
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 标签
/// </summary>
public string Tag { get; set; }
/// <summary>
/// 学历
/// </summary>
public int Education { get; set; }
/// <summary>
/// 经验
/// </summary>
public int Experience { get; set; }
}
}

@ -0,0 +1,24 @@
using System;
using SqlSugar;
using System.ComponentModel;
using Magic.Core.Entity;
namespace Magic.Application.Entity
{
/// <summary>
/// 系统地区数据
/// </summary>
[SugarTable("sys_area")]
[Description("系统地区数据")]
public class SysArea : AutoIncrementEntity
{
/// <summary>
/// 父级ID
/// </summary>
public Int16 parent_id { get; set; }
/// <summary>
/// 地区名
/// </summary>
public string name { get; set; }
}
}

@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<NoWarn>1701;1702;1591</NoWarn>
<DocumentationFile>Magic.Application.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Remove="applicationsettings.json" />
<None Remove="Magic.Application.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="applicationsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Magic.Application.xml" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Magic.Core\Magic.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="Entity\" />
</ItemGroup>
</Project>

@ -0,0 +1,133 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>Magic.Application</name>
</assembly>
<members>
<member name="T:Magic.Application.Entity.JobhuntMessage">
<summary>
求职信息
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.PositionInfo">
<summary>
求职详情
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.Title">
<summary>
求职标题
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.Status">
<summary>
求职状态
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.Experience">
<summary>
经验
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.Tag">
<summary>
标签
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.ProvinceId">
<summary>
省份
</summary>
</member>
<member name="P:Magic.Application.Entity.JobhuntMessage.CityId">
<summary>
城市
</summary>
</member>
<member name="T:Magic.Application.Entity.RecruitMessage">
<summary>
招聘消息
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.TenantId">
<summary>
租户Id
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.PositionInfo">
<summary>
职位详情
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Title">
<summary>
标题
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Status">
<summary>
状态
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.ProvinceId">
<summary>
省份
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.CityId">
<summary>
城市
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.AreaId">
<summary>
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Address">
<summary>
详细地址
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Phone">
<summary>
联系电话
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Tag">
<summary>
标签
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Education">
<summary>
学历
</summary>
</member>
<member name="P:Magic.Application.Entity.RecruitMessage.Experience">
<summary>
经验
</summary>
</member>
<member name="T:Magic.Application.Entity.SysArea">
<summary>
系统地区数据
</summary>
</member>
<member name="P:Magic.Application.Entity.SysArea.parent_id">
<summary>
父级ID
</summary>
</member>
<member name="P:Magic.Application.Entity.SysArea.name">
<summary>
地区名
</summary>
</member>
</members>
</doc>

@ -0,0 +1,3 @@
1、原则上服务应该放在Application层次考虑将咱自己的业务层直接写在Application里面好些后续升级后咱大家直接升级就行了减少冲突
2、系统默认ORM为EF Core如果觉得不趁手可以自行更换
3、在此应用层默认集成了SqlSugar,其他ORM类同可以多个ORM并行开发熟悉哪个用哪个

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Magic.Application.Service;
public interface ITestService
{
Task TestChangeDatabase();
}

@ -0,0 +1,80 @@
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Furion.FriendlyException;
using Furion.JsonSerialization;
using Furion.Logging.Extensions;
using Magic.Core;
using Magic.Core.Entity;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Text.Json;
using System.Threading.Tasks;
namespace Magic.Application.Service;
[ApiDescriptionSettings("Application",Name = "Test", Order = 1)]
public class TestService : ITestService, IDynamicApiController, ITransient
{
private readonly SqlSugarRepository<Documentation> _userRep;
public TestService(SqlSugarRepository<Documentation> userRep)
{
_userRep=userRep;
}
[AllowAnonymous]
public void TestDatabaseChange() {
Type[] types = new Type[] { typeof(SysUser) };
var diffString = _userRep.Context.CodeFirst.GetDifferenceTables(types).ToDiffList();
Console.Write(diffString);
}
[HttpGet("/test/TestChangeDatabase")]
[AllowAnonymous]
public async Task TestChangeDatabase()
{
var user = await _userRep.ToListAsync();
_userRep.CurrentBeginTran();
_userRep.CurrentCommitTran();
}
[AllowAnonymous]
public async Task<Student> JsonSerializerTest(string json) {
string us = UserManager.Account;
var sq = JsonSerializer.Deserialize<Student>(json);
var ss= Newtonsoft.Json.JsonConvert.DeserializeObject<Student>(json);
var s = JSON.Deserialize<Student>(json);
return s;
}
[LoggingMonitor]
public void TestLog()
{
throw Oops.Bah($"业务异常{DateTime.Now}");
}
[AllowAnonymous]
public void TestLog2()
{
Student student = null;
student.FirstName = "hahah";
}
[NonUnify]
public void TestLogInfo()
{
$"info日志{DateTime.Now}".LogInformation();
}
}
public class Student {
public string FirstName { get; set; }
public int RealAge { get; set; }
}

@ -0,0 +1,12 @@
using Furion;
using Microsoft.Extensions.DependencyInjection;
namespace Magic.Application;
public class Startup : AppStartup
{
public void ConfigureServices(IServiceCollection services)
{
}
}

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Magic.Web.Core\Magic.Web.Core.csproj" />
</ItemGroup>
</Project>

@ -0,0 +1,223 @@
// See https://aka.ms/new-console-template for more information
using Magic.CodeFirst;
using Magic.Core;
using Magic.Core.Entity;
using Microsoft.Extensions.Configuration;
using SqlSugar;
using System.Collections;
using System.Data;
using System.Reflection;
using System.Text;
var assembles = new string[] { "Magic.FlowCenter.dll", "Magic.Core.dll" };
//首先创建数据库
CreateDatabase();
//初始化表结构
InitDatabase(assembles);
//插入种子数据
InsertData();
Console.WriteLine("数据库迁移成功");
Console.ReadLine();
static void CreateDatabase() {
var conn = SqlSugarHelper.GetSetting();
SqlSugarHelper.Db().GetConnectionScope(conn.DefaultDbNumber).DbMaintenance.CreateDatabase();
foreach (var item in conn.DbConfigs)
{
if (item.DbType != SqlSugar.DbType.Oracle.ToString())
SqlSugarHelper.Db().GetConnectionScope(item.DbNumber).DbMaintenance.CreateDatabase();
}
}
static void InitDatabase(string[] assembles) {
var conn = SqlSugarHelper.GetSetting();
var configIds = new List<string>();
configIds.Add(conn.DefaultDbNumber);
foreach (var item in conn.DbConfigs)
{
configIds.Add(item.DbNumber);
}
foreach (var item in assembles)
{
Type[] types = Assembly
.LoadFrom(item)//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
.GetTypes()
.Where(m => m.GetCustomAttribute<SugarTable>() != null && m.Name != "FlcFlowinstanceOutput")
.ToArray();
foreach (Type type in types) {
if (type.GetCustomAttribute<TenantAttribute>() == null)
{
SqlSugarHelper.Db().CodeFirst.InitTables(type);
}
else {
SqlSugarHelper.Db().GetConnectionScope(type.GetCustomAttribute<TenantAttribute>().configId).CodeFirst.InitTables(type);
}
}
//SqlSugarHelper.Db().CodeFirst.InitTables(types);
Console.WriteLine($"数据库{item}创建成功");
}
}
static void CreateSeedData(string[] assembles)
{
foreach (var item in assembles)
{
Type[] types = Assembly
.LoadFrom(item)//如果 .dll报错可以换成 xxx.exe 有些生成的是exe
.GetTypes()
.Where(m => m.GetCustomAttribute<SugarTable>() != null && m.Name != "FlcFlowinstanceOutput")
.ToArray();
//Get type of Worker
SelectTable worker = new SelectTable();
//Get type of Worker
Type workerType = typeof(SelectTable);
//Get Generic Method
MethodInfo staticDoWorkMethod = workerType.GetMethod("GetAll");
//Invoke StaticDoWork<T>
foreach (Type curType in types)
{
if (curType.IsClass && !curType.IsAbstract)
{
MethodInfo curMethod = staticDoWorkMethod.MakeGenericMethod(curType);
var list = curMethod.Invoke(null, null);
if (list == null) continue;
var path = Path.Combine(@"D:\Workspace\admin-net-sqlsugar\backend\Magic.CodeFirst\SeedData", $"{curType.Name}SeedData.cs");
if (File.Exists(path))
File.Delete(path);
FileStream fs = new FileStream(path, FileMode.CreateNew, FileAccess.ReadWrite);
StreamWriter sw = new StreamWriter(fs);
StringBuilder sb = new StringBuilder($@"using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class {curType.Name}SeedData : ISeedData , ISqlSugarEntitySeedData<{curType.Name}>
{{ public IEnumerable<{curType.Name}> HasData()
{{ string json = @""");
sb.AppendLine(JsonUtil.ToJsonString(list).Replace(@"""", @""""""));
sb.AppendLine(@""";");
sb.AppendLine($@" List<{curType.Name}> list = JsonUtil.ToObject<List<{curType.Name}>>(json);
return list;");
sb.AppendLine(@"}}");
sw.Write(sb.ToString());
sw.Flush();
sw.Close();
};
}
}
}
static void InsertData()
{
var baseType = typeof(ISeedData);
var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
var referencedAssemblies = System.IO.Directory.GetFiles(path, "Magic.CodeFirst.dll").Select(Assembly.LoadFrom).ToArray();
var seedDataTypes = referencedAssemblies
.SelectMany(a => a.DefinedTypes)
.Select(type => type.AsType())
.Where(x => x != baseType && baseType.IsAssignableFrom(x)).ToArray();
foreach (var seedType in seedDataTypes)
{
var instance = Activator.CreateInstance(seedType);
var hasDataMethod = seedType.GetMethod("HasData");
var seedData = ((IEnumerable)hasDataMethod?.Invoke(instance, null))?.Cast<object>();
if (seedData == null) continue;
var entityType = seedType.GetInterfaces().First().GetGenericArguments().First();
var seedDataTable = seedData.ToList().ToDataTable();
seedDataTable.TableName = SqlSugarHelper.Db().EntityMaintenance.GetEntityInfo(entityType).DbTableName;
var storage = SqlSugarHelper.Db().Storageable(seedDataTable).ToStorage();
storage.AsInsertable.ExecuteCommand();
}
}
public static class ObjectExtension
{
public static DataTable ToDataTable<T>(this List<T> list)
{
DataTable result = new();
if (list.Count > 0)
{
// result.TableName = list[0].GetType().Name; // 表名赋值
PropertyInfo[] propertys = list[0].GetType().GetProperties();
foreach (PropertyInfo pi in propertys)
{
Type colType = pi.PropertyType;
if (colType.IsGenericType && colType.GetGenericTypeDefinition() == typeof(Nullable<>))
{
colType = colType.GetGenericArguments()[0];
}
if (IsIgnoreColumn(pi))
continue;
result.Columns.Add(pi.Name, colType);
}
for (int i = 0; i < list.Count; i++)
{
ArrayList tempList = new();
foreach (PropertyInfo pi in propertys)
{
if (IsIgnoreColumn(pi))
continue;
object obj = pi.GetValue(list[i], null);
tempList.Add(obj);
}
object[] array = tempList.ToArray();
result.LoadDataRow(array, true);
}
}
return result;
}
private static bool IsIgnoreColumn(PropertyInfo pi)
{
var sc = pi.GetCustomAttributes<SugarColumn>(false).FirstOrDefault(u => u.IsIgnore == true);
return sc != null;
}
}
public class SelectTable
{
public static List<T> GetAll<T>()
{
var list = SqlSugarHelper.Db().Queryable<T>().ToList();
return list.Any() ? list : null;
}
}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class DocumentationSeedData : ISeedData , ISqlSugarEntitySeedData<Documentation>
{ public IEnumerable<Documentation> HasData()
{ string json = @"[{""PId"":0,""PIds"":null,""Name"":""新建文件夹"",""DocumentType"":1,""FileSuffix"":null,""FileSizeKb"":null,""FilePath"":null,""FileObjectName"":null,""Label"":3,""Remark"":null,""Visible"":true,""Children"":null,""CreatedTime"":""2022-04-27T11:15:12.403"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":282067396128837},{""PId"":282067396128837,""PIds"":null,""Name"":""logo.png"",""DocumentType"":2,""FileSuffix"":"".png"",""FileSizeKb"":25,""FilePath"":""Upload/Document/2022/4/27"",""FileObjectName"":""282067842687045.png"",""Label"":null,""Remark"":null,""Visible"":true,""Children"":null,""CreatedTime"":""2022-04-27T11:17:01.427"",""UpdatedTime"":""2022-04-27T11:20:46.45"",""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":282067842687046},{""PId"":282067396128837,""PIds"":null,""Name"":""呃呃呃"",""DocumentType"":1,""FileSuffix"":null,""FileSizeKb"":null,""FilePath"":null,""FileObjectName"":null,""Label"":3,""Remark"":null,""Visible"":true,""Children"":null,""CreatedTime"":""2022-04-27T11:21:14.207"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":282068878082117}]
";
List<Documentation> list = JsonUtil.ToObject<List<Documentation>>(json);
return list;
}}

@ -0,0 +1,17 @@
namespace Magic.CodeFirst;
/// <summary>
/// 实体种子数据接口
/// </summary>
/// <typeparam name="TEntity"></typeparam>
public interface ISqlSugarEntitySeedData<TEntity>
where TEntity : class, new()
{
/// <summary>
/// 种子数据
/// </summary>
/// <returns></returns>
IEnumerable<TEntity> HasData();
}
public class ISeedData { }

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysAppSeedData : ISeedData , ISqlSugarEntitySeedData<SysApp>
{ public IEnumerable<SysApp> HasData()
{ string json = @"[{""Name"":""平台管理"",""Code"":""system"",""Active"":""Y"",""Status"":0,""Sort"":100,""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":142307070898245},{""Name"":""系统管理"",""Code"":""manage"",""Active"":""N"",""Status"":0,""Sort"":300,""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":142307070902341},{""Name"":""运营管理"",""Code"":""platform"",""Active"":""N"",""Status"":0,""Sort"":200,""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":142307070922826},{""Name"":""业务应用"",""Code"":""busiapp"",""Active"":""N"",""Status"":0,""Sort"":400,""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":142307070922869},{""Name"":""流程中心"",""Code"":""flowcenter"",""Active"":""N"",""Status"":0,""Sort"":500,""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":246681684324421}]
";
List<SysApp> list = JsonUtil.ToObject<List<SysApp>>(json);
return list;
}}

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysCodeGenSeedData : ISeedData , ISqlSugarEntitySeedData<SysCodeGen>
{ public IEnumerable<SysCodeGen> HasData()
{ string json = @"[{""AuthorName"":""Magic"",""TablePrefix"":null,""GenerateType"":""2"",""TableName"":""Test"",""NameSpace"":""Magic.Application"",""BusName"":""测试"",""MenuApplication"":""busiapp"",""MenuPid"":0,""CreatedTime"":""2022-05-25T09:15:02.367"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""超级管理员"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":291946907033669}]
";
List<SysCodeGen> list = JsonUtil.ToObject<List<SysCodeGen>>(json);
return list;
}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysEmpPosSeedData : ISeedData , ISqlSugarEntitySeedData<SysEmpPos>
{ public IEnumerable<SysEmpPos> HasData()
{ string json = @"[{""SysEmpId"":177325484421189,""SysPosId"":177325394366533},{""SysEmpId"":182314279026757,""SysPosId"":177325394366533}]
";
List<SysEmpPos> list = JsonUtil.ToObject<List<SysEmpPos>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysEmpSeedData : ISeedData , ISqlSugarEntitySeedData<SysEmp>
{ public IEnumerable<SysEmp> HasData()
{ string json = @"[{""JobNum"":null,""OrgId"":177325089079365,""OrgName"":""系统机构"",""Id"":142307070910551},{""JobNum"":""1"",""OrgId"":175624015089733,""OrgName"":""土豆新车"",""Id"":175624015269957},{""JobNum"":null,""OrgId"":177325089079365,""OrgName"":""系统机构"",""Id"":177325484421189},{""JobNum"":null,""OrgId"":182313953165381,""OrgName"":""机构1"",""Id"":182314279026757},{""JobNum"":""1"",""OrgId"":278024843092037,""OrgName"":""租户1"",""Id"":278024843153477}]
";
List<SysEmp> list = JsonUtil.ToObject<List<SysEmp>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysFileSeedData : ISeedData , ISqlSugarEntitySeedData<SysFile>
{ public IEnumerable<SysFile> HasData()
{ string json = @"[{""FileLocation"":4,""FileBucket"":""LOCAL"",""FileOriginName"":""icon_avatar.png"",""FileSuffix"":""png"",""FileSizeKb"":""4"",""FileSizeInfo"":null,""FileObjectName"":""178111296725062.png"",""FilePath"":""Upload/Default"",""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":178111296725061},{""FileLocation"":4,""FileBucket"":""LOCAL"",""FileOriginName"":""icon_alipay.png"",""FileSuffix"":""png"",""FileSizeKb"":""22"",""FileSizeInfo"":null,""FileObjectName"":""188632919339077.png"",""FilePath"":""Upload/Avatar"",""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":188632919339077}]
";
List<SysFile> list = JsonUtil.ToObject<List<SysFile>>(json);
return list;
}}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysNoticeUserSeedData : ISeedData , ISqlSugarEntitySeedData<SysNoticeUser>
{ public IEnumerable<SysNoticeUser> HasData()
{ string json = @"[{""NoticeId"":179794426552389,""UserId"":177325484421189,""ReadTime"":""2021-07-12T11:40:09.753"",""ReadStatus"":1},{""NoticeId"":179794551148613,""UserId"":177325484421189,""ReadTime"":""2021-07-12T11:40:13.633"",""ReadStatus"":1},{""NoticeId"":179798127382597,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179798369882181,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179799297638469,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179799792885829,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179799966392389,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179800281276485,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179803119427653,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179803196371013,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179803415650373,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179826348257349,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179801393012805,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179801499226181,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":179801551765573,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0},{""NoticeId"":193416668713029,""UserId"":177325484421189,""ReadTime"":""1753-01-01T00:00:00"",""ReadStatus"":0}]
";
List<SysNoticeUser> list = JsonUtil.ToObject<List<SysNoticeUser>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysOrgSeedData : ISeedData , ISqlSugarEntitySeedData<SysOrg>
{ public IEnumerable<SysOrg> HasData()
{ string json = @"[{""Pid"":0,""Pids"":""[0],"",""Name"":""土豆新车"",""Code"":""1"",""Contacts"":""tdadmin"",""Tel"":null,""Sort"":0,""Remark"":null,""Status"":0,""TenantId"":175624014975045,""CreatedTime"":""2021-06-30T16:35:58.83"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175624015089733},{""Pid"":0,""Pids"":""[0],"",""Name"":""系统机构"",""Code"":""SystemOrg"",""Contacts"":null,""Tel"":null,""Sort"":1,""Remark"":null,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-05T11:57:40.097"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":177325089079365},{""Pid"":177325089079365,""Pids"":""[0],[177325089079365],"",""Name"":""机构1"",""Code"":""1"",""Contacts"":null,""Tel"":null,""Sort"":100,""Remark"":null,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-19T14:17:24.493"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":182313953165381},{""Pid"":182313953165381,""Pids"":""[0],[177325089079365],[182313953165381],"",""Name"":""机构2"",""Code"":""2"",""Contacts"":null,""Tel"":null,""Sort"":100,""Remark"":null,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-19T14:17:38.037"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":182314008641605},{""Pid"":0,""Pids"":""[0],"",""Name"":""租户1"",""Code"":""1"",""Contacts"":""租户1管理员"",""Tel"":null,""Sort"":0,""Remark"":null,""Status"":0,""TenantId"":278024843046981,""CreatedTime"":""2022-04-16T01:06:00.98"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":278024843092037}]
";
List<SysOrg> list = JsonUtil.ToObject<List<SysOrg>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysPosSeedData : ISeedData , ISqlSugarEntitySeedData<SysPos>
{ public IEnumerable<SysPos> HasData()
{ string json = @"[{""Name"":""系统职位"",""Code"":""SystemPos"",""Sort"":1,""Remark"":null,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-05T11:58:54.63"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":177325394366533}]
";
List<SysPos> list = JsonUtil.ToObject<List<SysPos>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysRoleDataScopeSeedData : ISeedData , ISqlSugarEntitySeedData<SysRoleDataScope>
{ public IEnumerable<SysRoleDataScope> HasData()
{ string json = @"[{""SysRoleId"":278024843124805,""SysOrgId"":278024843092037}]
";
List<SysRoleDataScope> list = JsonUtil.ToObject<List<SysRoleDataScope>>(json);
return list;
}}

File diff suppressed because one or more lines are too long

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysRoleSeedData : ISeedData , ISqlSugarEntitySeedData<SysRole>
{ public IEnumerable<SysRole> HasData()
{ string json = @"[{""Name"":""系统管理员"",""Code"":""1"",""Sort"":0,""DataScopeType"":1,""Remark"":null,""Status"":0,""RoleType"":1,""TenantId"":175624014975045,""CreatedTime"":""2021-06-30T16:35:58.853"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175624015192133},{""Name"":""财务"",""Code"":""cw"",""Sort"":100,""DataScopeType"":1,""Remark"":null,""Status"":0,""RoleType"":0,""TenantId"":175624014975045,""CreatedTime"":""2021-06-30T17:06:59.447"",""UpdatedTime"":null,""CreatedUserId"":175624015269957,""CreatedUserName"":""toudou@qq.com"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175631636172869},{""Name"":""普通用户"",""Code"":""pt"",""Sort"":100,""DataScopeType"":1,""Remark"":null,""Status"":0,""RoleType"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-06-30T17:13:32.56"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175633246363717},{""Name"":""系统管理员"",""Code"":""1"",""Sort"":0,""DataScopeType"":1,""Remark"":null,""Status"":0,""RoleType"":1,""TenantId"":278024843046981,""CreatedTime"":""2022-04-16T01:06:00.987"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":278024843124805}]
";
List<SysRole> list = JsonUtil.ToObject<List<SysRole>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysTenantSeedData : ISeedData , ISqlSugarEntitySeedData<SysTenant>
{ public IEnumerable<SysTenant> HasData()
{ string json = @"[{""Name"":""系统租户"",""AdminName"":""SystemAdmin"",""Host"":null,""Email"":""SystemAdmin"",""Phone"":null,""Connection"":null,""Schema"":null,""Remark"":null,""TenantType"":1,""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":142307070918780},{""Name"":""土豆新车"",""AdminName"":""tdadmin"",""Host"":null,""Email"":""toudou@qq.com"",""Phone"":null,""Connection"":null,""Schema"":null,""Remark"":null,""TenantType"":0,""CreatedTime"":""2021-06-30T16:35:58.803"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175624014975045},{""Name"":""租户1"",""AdminName"":""租户1管理员"",""Host"":null,""Email"":""zuhutest"",""Phone"":null,""Connection"":null,""Schema"":null,""Remark"":null,""TenantType"":0,""CreatedTime"":""2022-04-16T01:06:00.967"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":278024843046981}]
";
List<SysTenant> list = JsonUtil.ToObject<List<SysTenant>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysTestSeedData : ISeedData , ISqlSugarEntitySeedData<Test>
{ public IEnumerable<Test> HasData()
{ string json = @"[{""Account"":""superAdmin"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""superAdmin"",""Name"":""超级管理员"",""Avatar"":""188632919339077"",""Birthday"":""1753-01-01T00:00:00"",""Sex"":1,""Email"":null,""Phone"":""18020030720"",""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2022-05-25T09:12:40.45"",""AdminType"":1,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":null,""UpdatedTime"":""2021-08-06T10:49:21.047"",""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":142307070910551},{""Account"":""toudou@qq.com"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""tdadmin"",""Name"":""tdadmin"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":0,""Email"":""toudou@qq.com"",""Phone"":null,""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2022-04-16T00:42:43.103"",""AdminType"":2,""Status"":0,""TenantId"":175624014975045,""CreatedTime"":""2021-06-30T16:35:58.873"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175624015269957},{""Account"":""admin"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""admin"",""Name"":""管理员"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":1,""Email"":null,""Phone"":""15959110752"",""Tel"":null,""LastLoginIp"":""0.0.0.1"",""LastLoginTime"":""2021-08-19T23:55:06.2"",""AdminType"":0,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-05T11:59:16.617"",""UpdatedTime"":""2021-08-19T23:10:52.907"",""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":177325484421189},{""Account"":""zhangsan"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""张三"",""Name"":""张三"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":1,""Email"":null,""Phone"":""15959110751"",""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2021-07-19T15:13:27.183"",""AdminType"":0,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-19T14:18:44.05"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":182314279026757},{""Account"":""zuhutest"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""租户1管理员"",""Name"":""租户1管理员"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":0,""Email"":""zuhutest"",""Phone"":null,""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2022-04-16T01:06:31.343"",""AdminType"":2,""Status"":0,""TenantId"":278024843046981,""CreatedTime"":""2022-04-16T01:06:00.993"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":278024843153477}]
";
List<Test> list = JsonUtil.ToObject<List<Test>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysTimerSeedData : ISeedData , ISqlSugarEntitySeedData<SysTimer>
{ public IEnumerable<SysTimer> HasData()
{ string json = @"[{""JobName"":""百度api"",""DoOnce"":false,""StartNow"":false,""ExecuteType"":1,""Interval"":5,""Cron"":null,""TimerType"":0,""RequestUrl"":""https://www.baidu.com"",""RequestParameters"":null,""Headers"":null,""RequestType"":2,""Remark"":""接口API"",""CreatedTime"":null,""UpdatedTime"":null,""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":142307070910556},{""JobName"":""异常日志"",""DoOnce"":false,""StartNow"":false,""ExecuteType"":1,""Interval"":1,""Cron"":null,""TimerType"":0,""RequestUrl"":""LogJobWorker/DoLogEx"",""RequestParameters"":null,""Headers"":null,""RequestType"":0,""Remark"":"""",""CreatedTime"":null,""UpdatedTime"":""2021-07-22T17:49:29.37"",""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":142307070910557},{""JobName"":""操作日志"",""DoOnce"":false,""StartNow"":false,""ExecuteType"":1,""Interval"":1,""Cron"":null,""TimerType"":0,""RequestUrl"":""LogJobWorker/DoLogOp"",""RequestParameters"":null,""Headers"":null,""RequestType"":0,""Remark"":"""",""CreatedTime"":null,""UpdatedTime"":""2021-07-22T17:49:31.363"",""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":142307070910558},{""JobName"":""访问日志"",""DoOnce"":false,""StartNow"":false,""ExecuteType"":1,""Interval"":1,""Cron"":null,""TimerType"":0,""RequestUrl"":""LogJobWorker/DoLogVis"",""RequestParameters"":null,""Headers"":null,""RequestType"":0,""Remark"":"""",""CreatedTime"":null,""UpdatedTime"":""2021-07-22T17:49:33.267"",""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":142307070910559}]
";
List<SysTimer> list = JsonUtil.ToObject<List<SysTimer>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysUserDataScopeSeedData : ISeedData , ISqlSugarEntitySeedData<SysUserDataScope>
{ public IEnumerable<SysUserDataScope> HasData()
{ string json = @"[{""SysUserId"":175624015269957,""SysOrgId"":175624015089733},{""SysUserId"":278024843153477,""SysOrgId"":278024843092037}]
";
List<SysUserDataScope> list = JsonUtil.ToObject<List<SysUserDataScope>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysUserRoleSeedData : ISeedData , ISqlSugarEntitySeedData<SysUserRole>
{ public IEnumerable<SysUserRole> HasData()
{ string json = @"[{""SysUserId"":175624015269957,""SysRoleId"":175624015192133},{""SysUserId"":177325484421189,""SysRoleId"":175633246363717},{""SysUserId"":182314279026757,""SysRoleId"":175633246363717},{""SysUserId"":278024843153477,""SysRoleId"":278024843124805}]
";
List<SysUserRole> list = JsonUtil.ToObject<List<SysUserRole>>(json);
return list;
}}

@ -0,0 +1,13 @@
using Magic.Core;
using Magic.Core.Entity;
namespace Magic.CodeFirst;
public class SysUserSeedData : ISeedData , ISqlSugarEntitySeedData<SysUser>
{ public IEnumerable<SysUser> HasData()
{ string json = @"[{""Account"":""superAdmin"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""superAdmin"",""Name"":""超级管理员"",""Avatar"":""188632919339077"",""Birthday"":""1753-01-01T00:00:00"",""Sex"":1,""Email"":null,""Phone"":""18020030720"",""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2022-05-25T09:12:40.45"",""AdminType"":1,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":null,""UpdatedTime"":""2021-08-06T10:49:21.047"",""CreatedUserId"":null,""CreatedUserName"":null,""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":142307070910551},{""Account"":""toudou@qq.com"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""tdadmin"",""Name"":""tdadmin"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":0,""Email"":""toudou@qq.com"",""Phone"":null,""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2022-04-16T00:42:43.103"",""AdminType"":2,""Status"":0,""TenantId"":175624014975045,""CreatedTime"":""2021-06-30T16:35:58.873"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":175624015269957},{""Account"":""admin"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""admin"",""Name"":""管理员"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":1,""Email"":null,""Phone"":""15959110752"",""Tel"":null,""LastLoginIp"":""0.0.0.1"",""LastLoginTime"":""2021-08-19T23:55:06.2"",""AdminType"":0,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-05T11:59:16.617"",""UpdatedTime"":""2021-08-19T23:10:52.907"",""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":142307070910551,""UpdatedUserName"":""superAdmin"",""IsDeleted"":false,""Id"":177325484421189},{""Account"":""zhangsan"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""张三"",""Name"":""张三"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":1,""Email"":null,""Phone"":""15959110751"",""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2021-07-19T15:13:27.183"",""AdminType"":0,""Status"":0,""TenantId"":142307070918780,""CreatedTime"":""2021-07-19T14:18:44.05"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":182314279026757},{""Account"":""zuhutest"",""Password"":""e10adc3949ba59abbe56e057f20f883e"",""NickName"":""租户1管理员"",""Name"":""租户1管理员"",""Avatar"":null,""Birthday"":""1753-01-01T00:00:00"",""Sex"":0,""Email"":""zuhutest"",""Phone"":null,""Tel"":null,""LastLoginIp"":""127.0.0.1"",""LastLoginTime"":""2022-04-16T01:06:31.343"",""AdminType"":2,""Status"":0,""TenantId"":278024843046981,""CreatedTime"":""2022-04-16T01:06:00.993"",""UpdatedTime"":null,""CreatedUserId"":142307070910551,""CreatedUserName"":""superAdmin"",""UpdatedUserId"":null,""UpdatedUserName"":null,""IsDeleted"":false,""Id"":278024843153477}]
";
List<SysUser> list = JsonUtil.ToObject<List<SysUser>>(json);
return list;
}}

@ -0,0 +1,114 @@
using Magic.Core;
using Microsoft.Extensions.Configuration;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Magic.CodeFirst;
public class SqlSugarHelper
{
//用单例模式
// public static SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()
// {
// ConnectionString = "Server=.;Database=MagicCodeFirst;User=sa;Password=123456;MultipleActiveResultSets=True;",//连接符字串
// DbType = DbType.SqlServer,//数据库类型
// IsAutoCloseConnection = true //不设成true要手动close
// },
//db => {
// //(A)全局生效配置点一般AOP和程序启动的配置扔这里面 ,所有上下文生效
// //调试SQL事件可以删掉
// db.Aop.OnLogExecuting = (sql, pars) =>
// {
// Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响
// //5.0.8.2 获取无参数化 SQL 对性能有影响特别大的SQL参数多的调试使用
// //UtilMethods.GetSqlString(DbType.SqlServer,sql,pars)
// };
// //多个配置就写下面
// //db.Ado.IsDisableMasterSlaveSeparation=true;
// });
public static ConnectionStringsOptions GetSetting()
{
var builder = new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("dbsettings.json", optional: false, reloadOnChange: true);
IConfigurationRoot config = builder.Build();
var conn = config.GetSection("ConnectionStrings").Get<ConnectionStringsOptions>();
return conn;
}
public static SqlSugarScope Db()
{
//数据库序号从0开始,默认数据库为0
var config = GetSetting();
//默认数据库
List<DbConfig> dbList = new List<DbConfig>();
DbConfig defaultdb = new DbConfig()
{
DbNumber = config.DefaultDbNumber,
DbString = config.DefaultDbString,
DbType = config.DefaultDbType
};
dbList.Add(defaultdb);
//业务数据库集合
foreach (var item in config.DbConfigs)
{
dbList.Add(item);
}
List<ConnectionConfig> connectConfigList = new List<ConnectionConfig>();
foreach (var item in dbList)
{
//防止数据库重复,导致的事务异常
if (connectConfigList.Any(a => a.ConfigId == (dynamic)item.DbNumber || a.ConnectionString == item.DbString))
{
continue;
}
connectConfigList.Add(new ConnectionConfig()
{
ConnectionString = item.DbString,
DbType = (DbType)Convert.ToInt32(Enum.Parse(typeof(DbType), item.DbType)),
IsAutoCloseConnection = true,
ConfigId = item.DbNumber,
InitKeyType = InitKeyType.Attribute,
MoreSettings = new ConnMoreSettings()
{
IsAutoRemoveDataCache = true//自动清理缓存
}
});
}
return new SqlSugarScope(connectConfigList,
//全局上下文生效
db =>
{
/*
* /
*/
foreach (var c in connectConfigList)
{
var dbProvider = db.GetConnectionScope((string)c.ConfigId);
//执行超时时间
dbProvider.Ado.CommandTimeOut = 30;
dbProvider.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine(sql);//输出sql,查看执行sql 性能无影响
};
}
});
}
}

@ -0,0 +1,12 @@
using System;
namespace Magic.Core;
/// <summary>
/// 启用用操作日志
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method | AttributeTargets.Property)]
public class OpLogAttribute : Attribute
{
}

@ -0,0 +1,39 @@
using System;
using System.Data;
namespace Magic.Core;
/// <summary>
/// SqlSugar 工作单元配置特性
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = true)]
public class SqlSugarUnitOfWorkAttribute : Attribute
{
/// <summary>
/// 构造函数
/// </summary>
public SqlSugarUnitOfWorkAttribute()
{
}
/// <summary>
/// 构造函数
/// </summary>
/// <remarks>
/// <para>支持传入事务隔离级别 <see cref="IsolationLevel"/> 参数值</para>
/// </remarks>
/// <param name="isolationLevel">事务隔离级别</param>
public SqlSugarUnitOfWorkAttribute(IsolationLevel isolationLevel)
{
IsolationLevel = isolationLevel;
}
/// <summary>
/// 事务隔离级别
/// </summary>
/// <remarks>
/// <para>默认:<see cref="IsolationLevel.ReadCommitted"/>,参见:<see cref="IsolationLevel"/></para>
/// <para>说明当事务A更新某条数据的时候不容许其他事务来更新该数据但可以进行读取操作</para>
/// </remarks>
public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;
}

@ -0,0 +1,113 @@
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Magic.Core;
/// <summary>
/// 缓存接口
/// </summary>
public interface ICache
{
/// <summary>
/// 用于在 key 存在时删除 key
/// </summary>
/// <param name="key">键</param>
long Del(params string[] key);
/// <summary>
/// 用于在 key 存在时删除 key
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
Task<long> DelAsync(params string[] key);
/// <summary>
/// 用于在 key 模板存在时删除
/// </summary>
/// <param name="pattern">key模板</param>
/// <returns></returns>
Task<long> DelByPatternAsync(string pattern);
/// <summary>
/// 检查给定 key 是否存在
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
bool Exists(string key);
/// <summary>
/// 检查给定 key 是否存在
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
Task<bool> ExistsAsync(string key);
/// <summary>
/// 获取指定 key 的值
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
string Get(string key);
/// <summary>
/// 获取指定 key 的值
/// </summary>
/// <typeparam name="T">byte[] 或其他类型</typeparam>
/// <param name="key">键</param>
/// <returns></returns>
T Get<T>(string key);
/// <summary>
/// 获取指定 key 的值
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
Task<string> GetAsync(string key);
/// <summary>
/// 获取指定 key 的值
/// </summary>
/// <typeparam name="T">byte[] 或其他类型</typeparam>
/// <param name="key">键</param>
/// <returns></returns>
Task<T> GetAsync<T>(string key);
/// <summary>
/// 设置指定 key 的值所有写入参数object都支持string | byte[] | 数值 | 对象
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
bool Set(string key, object value);
/// <summary>
/// 设置指定 key 的值所有写入参数object都支持string | byte[] | 数值 | 对象
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <param name="expire">有效期</param>
bool Set(string key, object value, TimeSpan expire);
/// <summary>
/// 设置指定 key 的值所有写入参数object都支持string | byte[] | 数值 | 对象
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <returns></returns>
Task<bool> SetAsync(string key, object value);
/// <summary>
/// 设置指定 key 的值所有写入参数object都支持string | byte[] | 数值 | 对象
/// </summary>
/// <param name="key">键</param>
/// <param name="value">值</param>
/// <param name="expire">有效期</param>
/// <returns></returns>
Task<bool> SetAsync(string key, object value, TimeSpan expire);
/// <summary>
/// 获取所有缓存
/// </summary>
/// <returns></returns>
List<string> GetAllKeys();
}

@ -0,0 +1,141 @@
using Furion.DependencyInjection;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Magic.Core;
/// <summary>
/// 内存缓存
/// </summary>
public class MemoryCache : ICache, ISingleton
{
private readonly IMemoryCache _memoryCache;
public MemoryCache(IMemoryCache memoryCache)
{
_memoryCache = memoryCache;
}
public long Del(params string[] key)
{
foreach (var k in key)
{
_memoryCache.Remove(k);
}
return key.Length;
}
public Task<long> DelAsync(params string[] key)
{
foreach (var k in key)
{
_memoryCache.Remove(k);
}
return Task.FromResult((long)key.Length);
}
public async Task<long> DelByPatternAsync(string pattern)
{
if (string.IsNullOrEmpty(pattern))
return default;
//pattern = Regex.Replace(pattern, @"\{*.\}", "(.*)");
var keys = GetAllKeys().Where(k => k.StartsWith(pattern));
if (keys != null && keys.Any())
return await DelAsync(keys.ToArray());
return default;
}
public bool Exists(string key)
{
return _memoryCache.TryGetValue(key, out _);
}
public Task<bool> ExistsAsync(string key)
{
return Task.FromResult(_memoryCache.TryGetValue(key, out _));
}
public string Get(string key)
{
return _memoryCache.Get(key)?.ToString();
}
public T Get<T>(string key)
{
return _memoryCache.Get<T>(key);
}
public Task<string> GetAsync(string key)
{
return Task.FromResult(Get(key));
}
public Task<T> GetAsync<T>(string key)
{
return Task.FromResult(Get<T>(key));
}
public bool Set(string key, object value)
{
_memoryCache.Set(key, value);
return true;
}
public bool Set(string key, object value, TimeSpan expire)
{
_memoryCache.Set(key, value, expire);
return true;
}
public Task<bool> SetAsync(string key, object value)
{
Set(key, value);
return Task.FromResult(true);
}
public Task<bool> SetAsync(string key, object value, TimeSpan expire)
{
Set(key, value, expire);
return Task.FromResult(true);
}
public List<string> GetAllKeys()
{
//const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
//var entries = _memoryCache.GetType().GetField("_entries", flags)?.GetValue(_memoryCache);
//var cacheItems = entries?.GetType().GetProperty("Keys").GetValue(entries) as ICollection<object>; //entries as IDictionary;
//var keys = new List<string>();
//if (cacheItems == null) return keys;
//return cacheItems.Select(u => u.ToString()).ToList();
const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
var entries = _memoryCache.GetType().GetField("_coherentState", flags)?.GetValue(_memoryCache);
var cacheItems = entries?.GetType().GetProperty("EntriesCollection", flags).GetValue(entries) as ICollection; //entries as IDictionary;
var keys = new List<string>();
if (cacheItems == null) return keys;
foreach (var item in cacheItems)
{
var methodInfo = item.GetType().GetProperty("Key");
var val = methodInfo.GetValue(item);
keys.Add(val.ToString());
}
return keys;
}
}

@ -0,0 +1,100 @@
using Furion.DependencyInjection;
using Microsoft.Extensions.Options;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Magic.Core;
/// <summary>
/// Redis缓存
/// </summary>
public class RedisCache : ICache, ISingleton
{
public RedisCache(IOptions<CacheOptions> cacheOptions)
{
var csredis = new CSRedis.CSRedisClient(cacheOptions.Value.RedisConnectionString);
RedisHelper.Initialization(csredis);
}
public long Del(params string[] key)
{
return RedisHelper.Del(key);
}
public Task<long> DelAsync(params string[] key)
{
return RedisHelper.DelAsync(key);
}
public async Task<long> DelByPatternAsync(string pattern)
{
if (string.IsNullOrEmpty(pattern))
return default;
//pattern = Regex.Replace(pattern, @"\{.*\}", "*");
var keys = (await RedisHelper.KeysAsync(pattern + "*"));
if (keys != null && keys.Length > 0)
{
return await RedisHelper.DelAsync(keys);
}
return default;
}
public bool Exists(string key)
{
return RedisHelper.Exists(key);
}
public Task<bool> ExistsAsync(string key)
{
return RedisHelper.ExistsAsync(key);
}
public string Get(string key)
{
return RedisHelper.Get(key);
}
public T Get<T>(string key)
{
return RedisHelper.Get<T>(key);
}
public Task<string> GetAsync(string key)
{
return RedisHelper.GetAsync(key);
}
public Task<T> GetAsync<T>(string key)
{
return RedisHelper.GetAsync<T>(key);
}
public bool Set(string key, object value)
{
return RedisHelper.Set(key, value);
}
public bool Set(string key, object value, TimeSpan expire)
{
return RedisHelper.Set(key, value, expire);
}
public Task<bool> SetAsync(string key, object value)
{
return RedisHelper.SetAsync(key, value);
}
public Task<bool> SetAsync(string key, object value, TimeSpan expire)
{
return RedisHelper.SetAsync(key, value, expire);
}
public List<string> GetAllKeys()
{
return RedisHelper.Keys("*").ToList();
}
}

@ -0,0 +1,58 @@
using Furion;
using Furion.DependencyInjection;
using SqlSugar;
using System;
using System.Collections.Generic;
namespace Magic.Core;
public class SqlSugarCache : ICacheService
{
private static ICache _cache = App.GetOptions<CacheOptions>().CacheType == CacheType.MemoryCache? App.RootServices.GetService(typeof(MemoryCache)) as ICache : App.RootServices.GetService(typeof(RedisCache)) as ICache;
public void Add<TV>(string key, TV value)
{
_cache.Set(key, value);
}
public void Add<TV>(string key, TV value, int cacheDurationInSeconds)
{
_cache.Set(key, value, TimeSpan.FromSeconds(cacheDurationInSeconds));
}
public bool ContainsKey<TV>(string key)
{
return _cache.Exists(key);
}
public TV Get<TV>(string key)
{
return _cache.Get<TV>(key);
}
public IEnumerable<string> GetAllKey<TV>()
{
return _cache.GetAllKeys();
}
public TV GetOrCreate<TV>(string cacheKey, Func<TV> create, int cacheDurationInSeconds = int.MaxValue)
{
if (this.ContainsKey<TV>(cacheKey))
{
return this.Get<TV>(cacheKey);
}
else
{
var result = create();
this.Add(cacheKey, result, cacheDurationInSeconds);
return result;
}
}
public void Remove<TV>(string key)
{
_cache.Del(key);
}
}

@ -0,0 +1,223 @@
using Furion;
using Furion.DependencyInjection;
using Furion.JsonSerialization;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using Yitter.IdGenerator;
namespace Magic.Core;
/// <summary>
/// 点选验证码
/// </summary>
public class ClickWordCaptcha : IClickWordCaptcha, ITransient
{
private readonly IMemoryCache _memoryCache;
public ClickWordCaptcha(IMemoryCache memoryCache)
{
_memoryCache = memoryCache;
}
/// <summary>
/// 生成验证码图片
/// </summary>
/// <param name="code"></param>
/// <param name="width"></param>
/// <param name="height"></param>
/// <returns></returns>
public ClickWordCaptchaResult CreateCaptchaImage(string code, int width, int height)
{
var rtnResult = new ClickWordCaptchaResult();
// 变化点: 3个字
int rightCodeLength = 3;
Bitmap bitmap = null;
Graphics g = null;
MemoryStream ms = null;
Random random = new();
Color[] colorArray = { Color.Black, Color.DarkBlue, Color.Green, Color.Orange, Color.Brown, Color.DarkCyan, Color.Purple };
string bgImagesDir = Path.Combine(App.WebHostEnvironment.WebRootPath, "Captcha/Image");
string[] bgImagesFiles = Directory.GetFiles(bgImagesDir);
// 字体来自https://www.zcool.com.cn/special/zcoolfonts/
string fontsDir = Path.Combine(App.WebHostEnvironment.WebRootPath, "Captcha/Font");
string[] fontFiles = new DirectoryInfo(fontsDir)?.GetFiles()
?.Where(m => m.Extension.ToLower() == ".ttf")
?.Select(m => m.FullName).ToArray();
int imgIndex = random.Next(bgImagesFiles.Length);
string randomImgFile = bgImagesFiles[imgIndex];
var imageStream = Image.FromFile(randomImgFile);
bitmap = new Bitmap(imageStream, width, height);
imageStream.Dispose();
g = Graphics.FromImage(bitmap);
Color[] penColor = { Color.Red, Color.Green, Color.Blue };
int code_length = code.Length;
var words = new List<string>();
for (int i = 0; i < code_length; i++)
{
int colorIndex = random.Next(colorArray.Length);
int fontIndex = random.Next(fontFiles.Length);
Font f = LoadFont(fontFiles[fontIndex], 15, FontStyle.Regular);
Brush b = new SolidBrush(colorArray[colorIndex]);
int _y = random.Next(height);
if (_y > (height - 30))
_y -= 60;
int _x = width / (i + 1);
if ((width - _x) < 50)
{
_x = width - 60;
}
string word = code.Substring(i, 1);
if (rtnResult.repData.point.Count < rightCodeLength)
{
// (int, int) percentPos = ToPercentPos((width, height), (_x, _y));
// 添加正确答案 位置数据
if (random.Next(0, 3).Equals(1) || (code_length - i).Equals(rightCodeLength - rtnResult.repData.point.Count))
{
rtnResult.repData.point.Add(new PointPosModel()
{
X = _x, //percentPos.Item1,
Y = _y //percentPos.Item2,
});
words.Add(word);
}
}
g.DrawString(word, f, b, _x, _y);
}
rtnResult.repData.wordList = words;
ms = new MemoryStream();
bitmap.Save(ms, ImageFormat.Jpeg);
g.Dispose();
bitmap.Dispose();
ms.Dispose();
rtnResult.repData.originalImageBase64 = Convert.ToBase64String(ms.GetBuffer()); //"data:image/jpg;base64," +
rtnResult.repData.token = YitIdHelper.NextId().ToString();
// 缓存验证码正确位置集合
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(30));
_memoryCache.Set(CommonConst.CACHE_KEY_CODE + rtnResult.repData.token, rtnResult.repData.point, cacheOptions);
rtnResult.repData.point = null; // 清空位置信息
return rtnResult;
}
/// <summary>
/// 转换为相对于图片的百分比单位
/// </summary>
/// <param name="widthAndHeight">图片宽高</param>
/// <param name="xAndy">相对于图片的绝对尺寸</param>
/// <returns>(int:xPercent, int:yPercent)</returns>
private (int, int) ToPercentPos((int, int) widthAndHeight, (int, int) xAndy)
{
(int, int) rtnResult = (0, 0);
// 注意: int / int = int (小数部分会被截断)
rtnResult.Item1 = (int)(((double)xAndy.Item1) / ((double)widthAndHeight.Item1) * 100);
rtnResult.Item2 = (int)(((double)xAndy.Item2) / ((double)widthAndHeight.Item2) * 100);
return rtnResult;
}
/// <summary>
/// 加载字体
/// </summary>
/// <param name="path">字体文件路径,包含字体文件名和后缀名</param>
/// <param name="size">大小</param>
/// <param name="fontStyle">字形(常规/粗体/斜体/粗斜体)</param>
private Font LoadFont(string path, int size, FontStyle fontStyle)
{
var pfc = new System.Drawing.Text.PrivateFontCollection();
pfc.AddFontFile(path);// 字体文件路径
return new Font(pfc.Families[0], size, fontStyle);
}
/// <summary>
/// 随机绘制字符串
/// </summary>
/// <param name="number"></param>
/// <returns></returns>
public string RandomCode(int number)
{
char[] str_char_arrary = new char[] { '赵', '钱', '孙', '李', '周', '吴', '郑', '王', '冯', '陈', '卫', '蒋', '沈', '韩', '杨', '朱', '秦', '尤', '许', '何', '吕', '施', '张', '孔', '曹', '严', '华', '金', '魏', '陶', '姜', '戚', '谢', '喻', '柏', '水', '章', '云', '苏', '潘', '葛', '范', '彭', '郎', '鲁', '昌', '马', '苗', '凤', '花', '方', '任', '袁', '柳', '史', '唐', '费', '薛', '雷', '贺', '汤', '殷', '罗', '毕', '安', '常', '傅', '齐', '元', '顾', '孟', '平', '黄', '穆', '萧', '姚', '汪', '毛', '米', '伏', '成', '戴', '谈', '宋', '茅', '庞', '熊', '纪', '舒', '屈', '项', '祝', '董', '梁', '杜', '蓝', '季', '贾', '路', '娄', '江', '童', '颜', '郭', '梅', '盛', '林', '钟', '徐', '骆', '高', '夏', '田', '樊', '胡', '凌', '霍', '万', '支', '管', '卢', '莫', '房', '解', '应', '宗', '丁', '宣', '邓', '单', '杭', '洪', '包', '诸', '左', '石', '崔', '吉', '程', '邢', '陆', '荣', '翁', '于', '惠', '曲', '封', '储', '仲', '伊', '宁', '仇', '甘', '武', '符', '刘', '景', '龙', '叶', '幸', '司', '黎', '印', '怀', '蒲', '从', '索', '赖', '卓', '屠', '池', '乔', '闻', '党', '谭', '贡', '劳', '申', '扶', '堵', '宰', '桑', '寿', '通', '燕', '浦', '尚', '农', '温', '别', '庄', '柴', '阎', '连', '习', '容', '向', '古', '易', '终', '步', '都', '耿', '满', '国', '文', '寇', '广', '东', '欧', '利', '师', '巩', '聂', '关', '荆', '伟', '刚', '勇', '毅', '俊', '峰', '强', '军', '平', '保', '东', '文', '辉', '力', '明', '永', '健', '世', '广', '志', '义', '兴', '良', '海', '山', '仁', '波', '宁', '贵', '福', '生', '龙', '元', '全', '国', '胜', '学', '祥', '才', '发', '武', '新', '利', '清', '飞', '彬', '富', '顺', '信', '子', '杰', '涛', '昌', '成', '康', '星', '光', '天', '达', '安', '岩', '中', '茂', '进', '林', '有', '坚', '和', '彪', '博', '诚', '先', '敬', '震', '振', '壮', '会', '思', '群', '豪', '心', '邦', '承', '乐', '绍', '功', '松', '善', '厚', '庆', '民', '友', '裕', '河', '哲', '江', '超', '浩', '亮', '政', '谦', '奇', '固', '之', '轮', '翰', '朗', '伯', '宏', '言', '若', '鸣', '朋', '梁', '栋', '维', '启', '克', '伦', '翔', '旭', '鹏', '泽', '晨', '辰', '士', '以', '建', '家', '致', '树', '炎', '德', '行', '时', '泰', '盛', '雄', '钧', '冠', '策', '腾', '榕', '风', '航', '秀', '英', '华', '慧', '巧', '美', '娜', '静', '淑', '惠', '珠', '翠', '雅', '芝', '玉', '萍', '红', '玲', '芬', '芳', '燕', '彩', '春', '菊', '兰', '凤', '洁', '梅', '琳', '素', '云', '莲', '真', '环', '雪', '荣', '爱', '妹', '霞', '香', '月', '莺', '艳', '瑞', '凡', '佳', '嘉', '琼', '勤', '珍', '贞', '莉', '桂', '叶', '璧', '晶', '秋', '珊', '锦', '青', '婉', '颖', '露', '雁', '仪', '荷', '丹', '蓉', '眉', '君', '琴', '蕊', '薇', '梦', '韵', '融', '园', '艺', '咏', '卿', '聪', '澜', '纯', '悦', '昭', '冰', '爽', '羽', '希', '欣', '飘', '育', '柔', '竹', '凝', '晓', '欢', '枫', '菲', '寒', '伊', '亚', '宜', '可', '舒', '影', '荔', '枝', '丽', '阳', '宝', '贝', '初', '程', '恒', '鸿', '桦', '剑', '娇', '纪', '宽', '苛', '灵', '玛', '媚', '晴', '容', '烁', '堂', '唯', '威', '苇', '阅', '宇', '雨', '洋', '忠', '宗', '曼', '紫', '逸', '贤', '蝶', '绿', '蓝', '儿', '翠', '烟' };
var rand = new Random();
var hs = new HashSet<char>();
var randomBool = true;
while (randomBool)
{
if (hs.Count == number)
break;
var rand_number = rand.Next(str_char_arrary.Length);
hs.Add(str_char_arrary[rand_number]);
}
return string.Join("", hs);
}
/// <summary>
/// 验证码验证
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public dynamic CheckCode(ClickWordCaptchaInput input)
{
var res = new ClickWordCaptchaResult();
var rightVCodePos = _memoryCache.Get(CommonConst.CACHE_KEY_CODE + input.Token) as List<PointPosModel>;
if (rightVCodePos == null)
{
res.repCode = "6110";
res.repMsg = "验证码已失效,请重新获取";
return res;
}
var userVCodePos = JSON.Deserialize<List<PointPosModel>>(input.PointJson);
if (userVCodePos == null || userVCodePos.Count < rightVCodePos.Count)
{
res.repCode = "6111";
res.repMsg = "验证码无效";
return res;
}
int allowOffset = 25; // 允许的偏移量(点触容错)
for (int i = 0; i < userVCodePos.Count; i++)
{
var xOffset = userVCodePos[i].X - rightVCodePos[i].X;
var yOffset = userVCodePos[i].Y - rightVCodePos[i].Y;
xOffset = Math.Abs(xOffset); // x轴偏移量
yOffset = Math.Abs(yOffset); // y轴偏移量
// 只要有一个点的任意一个轴偏移量大于allowOffset则验证不通过
if (xOffset > allowOffset || yOffset > allowOffset)
{
res.repCode = "6112";
res.repMsg = "验证码错误";
return res;
}
}
_memoryCache.Remove(CommonConst.CACHE_KEY_CODE + input.Token);
res.repCode = "0000";
res.repMsg = "验证成功";
return res;
}
}
/// <summary>
/// 记录正确位置
/// </summary>
public class PointPosModel
{
public int X { get; set; }
public int Y { get; set; }
}

@ -0,0 +1,28 @@
using Furion.DependencyInjection;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core;
/// <summary>
/// 点击验证码输入参数
/// </summary>
[SuppressSniffer]
public class ClickWordCaptchaInput
{
/// <summary>
/// 验证码类型
/// </summary>
[Required(ErrorMessage = "验证码类型")]
public string CaptchaType { get; set; }
/// <summary>
/// 坐标点集合
/// </summary>
[Required(ErrorMessage = "坐标点集合不能为空")]
public string PointJson { get; set; }
/// <summary>
/// Token
/// </summary>
public string Token { get; set; }
}

@ -0,0 +1,43 @@
using Furion.DependencyInjection;
using System.Collections.Generic;
namespace Magic.Core;
/// <summary>
/// 验证码输出参数
/// </summary>
[SuppressSniffer]
public class ClickWordCaptchaResult
{
public string repCode { get; set; } = "0000";
public string repMsg { get; set; }
public RepData repData { get; set; } = new RepData();
public bool error { get; set; }
public bool success { get; set; } = true;
}
[SuppressSniffer]
public class RepData
{
public string captchaId { get; set; }
public string projectCode { get; set; }
public string captchaType { get; set; }
public string captchaOriginalPath { get; set; }
public string captchaFontType { get; set; }
public string captchaFontSize { get; set; }
public string secretKey { get; set; }
public string originalImageBase64 { get; set; }
public List<PointPosModel> point { get; set; } = new List<PointPosModel>();
public string jigsawImageBase64 { get; set; }
public List<string> wordList { get; set; } = new List<string>();
public string pointList { get; set; }
public string pointJson { get; set; }
public string token { get; set; }
public bool result { get; set; }
public string captchaVerification { get; set; }
}
[SuppressSniffer]
public class WordList
{
}

@ -0,0 +1,8 @@
namespace Magic.Core;
public interface IClickWordCaptcha
{
dynamic CheckCode(ClickWordCaptchaInput input);
ClickWordCaptchaResult CreateCaptchaImage(string code, int width, int height);
string RandomCode(int number);
}

@ -0,0 +1,129 @@
using Furion.DependencyInjection;
using Microsoft.Extensions.Caching.Memory;
using System;
using System.ComponentModel.DataAnnotations;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Text;
namespace Magic.Core;
/// <summary>
/// 常规验证码
/// </summary>
public class GeneralCaptcha : IGeneralCaptcha, ITransient
{
private readonly IMemoryCache _memoryCache;
public GeneralCaptcha(IMemoryCache memoryCache)
{
_memoryCache = memoryCache;
}
/// <summary>
/// 生成验证码图片
/// </summary>
/// <param name="length"></param>
/// <returns></returns>
public string CreateCaptchaImage(int length = 4)
{
return Convert.ToBase64String(Draw(length));
}
private string GenerateRandom(int length)
{
var chars = new StringBuilder();
// 验证码的字符集,去掉了一些容易混淆的字符
char[] character = { '2', '3', '4', '5', '6', '8', '9', 'a', 'b', 'd', 'e', 'f', 'h', 'k', 'm', 'n', 'r', 'x', 'y', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', 'X', 'Y' };
Random rnd = new Random();
// 生成验证码字符串
for (int i = 0; i < length; i++)
{
chars.Append(character[rnd.Next(character.Length)]);
}
return chars.ToString();
}
private byte[] Draw(int length = 4)
{
int codeW = 110;
int codeH = 36;
int fontSize = 22;
// 颜色列表,用于验证码、噪线、噪点
Color[] color = { Color.Black, Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.Brown, Color.DarkBlue };
// 字体列表,用于验证码
string[] fonts = new[] { "Times New Roman", "Verdana", "Arial", "Gungsuh", "Impact" };
var code = GenerateRandom(length); // 随机字符串集合
using (Bitmap bmp = new Bitmap(codeW, codeH))
using (Graphics g = Graphics.FromImage(bmp))
using (MemoryStream ms = new MemoryStream())
{
g.Clear(Color.White);
Random rnd = new Random();
// 画噪线
for (int i = 0; i < 1; i++)
{
int x1 = rnd.Next(codeW);
int y1 = rnd.Next(codeH);
int x2 = rnd.Next(codeW);
int y2 = rnd.Next(codeH);
var clr = color[rnd.Next(color.Length)];
g.DrawLine(new Pen(clr), x1, y1, x2, y2);
}
// 画验证码字符串
string fnt;
Font ft;
for (int i = 0; i < code.Length; i++)
{
fnt = fonts[rnd.Next(fonts.Length)];
ft = new Font(fnt, fontSize);
var clr = color[rnd.Next(color.Length)];
g.DrawString(code[i].ToString(), ft, new SolidBrush(clr), (float)i * 24 + 2, (float)0);
}
// 缓存验证码正确集合
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(30));
_memoryCache.Set(CommonConst.CACHE_KEY_CODE + Guid.NewGuid().ToString("N"), code, cacheOptions);
// 将验证码图片写入内存流
bmp.Save(ms, ImageFormat.Png);
return ms.ToArray();
}
}
/// <summary>
/// 验证码验证
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public dynamic CheckCode(GeneralCaptchaInput input)
{
var res = new ClickWordCaptchaResult();
var code = _memoryCache.Get(CommonConst.CACHE_KEY_CODE + input.Token);
if (code == null)
{
res.repCode = "6110";
res.repMsg = "验证码已失效,请重新获取";
return res;
}
if (input.CaptchaCode != (string)code)
{
res.repCode = "6112";
res.repMsg = "验证码错误";
return res;
}
_memoryCache.Remove(CommonConst.CACHE_KEY_CODE + input.Token);
res.repCode = "0000";
res.repMsg = "验证成功";
return res;
}
}

@ -0,0 +1,28 @@
using Furion.DependencyInjection;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core;
/// <summary>
/// 常规验证码输入
/// </summary>
[SuppressSniffer]
public class GeneralCaptchaInput
{
/// <summary>
/// 验证码类型
/// </summary>
[Required(ErrorMessage = "验证码类型")]
public string CaptchaType { get; set; }
/// <summary>
/// 验证码字符
/// </summary>
[Required(ErrorMessage = "验证码字符不能为空")]
public string CaptchaCode { get; set; }
/// <summary>
/// Token
/// </summary>
public string Token { get; set; }
}

@ -0,0 +1,7 @@
namespace Magic.Core;
public interface IGeneralCaptcha
{
dynamic CheckCode(GeneralCaptchaInput input);
string CreateCaptchaImage(int length = 4);
}

@ -0,0 +1,210 @@
using Furion.ConfigurableOptions;
using System.Collections.Generic;
namespace Magic.Core;
/// <summary>
/// 缓存配置
/// </summary>
public class CacheOptions : IConfigurableOptions
{
/// <summary>
/// 缓存类型
/// </summary>
public CacheType CacheType { get; set; }
/// <summary>
/// Redis配置
/// </summary>
public string RedisConnectionString { get; set; }
}
/// <summary>
/// 系统配置
/// </summary>
public class SystemSettingsOptions : IConfigurableOptions
{
/// <summary>
/// 超管是否可以查看所有租户的数据
/// </summary>
public bool SuperAdminViewAllData { get; set; }
/// <summary>
/// 是否开启全局请求日志
/// </summary>
public bool IsGlobalRequestLog { get; set; }
}
/// <summary>
/// 雪花Id配置
/// </summary>
public class SnowIdOptions : IConfigurableOptions
{
/// <summary>
/// 取值范围0~63,默认1
/// </summary>
public string WorkerId { get; set; } = "1";
}
/// <summary>
/// 第三方配置
/// </summary>
public class OAuthOptions : IConfigurableOptions
{
/// <summary>
///微信
/// </summary>
public ThirdParty Wechat { get; set; }
}
/// <summary>
/// 上传文件
/// </summary>
public class UploadFileOptions : IConfigurableOptions
{
/// <summary>
/// 阿里云
/// </summary>
public FileDescription Aliyun { get; set; }
/// <summary>
/// 头像
/// </summary>
public FileDescription Avatar { get; set; }
/// <summary>
/// 文档
/// </summary>
public FileDescription Document { get; set; }
/// <summary>
/// 商店
/// </summary>
public FileDescription Shop { get; set; }
/// <summary>
/// 编辑器
/// </summary>
public FileDescription Editor { get; set; }
/// <summary>
/// 默认
/// </summary>
public FileDescription Default { get; set; }
}
/// <summary>
/// 数据库配置
/// </summary>
public class ConnectionStringsOptions : IConfigurableOptions
{
/// <summary>
/// 默认数据库编号
/// </summary>
public string DefaultDbNumber { get; set; }
/// <summary>
/// 默认数据库类型
/// </summary>
public string DefaultDbType { get; set; }
/// <summary>
/// 默认数据库连接字符串
/// </summary>
public string DefaultDbString { get; set; }
/// <summary>
/// 业务库集合
/// </summary>
public List<DbConfig> DbConfigs { get; set; }
}
/// <summary>
/// JWT配置
/// </summary>
public class JWTSettingsOptions : IConfigurableOptions
{
/// <summary>
/// 是否验证密钥
/// </summary>
public bool ValidateIssuerSigningKey { get; set; }
/// <summary>
/// 密钥
/// </summary>
public string IssuerSigningKey { get; set; }
/// <summary>
/// 是否验证签发方
/// </summary>
public bool ValidateIssuer { get; set; }
/// <summary>
/// 签发方
/// </summary>
public string ValidIssuer { get; set; }
/// <summary>
/// 是否验证签收方
/// </summary>
public bool ValidateAudience { get; set; }
/// <summary>
/// 签收方
/// </summary>
public string ValidAudience { get; set; }
/// <summary>
/// 是否验证过期时间
/// </summary>
public bool ValidateLifetime { get; set; }
/// <summary>
/// 过期时间
/// </summary>
public long ExpiredTime { get; set; }
/// <summary>
/// 过期时间容错值
/// </summary>
public long ClockSkew { get; set; }
}
/// <summary>
/// 数据库参数
/// </summary>
public class DbConfig
{
/// <summary>
/// 数据库编号
/// </summary>
public string DbNumber { get; set; }
/// <summary>
/// 数据库类型
/// </summary>
public string DbType { get; set; }
/// <summary>
/// 数据库连接字符串
/// </summary>
public string DbString { get; set; }
}
/// <summary>
/// 文件参数
/// </summary>
public class FileDescription
{
/// <summary>
/// 路径
/// </summary>
public string path { get; set; }
/// <summary>
/// 大小
/// </summary>
public long maxSize { get; set; }
/// <summary>
/// 类型
/// </summary>
public string[] contentType { get; set; }
}
/// <summary>
/// 第三方参数
/// </summary>
public class ThirdParty
{
/// <summary>
/// id
/// </summary>
public string app_id { get; set; }
/// <summary>
/// key
/// </summary>
public string app_key { get; set; }
/// <summary>
/// 回调地址
/// </summary>
public string redirect_uri { get; set; }
/// <summary>
/// scope
/// </summary>
public string scope { get; set; }
}

@ -0,0 +1,38 @@
namespace Magic.Core;
public class ClaimConst
{
/// <summary>
/// 用户Id
/// </summary>
public const string CLAINM_USERID = "UserId";
/// <summary>
/// 账号
/// </summary>
public const string CLAINM_ACCOUNT = "Account";
/// <summary>
/// 名称
/// </summary>
public const string CLAINM_NAME = "Name";
/// <summary>
/// 是否超级管理
/// </summary>
public const string CLAINM_SUPERADMIN = "SuperAdmin";
/// <summary>
/// 租户Id
/// </summary>
public const string TENANT_ID = "TenantId";
/// <summary>
/// 租户类型
/// </summary>
public const string CLAINM_TENANT_TYPE = "TenantType";
/// <summary>
/// 租户名称
/// </summary>
public const string CLAINM_TENANT_NAME = "TenantName";
}

@ -0,0 +1,55 @@
namespace Magic.Core;
public class CommonConst
{
#region 缓存
/// <summary>
/// 用户缓存
/// </summary>
public const string CACHE_KEY_USER = "user_";
/// <summary>
/// 菜单缓存
/// </summary>
public const string CACHE_KEY_MENU = "menu_";
/// <summary>
/// 权限缓存
/// </summary>
public const string CACHE_KEY_PERMISSION = "permission_";
/// <summary>
/// 数据范围缓存
/// </summary>
public const string CACHE_KEY_DATASCOPE = "datascope_";
public const string CACHE_KEY_USERSDATASCOPE = "usersdatascope_";
/// <summary>
/// 验证码缓存
/// </summary>
public const string CACHE_KEY_CODE = "vercode_";
/// <summary>
/// 库表实体信息缓存
/// </summary>
public const string CACHE_KEY_ENTITYINFO = "tableentity";
/// <summary>
/// 所有权限缓存
/// </summary>
public const string CACHE_KEY_ALLPERMISSION = "allpermission";
#endregion
/// <summary>
/// 程序集
/// </summary>
public static string[] ENTITY_ASSEMBLY_NAME = new string[] { "Magic.Core", "Magic.Application", "Magic.FlowCenter" };
/// <summary>
/// 删除字段
/// </summary>
public const string DELETE_FIELD = "IsDeleted";
#region 数据库编号
public const string MasterDb = "0";
#endregion
}

@ -0,0 +1,17 @@

using SqlSugar;
namespace Magic.Core.Entity;
/// <summary>
/// 自定义租户基类实体
/// </summary>
public abstract class DBEntityTenant : DEntityBase
{
/// <summary>
/// 租户id
/// </summary>
[SugarColumn(ColumnDescription = "租户id", IsNullable = true)]
public virtual long? TenantId { get; set; }
}

@ -0,0 +1,107 @@
using SqlSugar;
using System;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 自定义实体基类
/// </summary>
[Tenant(CommonConst.MasterDb)]
public abstract class DEntityBase : PrimaryKeyEntity
{
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDescription = "创建时间", IsNullable = true)]
public virtual DateTime? CreatedTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnDescription = "更新时间", IsNullable = true)]
public virtual DateTime? UpdatedTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
[SugarColumn(ColumnDescription = "创建者Id", IsNullable = true)]
public virtual long? CreatedUserId { get; set; }
/// <summary>
/// 创建者名称
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "创建者名称", IsNullable = true)]
public virtual string CreatedUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
[SugarColumn(ColumnDescription = "修改者Id", IsNullable = true)]
public virtual long? UpdatedUserId { get; set; }
/// <summary>
/// 修改者名称
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "修改者名称", IsNullable = true)]
public virtual string UpdatedUserName { get; set; }
/// <summary>
/// 软删除
/// </summary>
[SugarColumn(ColumnDescription = "软删除")]
public virtual bool IsDeleted { get; set; } = false;
/// <summary>
/// 更新信息列
/// </summary>
/// <returns></returns>
public virtual string[] UpdateColumn()
{
var result = new[] {nameof(UpdatedUserId), nameof(UpdatedUserName), nameof(UpdatedTime)};
return result;
}
/// <summary>
/// 假删除的列,包含更新信息
/// </summary>
/// <returns></returns>
public virtual string[] FalseDeleteColumn()
{
var updateColumn = UpdateColumn();
var deleteColumn = new[] {nameof(IsDeleted)};
var result = new string [updateColumn.Length + deleteColumn.Length];
deleteColumn.CopyTo(result, 0);
updateColumn.CopyTo(result, deleteColumn.Length);
return result;
}
}
/// <summary>
/// 递增主键实体基类
/// </summary>
public abstract class AutoIncrementEntity
{
/// <summary>
/// 主键Id
/// </summary>
[SugarColumn(IsIdentity = true, ColumnDescription = "Id主键", IsPrimaryKey = true)] //通过特性设置主键和自增列
// 注意是在这里定义你的公共实体
public virtual int Id { get; set; }
}
/// <summary>
/// 主键实体基类
/// </summary>
public abstract class PrimaryKeyEntity
{
/// <summary>
/// 主键Id
/// </summary>
[SugarColumn(ColumnDescription = "Id主键", IsPrimaryKey = true)]
// 注意是在这里定义你的公共实体
public virtual long Id { get; set; }
}

@ -0,0 +1,78 @@
using SqlSugar;
using System.Collections.Generic;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 文档表
/// </summary>
[SugarTable("Documentation")]
[Description("文档表")]
public class Documentation : DEntityBase
{
/// <summary>
/// 父Id
/// </summary>
[SugarColumn(ColumnDescription = "父Id")]
public long PId { get; set; }
/// <summary>
/// 父ID列表
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription= "父ID列表")]
public string PIds { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription= "名称")]
public string Name { get; set; }
/// <summary>
/// 文档类型:文件、文件夹
/// </summary>
[SugarColumn(ColumnDescription = "文件类型")]
public DocumentType DocumentType { get; set; }
/// <summary>
/// 文件后缀
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "文件后缀")]
public string FileSuffix { get; set; }
/// <summary>
/// 文件大小kb
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "文件大小kb")]
public int? FileSizeKb { get; set; }
/// <summary>
/// 文件路径
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "文件路径")]
public string FilePath { get; set; }
/// <summary>
/// 存储后的文件名
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "存储后的文件名")]
public string FileObjectName { get; set; }
/// <summary>
/// 标签
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "标签")]
public int? Label { get; set; }
/// <summary>
/// 备注
/// </summary>
[SugarColumn(IsNullable = true, ColumnDescription = "备注")]
public string Remark { get; set; }
/// <summary>
/// 是否可见
/// </summary>
[SugarColumn(IsNullable = true)]
public bool Visible { get; set; } = true;
[SugarColumn(IsIgnore = true)]
public List<Documentation> Children { get; set; }
}

@ -0,0 +1,47 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 系统应用表
/// </summary>
[SugarTable("sys_app", TableDescription = "系统应用表")]
[Description("系统应用表")]
public class SysApp : DEntityBase
{
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码")]
public string Code { get; set; }
/// <summary>
/// 是否默认激活Y-是N-否),只能有一个系统默认激活
/// 用户登录后默认展示此系统菜单
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否默认激活")]
public string Active { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int Sort { get; set; }
}

@ -0,0 +1,68 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 代码生成表
/// </summary>
[SugarTable("sys_code_gen",TableDescription="代码生成表")]
[Description("代码生成表")]
public class SysCodeGen : DEntityBase
{
/// <summary>
/// 作者姓名
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "作者姓名",IsNullable =true)]
public string AuthorName { get; set; }
/// <summary>
/// 是否移除表前缀
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否移除表前缀",IsNullable = true)]
public string TablePrefix { get; set; }
/// <summary>
/// 生成方式
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "生成方式", IsNullable = true)]
public string GenerateType { get; set; }
/// <summary>
/// 数据库表名
/// </summary>
[MaxLength(64)]
[SugarColumn(ColumnDescription = "数据库表名",IsNullable = true)]
public string TableName { get; set; }
/// <summary>
/// 命名空间
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "命名空间", IsNullable = true)]
public string NameSpace { get; set; }
/// <summary>
/// 业务名
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "业务名", IsNullable = true)]
public string BusName { get; set; }
/// <summary>
/// 菜单应用分类(应用编码)
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "菜单应用分类", IsNullable = true)]
public string MenuApplication { get; set; }
/// <summary>
/// 菜单编码
/// </summary>
[SugarColumn(ColumnDescription = "菜单编码")]
public long MenuPid { get; set; }
}

@ -0,0 +1,138 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 代码生成字段配置表
/// </summary>
[SugarTable("sys_code_gen_config")]
[Description("代码生成字段配置表")]
public class SysCodeGenConfig : DEntityBase
{
/// <summary>
/// 代码生成主表ID
/// </summary>
[SugarColumn(ColumnDescription = "代码生成主表ID")]
public long CodeGenId { get; set; }
/// <summary>
/// 数据库字段名
/// </summary>
[Required, MaxLength(100)]
[SugarColumn(ColumnDescription = "数据库字段名")]
public string ColumnName { get; set; }
/// <summary>
/// 字段描述
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "字段描述",IsNullable =true)]
public string ColumnComment { get; set; }
/// <summary>
/// .NET数据类型
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = ".NET数据类型", IsNullable = true)]
public string NetType { get; set; }
/// <summary>
/// 作用类型(字典)
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "作用类型(字典)", IsNullable = true)]
public string EffectType { get; set; }
/// <summary>
/// 外键实体名称
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "外键实体名称", IsNullable = true)]
public string FkEntityName { get; set; }
/// <summary>
/// 外键显示字段
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "外键显示字段", IsNullable = true)]
public string FkColumnName { get; set; }
/// <summary>
/// 外键显示字段.NET类型
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "外键显示字段.NET类型", IsNullable = true)]
public string FkColumnNetType { get; set; }
/// <summary>
/// 字典code
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "字典code", IsNullable = true)]
public string DictTypeCode { get; set; }
/// <summary>
/// 列表是否缩进(字典)
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "列表是否缩进(字典)", IsNullable = true)]
public string WhetherRetract { get; set; }
/// <summary>
/// 是否必填(字典)
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否必填(字典)", IsNullable = true)]
public string WhetherRequired { get; set; }
/// <summary>
/// 是否是查询条件
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否是查询条件", IsNullable = true)]
public string QueryWhether { get; set; }
/// <summary>
/// 查询方式
/// </summary>
[MaxLength(10)]
[SugarColumn(ColumnDescription = "查询方式", IsNullable = true)]
public string QueryType { get; set; }
/// <summary>
/// 列表显示
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "列表显示", IsNullable = true)]
public string WhetherTable { get; set; }
/// <summary>
/// 增改
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "增改", IsNullable = true)]
public string WhetherAddUpdate { get; set; }
/// <summary>
/// 主键
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "主键", IsNullable = true)]
public string ColumnKey { get; set; }
/// <summary>
/// 数据库中类型(物理类型)
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "数据库中类型(物理类型)", IsNullable = true)]
public string DataType { get; set; }
/// <summary>
/// 是否通用字段
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否通用字段", IsNullable = true)]
public string WhetherCommon { get; set; }
}

@ -0,0 +1,62 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 参数配置表
/// </summary>
[SugarTable("sys_config")]
[Description("参数配置表")]
public class SysConfig : DEntityBase
{
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码", IsNullable = true)]
public string Code { get; set; }
/// <summary>
/// 属性值
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "属性值", IsNullable = true)]
public string Value { get; set; }
/// <summary>
/// 是否是系统参数Y-是N-否)
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否是系统参数Y-是N-否)", IsNullable = true)]
public string SysFlag { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 常量所属分类的编码,来自于“常量的分类”字典
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "常量所属分类的编码,来自于“常量的分类”字典", IsNullable = true)]
public string GroupCode { get; set; }
}

@ -0,0 +1,52 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 字典值表
/// </summary>
[SugarTable("sys_dict_data")]
[Description("字典值表")]
public class SysDictData : DEntityBase
{
/// <summary>
/// 字典类型Id
/// </summary>
[SugarColumn(ColumnDescription = "编码")]
public long TypeId { get; set; }
/// <summary>
/// 值
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "值", IsNullable = true)]
public string Value { get; set; }
/// <summary>
/// 编码
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "编码", IsNullable = true)]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,50 @@

using SqlSugar;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 字典类型表
/// </summary>
[SugarTable("sys_dict_type")]
[Description("字典类型表")]
public class SysDictType : DEntityBase
{
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序", IsNullable = true)]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,33 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 员工表
/// </summary>
[SugarTable("sys_emp")]
[Description("员工表")]
public class SysEmp : PrimaryKeyEntity
{
/// <summary>
/// 工号
/// </summary>
[MaxLength(30)]
[SugarColumn(ColumnDescription = "工号", IsNullable = true)]
public string JobNum { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long OrgId { get; set; }
/// <summary>
/// 机构名称
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "机构名称", IsNullable = true)]
public string OrgName { get; set; }
}

@ -0,0 +1,31 @@
using SqlSugar;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 员工附属机构职位表
/// </summary>
[SugarTable("sys_emp_ext_org_pos")]
[Description("员工附属机构职位表")]
public class SysEmpExtOrgPos
{
/// <summary>
/// 员工Id
/// </summary>
[SugarColumn(ColumnDescription = "员工Id")]
public long SysEmpId { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long SysOrgId { get; set; }
/// <summary>
/// 职位Id
/// </summary>
[SugarColumn(ColumnDescription = "职位Id")]
public long SysPosId { get; set; }
}

@ -0,0 +1,28 @@
using SqlSugar;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 员工职位表
/// </summary>
[SugarTable("sys_emp_pos")]
[Description("员工职位表")]
public class SysEmpPos
{
/// <summary>
/// 员工Id
/// </summary>
[SugarColumn(ColumnDescription = "员工Id")]
public long SysEmpId { get; set; }
/// <summary>
/// 职位Id
/// </summary>
[SugarColumn(ColumnDescription = "职位Id")]
public long SysPosId { get; set; }
}

@ -0,0 +1,67 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 文件信息表
/// </summary>
[SugarTable("sys_file")]
[Description("文件信息表")]
public class SysFile : DEntityBase
{
/// <summary>
/// 文件存储位置1:阿里云2:腾讯云3:minio4:本地)
/// </summary>
[SugarColumn(ColumnDescription = "文件存储位置1:阿里云2:腾讯云3:minio4:本地")]
public int FileLocation { get; set; }
/// <summary>
/// 文件仓库
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "文件仓库",IsNullable =true)]
public string FileBucket { get; set; }
/// <summary>
/// 文件名称(上传时候的文件名)
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "文件名称(上传时候的文件名)", IsNullable = true)]
public string FileOriginName { get; set; }
/// <summary>
/// 文件后缀
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "文件后缀", IsNullable = true)]
public string FileSuffix { get; set; }
/// <summary>
/// 文件大小kb
/// </summary>
[MaxLength(10)]
[SugarColumn(ColumnDescription = "文件大小kb", IsNullable = true)]
public string FileSizeKb { get; set; }
/// <summary>
/// 文件大小信息,计算后的
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "文件大小信息,计算后的", IsNullable = true)]
public string FileSizeInfo { get; set; }
/// <summary>
/// 存储到bucket的名称文件唯一标识id
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "存储到bucket的名称文件唯一标识id", IsNullable = true)]
public string FileObjectName { get; set; }
/// <summary>
/// 存储路径
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "存储路径", IsNullable = true)]
public string FilePath { get; set; }
}

@ -0,0 +1,66 @@

using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 系统操作/审计日志表
/// </summary>
[SugarTable("sys_log_audit")]
[Description("系统操作/审计日志表")]
public class SysLogAudit : AutoIncrementEntity
{
/// <summary>
/// 表名
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "表名", IsNullable = true)]
public string TableName { get; set; }
/// <summary>
/// 列名
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "列名", IsNullable = true)]
public string ColumnName { get; set; }
/// <summary>
/// 新值
/// </summary>
[SugarColumn(ColumnDescription = "新值", IsNullable = true)]
public string NewValue { get; set; }
/// <summary>
/// 旧值
/// </summary>
[SugarColumn(ColumnDescription = "旧值", IsNullable = true)]
public string OldValue { get; set; }
/// <summary>
/// 操作时间
/// </summary>
[SugarColumn(ColumnDescription = "操作时间", IsNullable = true)]
public DateTime CreatedTime { get; set; }
/// <summary>
/// 操作人Id
/// </summary>
[SugarColumn(ColumnDescription = "操作人Id")]
public long UserId { get; set; }
/// <summary>
/// 操作人名称
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "操作人名称", IsNullable = true)]
public string UserName { get; set; }
/// <summary>
/// 操作方式:新增、更新、删除
/// </summary>
[SugarColumn(ColumnDescription = "操作方式:新增、更新、删除")]
public DataOpType Operate { get; set; }
}

@ -0,0 +1,78 @@

using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 异常日志
/// </summary>
[SugarTable("sys_log_ex")]
[Description("异常日志")]
public class SysLogEx : AutoIncrementEntity
{
/// <summary>
/// 操作人
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "操作人", IsNullable = true)]
public string Account { get; set; }
/// <summary>
/// 名称
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "名称", IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 类名
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "类名", IsNullable = true)]
public string ClassName { get; set; }
/// <summary>
/// 方法名
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "方法名", IsNullable = true)]
public string MethodName { get; set; }
/// <summary>
/// 异常名称
/// </summary>
[SugarColumn(ColumnDescription = "异常名称", IsNullable = true)]
public string ExceptionName { get; set; }
/// <summary>
/// 异常信息
/// </summary>
[SugarColumn(ColumnDescription = "异常信息", IsNullable = true)]
public string ExceptionMsg { get; set; }
/// <summary>
/// 异常源
/// </summary>
[SugarColumn(ColumnDescription = "异常源", IsNullable = true)]
public string ExceptionSource { get; set; }
/// <summary>
/// 堆栈信息
/// </summary>
[SugarColumn(ColumnDescription = "堆栈信息", IsNullable = true)]
public string StackTrace { get; set; }
/// <summary>
/// 参数对象
/// </summary>
[SugarColumn(ColumnDescription = "参数对象", IsNullable = true)]
public string ParamsObj { get; set; }
/// <summary>
/// 异常时间
/// </summary>
[SugarColumn(ColumnDescription = "异常时间", IsNullable = true)]
public DateTime ExceptionTime { get; set; }
}

@ -0,0 +1,119 @@
using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 操作日志表
/// </summary>
[SugarTable("sys_log_op")]
[Description("操作日志表")]
public class SysLogOp : AutoIncrementEntity
{
/// <summary>
/// 名称
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "名称", IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 是否执行成功Y-是N-否)
/// </summary>
[SugarColumn(ColumnDescription = "是否执行成功Y-是N-否)", IsNullable = true)]
public YesOrNot Success { get; set; }
/// <summary>
/// 具体消息
/// </summary>
[SugarColumn(ColumnDescription = "具体消息", IsNullable = true)]
public string Message { get; set; }
/// <summary>
/// IP
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "IP", IsNullable = true)]
public string Ip { get; set; }
/// <summary>
/// 地址
/// </summary>
[MaxLength(500)]
[SugarColumn(ColumnDescription = "地址", IsNullable = true)]
public string Location { get; set; }
/// <summary>
/// 浏览器
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "浏览器", IsNullable = true)]
public string Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "操作系统", IsNullable = true)]
public string Os { get; set; }
/// <summary>
/// 请求地址
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "请求地址", IsNullable = true)]
public string Url { get; set; }
/// <summary>
/// 类名称
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "类名称", IsNullable = true)]
public string ClassName { get; set; }
/// <summary>
/// 方法名称
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "方法名称", IsNullable = true)]
public string MethodName { get; set; }
/// <summary>
/// 请求方式GET POST PUT DELETE)
/// </summary>
[MaxLength(10)]
[SugarColumn(ColumnDescription = "请求方式GET POST PUT DELETE)", IsNullable = true)]
public string ReqMethod { get; set; }
/// <summary>
/// 请求参数
/// </summary>
[SugarColumn(ColumnDescription = "请求参数", IsNullable = true)]
public string Param { get; set; }
/// <summary>
/// 返回结果
/// </summary>
[SugarColumn(ColumnDescription = "返回结果", IsNullable = true)]
public string Result { get; set; }
/// <summary>
/// 耗时(毫秒)
/// </summary>
[SugarColumn(ColumnDescription = "耗时(毫秒)", IsNullable = true)]
public long ElapsedTime { get; set; }
/// <summary>
/// 操作时间
/// </summary>
[SugarColumn(ColumnDescription = "操作时间", IsNullable = true)]
public DateTime OpTime { get; set; }
/// <summary>
/// 操作人
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "操作人", IsNullable = true)]
public string Account { get; set; }
}

@ -0,0 +1,79 @@
using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 访问日志表
/// </summary>
[SugarTable("sys_log_vis")]
[Description("访问日志表")]
public class SysLogVis : AutoIncrementEntity
{
/// <summary>
/// 名称
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "名称", IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 是否执行成功Y-是N-否)
/// </summary>
[SugarColumn(ColumnDescription = "是否执行成功Y-是N-否)")]
public YesOrNot Success { get; set; }
/// <summary>
/// 具体消息
/// </summary>
[SugarColumn(ColumnDescription = "具体消息", IsNullable = true)]
public string Message { get; set; }
/// <summary>
/// IP
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "IP", IsNullable = true)]
public string Ip { get; set; }
/// <summary>
/// 地址
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "地址", IsNullable = true)]
public string Location { get; set; }
/// <summary>
/// 浏览器
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "浏览器", IsNullable = true)]
public string Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "操作系统", IsNullable = true)]
public string Os { get; set; }
/// <summary>
/// 访问类型
/// </summary>
[SugarColumn(ColumnDescription = "访问类型")]
public LoginType VisType { get; set; }
/// <summary>
/// 访问时间
/// </summary>
[SugarColumn(ColumnDescription = "访问时间", IsNullable = true)]
public DateTime VisTime { get; set; }
/// <summary>
/// 访问人
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "访问人", IsNullable = true)]
public string Account { get; set; }
}

@ -0,0 +1,133 @@
using SqlSugar;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 菜单表
/// </summary>
[SugarTable("sys_menu")]
[Description("菜单表")]
public class SysMenu : DEntityBase
{
/// <summary>
/// 父Id
/// </summary>
[SugarColumn(ColumnDescription = "父Id")]
public long Pid { get; set; }
/// <summary>
/// 父Ids
/// </summary>
[SugarColumn(ColumnDescription = "父Ids")]
public string Pids { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码")]
public string Code { get; set; }
/// <summary>
/// 菜单类型(字典 0目录 1菜单 2按钮
/// </summary>
[SugarColumn(ColumnDescription = "菜单类型(字典 0目录 1菜单 2按钮")]
public int Type { get; set; }
/// <summary>
/// 图标
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "图标", IsNullable = true)]
public string Icon { get; set; }
/// <summary>
/// 路由地址
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "路由地址", IsNullable = true)]
public string Router { get; set; }
/// <summary>
/// 组件地址
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "组件地址", IsNullable = true)]
public string Component { get; set; }
/// <summary>
/// 权限标识
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "权限标识", IsNullable = true)]
public string Permission { get; set; }
/// <summary>
/// 应用分类(应用编码)
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "应用分类(应用编码)", IsNullable = true)]
public string Application { get; set; }
/// <summary>
/// 打开方式(字典 0无 1组件 2内链 3外链
/// </summary>
[SugarColumn(ColumnDescription = "打开方式(字典 0无 1组件 2内链 3外链")]
public int OpenType { get; set; } = 0;
/// <summary>
/// 是否可见Y-是N-否)
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "是否可见Y-是N-否)", IsNullable = true)]
public string Visible { get; set; } = "Y";
/// <summary>
/// 内链地址
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "内链地址", IsNullable = true)]
public string Link { get; set; }
/// <summary>
/// 重定向地址
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "重定向地址", IsNullable = true)]
public string Redirect { get; set; }
/// <summary>
/// 权重(字典 1系统权重 2业务权重
/// </summary>
[SugarColumn(ColumnDescription = "权重(字典 1系统权重 2业务权重")]
public int Weight { get; set; } = 2;
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int Sort { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,77 @@
using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 通知公告表
/// </summary>
[SugarTable("sys_notice")]
[Description("通知公告表")]
public class SysNotice : DEntityBase
{
/// <summary>
/// 标题
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "标题")]
public string Title { get; set; }
/// <summary>
/// 内容
/// </summary>
[Required]
[SugarColumn(ColumnDescription = "内容")]
public string Content { get; set; }
/// <summary>
/// 类型(字典 1通知 2公告
/// </summary>
[SugarColumn(ColumnDescription = "类型(字典 1通知 2公告")]
public NoticeType Type { get; set; }
/// <summary>
/// 发布人Id
/// </summary>
[SugarColumn(ColumnDescription = "发布人Id")]
public long PublicUserId { get; set; }
/// <summary>
/// 发布人姓名
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "发布人姓名", IsNullable = true)]
public string PublicUserName { get; set; }
/// <summary>
/// 发布机构Id
/// </summary>
[SugarColumn(ColumnDescription = "发布机构Id")]
public long PublicOrgId { get; set; }
/// <summary>
/// 发布机构名称
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "发布机构名称", IsNullable = true)]
public string PublicOrgName { get; set; }
/// <summary>
/// 发布时间
/// </summary>
[SugarColumn(ColumnDescription = "发布时间")]
public DateTime PublicTime { get; set; }
/// <summary>
/// 撤回时间
/// </summary>
[SugarColumn(ColumnDescription = "撤回时间", IsNullable = true)]
public DateTime CancelTime { get; set; }
/// <summary>
/// 状态(字典 0草稿 1发布 2撤回 3删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0草稿 1发布 2撤回 3删除")]
public NoticeStatus Status { get; set; }
}

@ -0,0 +1,37 @@
using SqlSugar;
using System;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 通知公告用户表
/// </summary>
[SugarTable("sys_notice_user")]
[Description("通知公告用户表")]
public class SysNoticeUser
{
/// <summary>
/// 通知公告Id
/// </summary>
[SugarColumn(ColumnDescription = "通知公告Id")]
public long NoticeId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 阅读时间
/// </summary>
[SugarColumn(ColumnDescription = "阅读时间", IsNullable = true)]
public DateTime ReadTime { get; set; }
/// <summary>
/// 状态(字典 0未读 1已读
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0未读 1已读")]
public NoticeUserStatus ReadStatus { get; set; }
}

@ -0,0 +1,93 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// Oauth登录用户表
/// </summary>
[SugarTable("sys_oauth_user")]
[Description("Oauth登录用户表")]
public class SysOauthUser : DEntityBase
{
/// <summary>
/// 第三方平台的用户唯一Id
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "第三方平台的用户唯一Id", IsNullable = true)]
public string Uuid { get; set; }
/// <summary>
/// 用户授权的token
/// </summary>
[SugarColumn(ColumnDescription = "用户授权的token", IsNullable = true)]
public string AccessToken { get; set; }
/// <summary>
/// 昵称
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "昵称", IsNullable = true)]
public string NickName { get; set; }
/// <summary>
/// 头像
/// </summary>
[SugarColumn(ColumnDescription = "头像", IsNullable = true)]
public string Avatar { get; set; }
/// <summary>
/// 性别
/// </summary>
[MaxLength(5)]
[SugarColumn(ColumnDescription = "性别", IsNullable = true)]
public string Gender { get; set; }
/// <summary>
/// 电话
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "电话", IsNullable = true)]
public string Phone { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "邮箱", IsNullable = true)]
public string Email { get; set; }
/// <summary>
/// 位置
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "位置", IsNullable = true)]
public string Location { get; set; }
/// <summary>
/// 用户网址
/// </summary>
[SugarColumn(ColumnDescription = "用户网址", IsNullable = true)]
public string Blog { get; set; }
/// <summary>
/// 所在公司
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "所在公司", IsNullable = true)]
public string Company { get; set; }
/// <summary>
/// 用户来源
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "用户来源", IsNullable = true)]
public string Source { get; set; }
/// <summary>
/// 用户备注(各平台中的用户个人介绍)
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "用户备注(各平台中的用户个人介绍)", IsNullable = true)]
public string Remark { get; set; }
}

@ -0,0 +1,60 @@
using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 在线用户表
/// </summary>
[SugarTable("sys_online_user")]
[Description("在线用户表")]
public class OnlineUser : AutoIncrementEntity
{
/// <summary>
/// 连接Id
/// </summary>
[SugarColumn(ColumnDescription = "连接Id")]
public string ConnectionId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 账号
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "账号", IsNullable = true)]
public string Account { get; set; }
/// <summary>
/// 姓名
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "姓名", IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 最后连接时间
/// </summary>
[SugarColumn(ColumnDescription = "最后连接时间", IsNullable = true)]
public DateTime LastTime { get; set; }
/// <summary>
/// 最后登录IP
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "最后登录IP", IsNullable = true)]
public string LastLoginIp { get; set; }
/// <summary>
/// 租户id
/// </summary>
[SugarColumn(ColumnDescription = "租户id", IsNullable = true)]
public virtual long TenantId { get; set; }
}

@ -0,0 +1,72 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 组织机构表
/// </summary>
[SugarTable("sys_org")]
[Description("组织机构表")]
public class SysOrg : DBEntityTenant
{
/// <summary>
/// 父Id
/// </summary>
[SugarColumn(ColumnDescription = "父Id")]
public long Pid { get; set; }
/// <summary>
/// 父Ids
/// </summary>
[SugarColumn(ColumnDescription = "父Ids", IsNullable = true)]
public string Pids { get; set; }
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(30)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码")]
public string Code { get; set; }
/// <summary>
/// 联系人
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "联系人", IsNullable = true)]
public string Contacts { get; set; }
/// <summary>
/// 电话
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "电话", IsNullable = true)]
public string Tel { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,46 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 职位表
/// </summary>
[SugarTable("sys_pos")]
[Description("职位表")]
public class SysPos : DBEntityTenant
{
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int Sort { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,58 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 角色表
/// </summary>
[SugarTable("sys_role")]
[Description("角色表")]
public class SysRole : DBEntityTenant
{
/// <summary>
/// 名称
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "名称")]
public string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "编码")]
public string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int Sort { get; set; }
/// <summary>
/// 数据范围类型(字典 1全部数据 2本部门及以下数据 3本部门数据 4仅本人数据 5自定义数据
/// </summary>
[SugarColumn(ColumnDescription = "数据范围类型(字典 1全部数据 2本部门及以下数据 3本部门数据 4仅本人数据 5自定义数据")]
public DataScopeType DataScopeType { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 状态(字典 0正常 1停用 2删除
/// </summary>
[SugarColumn(ColumnDescription = "状态(字典 0正常 1停用 2删除")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 管理员类型-超级管理员_1、非管理员_2
/// </summary>
[SugarColumn(ColumnDescription = " 管理员类型-超级管理员_1、非管理员_2", IsNullable = true)]
public RoleType? RoleType { get; set; }
}

@ -0,0 +1,27 @@
using SqlSugar;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 角色数据范围表
/// </summary>
[SugarTable("sys_role_data_scope")]
[Description("角色数据范围表")]
public class SysRoleDataScope
{
/// <summary>
/// 角色Id
/// </summary>
[SugarColumn(ColumnDescription = "角色Id")]
public long SysRoleId { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long SysOrgId { get; set; }
}

@ -0,0 +1,26 @@
using SqlSugar;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 角色菜单表
/// </summary>
[SugarTable("sys_role_menu")]
[Description("角色菜单表")]
public class SysRoleMenu
{
/// <summary>
/// 角色Id
/// </summary>
[SugarColumn(ColumnDescription = "角色Id")]
public long SysRoleId { get; set; }
/// <summary>
/// 菜单Id
/// </summary>
[SugarColumn(ColumnDescription = "菜单Id")]
public long SysMenuId { get; set; }
}

@ -0,0 +1,74 @@
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 租户表
/// </summary>
[SugarTable("sys_tenant")]
[Description("租户表")]
public class SysTenant : DEntityBase
{
/// <summary>
/// 公司名称
/// </summary>
[Required, MaxLength(30)]
[SugarColumn(ColumnDescription = "公司名称")]
public string Name { get; set; }
/// <summary>
/// 管理员名称
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "管理员名称")]
public string AdminName { get; set; }
/// <summary>
/// 主机
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "主机", IsNullable = true)]
public string Host { get; set; }
/// <summary>
/// 电子邮箱
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "电子邮箱", IsNullable = true)]
public string Email { get; set; }
/// <summary>
/// 电话
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "电话", IsNullable = true)]
public string Phone { get; set; }
/// <summary>
/// 数据库连接
/// </summary>
[MaxLength(200)]
[SugarColumn(ColumnDescription = "数据库连接", IsNullable = true)]
public string Connection { get; set; }
/// <summary>
/// 架构
/// </summary>
[MaxLength(50)]
[SugarColumn(ColumnDescription = "架构", IsNullable = true)]
public string Schema { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
/// <summary>
/// 租户类型
/// </summary>
[SugarColumn(ColumnDescription = "租户类型")]
public TenantTypeEnum TenantType { get; set; }
}

@ -0,0 +1,94 @@
using Furion.TaskScheduler;
using SqlSugar;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 定时任务
/// </summary>
[SugarTable("sys_timer")]
[Description("定时任务")]
public class SysTimer : DEntityBase
{
/// <summary>
/// 任务名称
/// </summary>
/// <example>magic</example>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "任务名称")]
public string JobName { get; set; }
/// <summary>
/// 只执行一次
/// </summary>
[SugarColumn(ColumnDescription = "只执行一次")]
public bool DoOnce { get; set; } = false;
/// <summary>
/// 立即执行(默认等待启动)
/// </summary>
[SugarColumn(ColumnDescription = "立即执行(默认等待启动)")]
public bool StartNow { get; set; } = false;
/// <summary>
/// 执行类型(并行、列队)
/// </summary>
[SugarColumn(ColumnDescription = "执行类型(并行、列队)")]
public SpareTimeExecuteTypes ExecuteType { get; set; } = SpareTimeExecuteTypes.Parallel;
/// <summary>
/// 执行间隔时间(单位秒)
/// </summary>
/// <example>5</example>
[SugarColumn(ColumnDescription = "执行间隔时间(单位秒)", IsNullable = true)]
public int? Interval { get; set; } = 5;
/// <summary>
/// Cron表达式
/// </summary>
/// <example></example>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "Cron表达式", IsNullable = true)]
public string Cron { get; set; }
/// <summary>
/// 定时器类型
/// </summary>
[SugarColumn(ColumnDescription = "定时器类型")]
public SpareTimeTypes TimerType { get; set; } = SpareTimeTypes.Interval;
/// <summary>
/// 请求url
/// </summary>
[MaxLength(200)]
[SugarColumn(ColumnDescription = "请求url", IsNullable = true)]
public string RequestUrl { get; set; }
/// <summary>
/// 请求参数PostPut请求用
/// </summary>
[SugarColumn(ColumnDescription = "请求参数PostPut请求用", IsNullable = true)]
public string RequestParameters { get; set; }
/// <summary>
/// Headers(可以包含如Authorization授权认证)
/// 格式:{"Authorization":"userpassword.."}
/// </summary>
[SugarColumn(ColumnDescription = "Headers", IsNullable = true)]
public string Headers { get; set; }
/// <summary>
/// 请求类型
/// </summary>
/// <example>2</example>
[SugarColumn(ColumnDescription = "请求类型", IsNullable = true)]
public RequestTypeEnum RequestType { get; set; } = RequestTypeEnum.Post;
/// <summary>
/// 备注
/// </summary>
[MaxLength(100)]
[SugarColumn(ColumnDescription = "备注", IsNullable = true)]
public string Remark { get; set; }
}

@ -0,0 +1,105 @@
using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 用户表
/// </summary>
[SugarTable("sys_user")]
[Description("用户表")]
public class SysUser : DBEntityTenant
{
/// <summary>
/// 账号
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "账号")]
public string Account { get; set; }
/// <summary>
/// 密码默认MD5加密
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "密码默认MD5加密")]
public string Password { get; set; }
/// <summary>
/// 昵称
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "昵称", IsNullable = true)]
public string NickName { get; set; }
/// <summary>
/// 姓名
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "姓名", IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 头像
/// </summary>
[SugarColumn(ColumnDescription = "头像", IsNullable = true)]
public string Avatar { get; set; }
/// <summary>
/// 生日
/// </summary>
[SugarColumn(ColumnDescription = "生日", IsNullable = true)]
public DateTime Birthday { get; set; }
/// <summary>
/// 性别-男_1、女_2
/// </summary>
[SugarColumn(ColumnDescription = "性别-男_1、女_2")]
public Gender Sex { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "邮箱", IsNullable = true)]
public string Email { get; set; }
/// <summary>
/// 手机
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "手机", IsNullable = true)]
public string Phone { get; set; }
/// <summary>
/// 电话
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "电话", IsNullable = true)]
public string Tel { get; set; }
/// <summary>
/// 最后登录IP
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "最后登录IP", IsNullable = true)]
public string LastLoginIp { get; set; }
/// <summary>
/// 最后登录时间
/// </summary>
[SugarColumn(ColumnDescription = "最后登录时间", IsNullable = true)]
public DateTime LastLoginTime { get; set; }
/// <summary>
/// 管理员类型-超级管理员_1、非管理员_2
/// </summary>
[SugarColumn(ColumnDescription = "管理员类型-超级管理员_1、非管理员_2")]
public AdminType? AdminType { get; set; }
/// <summary>
/// 状态-正常_0、停用_1、删除_2
/// </summary>
[SugarColumn(ColumnDescription = "状态-正常_0、停用_1、删除_2")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,28 @@
using SqlSugar;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 用户数据范围表
/// </summary>
[SugarTable("sys_user_data_scope")]
[Description("用户数据范围表")]
public class SysUserDataScope
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long SysUserId { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long SysOrgId { get; set; }
}

@ -0,0 +1,28 @@
using SqlSugar;
using System.ComponentModel;
namespace Magic.Core.Entity;
/// <summary>
/// 用户角色表
/// </summary>
[SugarTable("sys_user_role")]
[Description("用户角色表")]
public class SysUserRole
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long SysUserId { get; set; }
/// <summary>
/// 系统角色Id
/// </summary>
[SugarColumn(ColumnDescription = "系统角色Id")]
public long SysRoleId { get; set; }
}

@ -0,0 +1,105 @@
using SqlSugar;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
namespace Magic.Core.Entity;
/// <summary>
/// 用户表
/// </summary>
[SugarTable("sys_test")]
[Description("测试表")]
public class Test : DBEntityTenant
{
/// <summary>
/// 账号
/// </summary>
[Required, MaxLength(20)]
[SugarColumn(ColumnDescription = "账号")]
public string Account { get; set; }
/// <summary>
/// 密码默认MD5加密
/// </summary>
[Required, MaxLength(50)]
[SugarColumn(ColumnDescription = "密码默认MD5加密")]
public string Password { get; set; }
/// <summary>
/// 昵称
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "昵称", IsNullable = true)]
public string NickName { get; set; }
/// <summary>
/// 姓名
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "姓名", IsNullable = true)]
public string Name { get; set; }
/// <summary>
/// 头像
/// </summary>
[SugarColumn(ColumnDescription = "头像", IsNullable = true)]
public string Avatar { get; set; }
/// <summary>
/// 生日
/// </summary>
[SugarColumn(ColumnDescription = "生日", IsNullable = true)]
public DateTime Birthday { get; set; }
/// <summary>
/// 性别-男_1、女_2
/// </summary>
[SugarColumn(ColumnDescription = "性别-男_1、女_2")]
public Gender Sex { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "邮箱", IsNullable = true)]
public string Email { get; set; }
/// <summary>
/// 手机
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "手机", IsNullable = true)]
public string Phone { get; set; }
/// <summary>
/// 电话
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "电话", IsNullable = true)]
public string Tel { get; set; }
/// <summary>
/// 最后登录IP
/// </summary>
[MaxLength(20)]
[SugarColumn(ColumnDescription = "最后登录IP", IsNullable = true)]
public string LastLoginIp { get; set; }
/// <summary>
/// 最后登录时间
/// </summary>
[SugarColumn(ColumnDescription = "最后登录时间", IsNullable = true)]
public DateTime LastLoginTime { get; set; }
/// <summary>
/// 管理员类型-超级管理员_1、非管理员_2
/// </summary>
[SugarColumn(ColumnDescription = "管理员类型-超级管理员_1、非管理员_2")]
public AdminType? AdminType { get; set; }
/// <summary>
/// 状态-正常_0、停用_1、删除_2
/// </summary>
[SugarColumn(ColumnDescription = "状态-正常_0、停用_1、删除_2")]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
}

@ -0,0 +1,28 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// 账号类型
/// </summary>
[Description("账号类型")]
public enum AdminType
{
/// <summary>
/// 超级管理员
/// </summary>
[Description("超级管理员")]
SuperAdmin = 1,
/// <summary>
/// 管理员
/// </summary>
[Description("管理员")]
Admin = 2,
/// <summary>
/// 普通账号
/// </summary>
[Description("普通账号")]
None = 3
}

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Magic.Core;
/// <summary>
/// 缓存类型
/// </summary>
public enum CacheType
{
/// <summary>
/// 内存缓存
/// </summary>
MemoryCache,
/// <summary>
/// Redis缓存
/// </summary>
RedisCache
}

@ -0,0 +1,27 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// 公共状态
/// </summary>
public enum CommonStatus
{
/// <summary>
/// 正常
/// </summary>
[Description("正常")]
ENABLE = 0,
/// <summary>
/// 停用
/// </summary>
[Description("停用")]
DISABLE = 1,
/// <summary>
/// 删除
/// </summary>
[Description("删除")]
DELETED = 2
}

@ -0,0 +1,77 @@
namespace Magic.Core;
/// <summary>
/// 数据操作类型
/// </summary>
public enum DataOpType
{
/// <summary>
/// 其它
/// </summary>
OTHER,
/// <summary>
/// 增加
/// </summary>
ADD,
/// <summary>
/// 删除
/// </summary>
DELETE,
/// <summary>
/// 编辑
/// </summary>
EDIT,
/// <summary>
/// 更新
/// </summary>
UPDATE,
/// <summary>
/// 查询
/// </summary>
QUERY,
/// <summary>
/// 详情
/// </summary>
DETAIL,
/// <summary>
/// 树
/// </summary>
TREE,
/// <summary>
/// 导入
/// </summary>
IMPORT,
/// <summary>
/// 导出
/// </summary>
EXPORT,
/// <summary>
/// 授权
/// </summary>
GRANT,
/// <summary>
/// 强退
/// </summary>
FORCE,
/// <summary>
/// 清空
/// </summary>
CLEAN,
/// <summary>
/// 修改状态
/// </summary>
CHANGE_STATUS
}

@ -0,0 +1,36 @@
using System.ComponentModel;
namespace Magic.Core;
public enum DataScopeType
{
/// <summary>
/// 全部数据
/// </summary>
[Description("全部数据")]
ALL = 1,
/// <summary>
/// 本部门及以下数据
/// </summary>
[Description("本部门及以下数据")]
DEPT_WITH_CHILD = 2,
/// <summary>
/// 本部门数据
/// </summary>
[Description("本部门数据")]
DEPT = 3,
/// <summary>
/// 仅本人数据
/// </summary>
[Description("仅本人数据")]
SELF = 4,
/// <summary>
/// 自定义数据
/// </summary>
[Description("自定义数据")]
DEFINE = 5
}

@ -0,0 +1,22 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// 文档类型
/// </summary>
public enum DocumentType
{
/// <summary>
/// 文件夹
/// </summary>
[Description("文件夹")]
Folder = 1,
/// <summary>
/// 文件
/// </summary>
[Description("文件")]
File = 2,
}

@ -0,0 +1,406 @@
using Furion.FriendlyException;
namespace Magic.Core;
/// <summary>
/// 系统错误码
/// </summary>
[ErrorCodeType]
public enum ErrorCode
{
/// <summary>
/// 用户名或密码不正确
/// </summary>
[ErrorCodeItemMetadata("用户名或密码不正确")]
D1000,
/// <summary>
/// 非法操作!禁止删除自己
/// </summary>
[ErrorCodeItemMetadata("非法操作,禁止删除自己")]
D1001,
/// <summary>
/// 记录不存在
/// </summary>
[ErrorCodeItemMetadata("记录不存在")]
D1002,
/// <summary>
/// 账号已存在
/// </summary>
[ErrorCodeItemMetadata("账号已存在")]
D1003,
/// <summary>
/// 旧密码不匹配
/// </summary>
[ErrorCodeItemMetadata("旧密码输入错误")]
D1004,
/// <summary>
/// 测试数据禁止更改admin密码
/// </summary>
[ErrorCodeItemMetadata("测试数据禁止更改用户【admin】密码")]
D1005,
/// <summary>
/// 数据已存在
/// </summary>
[ErrorCodeItemMetadata("数据已存在")]
D1006,
/// <summary>
/// 数据不存在或含有关联引用,禁止删除
/// </summary>
[ErrorCodeItemMetadata("数据不存在或含有关联引用,禁止删除")]
D1007,
/// <summary>
/// 禁止为管理员分配角色
/// </summary>
[ErrorCodeItemMetadata("禁止为管理员分配角色")]
D1008,
/// <summary>
/// 重复数据或记录含有不存在数据
/// </summary>
[ErrorCodeItemMetadata("重复数据或记录含有不存在数据")]
D1009,
/// <summary>
/// 禁止为超级管理员角色分配权限
/// </summary>
[ErrorCodeItemMetadata("禁止为超级管理员角色分配权限")]
D1010,
/// <summary>
/// 非法数据
/// </summary>
[ErrorCodeItemMetadata("非法数据")]
D1011,
/// <summary>
/// Id不能为空
/// </summary>
[ErrorCodeItemMetadata("Id不能为空")]
D1012,
/// <summary>
/// 所属机构不在自己的数据范围内
/// </summary>
[ErrorCodeItemMetadata("没有权限操作该数据")]
D1013,
/// <summary>
/// 禁止删除超级管理员
/// </summary>
[ErrorCodeItemMetadata("禁止删除超级管理员")]
D1014,
/// <summary>
/// 禁止修改超级管理员状态
/// </summary>
[ErrorCodeItemMetadata("禁止修改超级管理员状态")]
D1015,
/// <summary>
/// 没有权限
/// </summary>
[ErrorCodeItemMetadata("没有权限")]
D1016,
/// <summary>
/// 账号已冻结
/// </summary>
[ErrorCodeItemMetadata("账号已冻结")]
D1017,
/// <summary>
/// 父机构不存在
/// </summary>
[ErrorCodeItemMetadata("父机构不存在")]
D2000,
/// <summary>
/// 当前机构Id不能与父机构Id相同
/// </summary>
[ErrorCodeItemMetadata("当前机构Id不能与父机构Id相同")]
D2001,
/// <summary>
/// 已有相同组织机构,编码或名称相同
/// </summary>
[ErrorCodeItemMetadata("已有相同组织机构,编码或名称相同")]
D2002,
/// <summary>
/// 没有权限操作机构
/// </summary>
[ErrorCodeItemMetadata("没有权限操作机构")]
D2003,
/// <summary>
/// 该机构下有员工禁止删除
/// </summary>
[ErrorCodeItemMetadata("该机构下有员工禁止删除")]
D2004,
/// <summary>
/// 附属机构下有员工禁止删除
/// </summary>
[ErrorCodeItemMetadata("附属机构下有员工禁止删除")]
D2005,
/// <summary>
/// 只能增加下级机构
/// </summary>
[ErrorCodeItemMetadata("只能增加下级机构")]
D2006,
/// <summary>
/// 字典类型不存在
/// </summary>
[ErrorCodeItemMetadata("字典类型不存在")]
D3000,
/// <summary>
/// 字典类型已存在
/// </summary>
[ErrorCodeItemMetadata("字典类型已存在,名称或编码重复")]
D3001,
/// <summary>
/// 字典类型下面有字典值禁止删除
/// </summary>
[ErrorCodeItemMetadata("字典类型下面有字典值禁止删除")]
D3002,
/// <summary>
/// 字典值已存在
/// </summary>
[ErrorCodeItemMetadata("字典值已存在,名称或编码重复")]
D3003,
/// <summary>
/// 字典值不存在
/// </summary>
[ErrorCodeItemMetadata("字典值不存在")]
D3004,
/// <summary>
/// 字典状态错误
/// </summary>
[ErrorCodeItemMetadata("字典状态错误")]
D3005,
/// <summary>
/// 菜单已存在
/// </summary>
[ErrorCodeItemMetadata("菜单已存在")]
D4000,
/// <summary>
/// 路由地址为空
/// </summary>
[ErrorCodeItemMetadata("路由地址为空")]
D4001,
/// <summary>
/// 打开方式为空
/// </summary>
[ErrorCodeItemMetadata("打开方式为空")]
D4002,
/// <summary>
/// 权限标识格式为空
/// </summary>
[ErrorCodeItemMetadata("权限标识格式为空")]
D4003,
/// <summary>
/// 权限标识格式错误
/// </summary>
[ErrorCodeItemMetadata("权限标识格式错误")]
D4004,
/// <summary>
/// 权限不存在
/// </summary>
[ErrorCodeItemMetadata("权限不存在")]
D4005,
/// <summary>
/// 父级菜单不能为当前节点,请重新选择父级菜单
/// </summary>
[ErrorCodeItemMetadata("父级菜单不能为当前节点,请重新选择父级菜单")]
D4006,
/// <summary>
/// 不能移动根节点
/// </summary>
[ErrorCodeItemMetadata("不能移动根节点")]
D4007,
/// <summary>
/// 已存在同名或同编码应用
/// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码应用")]
D5000,
/// <summary>
/// 默认激活系统只能有一个
/// </summary>
[ErrorCodeItemMetadata("默认激活系统只能有一个")]
D5001,
/// <summary>
/// 该应用下有菜单禁止删除
/// </summary>
[ErrorCodeItemMetadata("该应用下有菜单禁止删除")]
D5002,
/// <summary>
/// 已存在同名或同编码应用
/// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码应用")]
D5003,
/// <summary>
/// 已存在同名或同编码职位
/// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码职位")]
D6000,
/// <summary>
/// 该职位下有员工禁止删除
/// </summary>
[ErrorCodeItemMetadata("该职位下有员工禁止删除")]
D6001,
/// <summary>
/// 通知公告状态错误
/// </summary>
[ErrorCodeItemMetadata("通知公告状态错误")]
D7000,
/// <summary>
/// 通知公告删除失败
/// </summary>
[ErrorCodeItemMetadata("通知公告删除失败")]
D7001,
/// <summary>
/// 通知公告编辑失败
/// </summary>
[ErrorCodeItemMetadata("通知公告编辑失败,类型必须为草稿")]
D7002,
/// <summary>
/// 文件不存在
/// </summary>
[ErrorCodeItemMetadata("文件不存在")]
D8000,
/// <summary>
/// 已存在同名或同编码参数配置
/// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码参数配置")]
D9000,
/// <summary>
/// 禁止删除系统参数
/// </summary>
[ErrorCodeItemMetadata("禁止删除系统参数")]
D9001,
/// <summary>
/// 已存在同名任务调度
/// </summary>
[ErrorCodeItemMetadata("已存在同名任务调度")]
D1100,
/// <summary>
/// 任务调度不存在
/// </summary>
[ErrorCodeItemMetadata("任务调度不存在")]
D1101,
/// <summary>
/// 演示环境禁止修改数据
/// </summary>
[ErrorCodeItemMetadata("演示环境禁止修改数据")]
D1200,
/// <summary>
/// 已存在同名或同主机租户
/// </summary>
[ErrorCodeItemMetadata("已存在同名或同主机租户")]
D1300,
/// <summary>
/// 该表代码模板已经生成过
/// </summary>
[ErrorCodeItemMetadata("该表代码模板已经生成过")]
D1400,
/// <summary>
/// 该类型不存在
/// </summary>
[ErrorCodeItemMetadata("该类型不存在")]
D1501,
/// <summary>
/// 该字段不存在
/// </summary>
[ErrorCodeItemMetadata("该字段不存在")]
D1502,
/// <summary>
/// 该类型不是枚举类型
/// </summary>
[ErrorCodeItemMetadata("该类型不是枚举类型")]
D1503,
/// <summary>
/// 该实体不存在
/// </summary>
[ErrorCodeItemMetadata("该实体不存在")]
D1504,
/// <summary>
/// 父菜单不存在
/// </summary>
[ErrorCodeItemMetadata("父菜单不存在")]
D1505,
/// <summary>
/// 已存在同名或同编码项目
/// </summary>
[ErrorCodeItemMetadata("已存在同名或同编码项目")]
xg1000,
/// <summary>
/// 已存在相同证件号码人员
/// </summary>
[ErrorCodeItemMetadata("已存在相同证件号码人员")]
xg1001,
/// <summary>
/// 检测数据不存在
/// </summary>
[ErrorCodeItemMetadata("检测数据不存在")]
xg1002,
[ErrorCodeItemMetadata("请添加数据列")]
db1000,
[ErrorCodeItemMetadata("数据表不存在")]
db1001,
/// <summary>
/// 表单不存在
/// </summary>
[ErrorCodeItemMetadata("表单不存在")]
F1000
}

@ -0,0 +1,37 @@
namespace Magic.Core;
/// <summary>
/// 文件扩展枚举
/// </summary>
public enum FileExtensionEnum
{
JPG = 255216,
GIF = 7173,
BMP = 6677,
PNG = 13780,
COM = 7790,
EXE = 7790,
DLL = 7790,
RAR = 8297,
ZIP = 8075,
XML = 6063,
HTML = 6033,
ASPX = 239187,
CS = 117115,
JS = 119105,
TXT = 210187,
SQL = 255254,
BAT = 64101,
BTSEED = 10056,
RDP = 255254,
PSD = 5666,
PDF = 3780,
CHM = 7384,
LOG = 70105,
REG = 8269,
HLP = 6395,
DOC = 208207,
XLS = 208207,
DOCX = 208207,
XLSX = 208207,
}

@ -0,0 +1,33 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// 文件存储位置
/// </summary>
public enum FileLocation
{
/// <summary>
/// 阿里云
/// </summary>
[Description("阿里云")]
ALIYUN = 1,
/// <summary>
/// 腾讯云
/// </summary>
[Description("腾讯云")]
TENCENT = 2,
/// <summary>
/// minio服务器
/// </summary>
[Description("minio服务器")]
MINIO = 3,
/// <summary>
/// 本地
/// </summary>
[Description("本地")]
LOCAL = 4
}

@ -0,0 +1,18 @@
using System.ComponentModel;
namespace Magic.Core;
public enum FilterType
{
/// <summary>
/// 用户
/// </summary>
[Description("用户")]
User = 0,
/// <summary>
/// 组织
/// </summary>
[Description("组织")]
Org = 1,
}

@ -0,0 +1,27 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// 性别
/// </summary>
public enum Gender
{
/// <summary>
/// 男
/// </summary>
[Description("男")]
MALE = 1,
/// <summary>
/// 女
/// </summary>
[Description("女")]
FEMALE = 2,
/// <summary>
/// 未知
/// </summary>
[Description("未知")]
UNKNOWN = 3
}

@ -0,0 +1,251 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// HTTP状态码
/// </summary>
public enum HttpStatusCode
{
/// <summary>
/// 客户端可能继续其请求
/// </summary>
[Description("继续")]
Continue = 100,
/// <summary>
/// 正在更改协议版本或协议
/// </summary>
[Description("交换协议")]
SwitchingProtocols = 101,
/// <summary>
/// 请求成功,且请求的信息包含在响应中
/// </summary>
[Description("OK")]
OK = 200,
/// <summary>
/// 请求导致在响应被发送前创建新资源
/// </summary>
[Description("已创建")]
Created = 201,
/// <summary>
/// 请求已被接受做进一步处理
/// </summary>
[Description("接收")]
Accepted = 202,
/// <summary>
/// 返回的元信息来自缓存副本而不是原始服务器,因此可能不正确
/// </summary>
[Description("非认证信息")]
NonAuthoritativeInformation = 203,
/// <summary>
/// 已成功处理请求并且响应已被设定为无内容
/// </summary>
[Description("无内容")]
NoContent = 204,
/// <summary>
/// 客户端应重置(或重新加载)当前资源
/// </summary>
[Description("重置内容")]
ResetContent = 205,
/// <summary>
/// 响应是包括字节范围的 GET请求所请求的部分响应
/// </summary>
[Description("部分内容")]
PartialContent = 206,
/// <summary>
/// 请求的信息有多种表示形式,默认操作是将此状态视为重定向
/// </summary>
[Description("多路选择")]
MultipleChoices = 300,
/// <summary>
/// 请求的信息已移到 Location头中指定的 URI 处
/// </summary>
[Description("永久转移")]
MovedPermanently = 301,
/// <summary>
/// 请求的信息位于 Location 头中指定的 URI 处
/// </summary>
[Description("暂时转移")]
Found = 302,
/// <summary>
/// 将客户端自动重定向到 Location 头中指定的 URI
/// </summary>
[Description("参见其它")]
SeeOther = 303,
/// <summary>
/// 客户端的缓存副本是最新的
/// </summary>
[Description("未修改")]
NotModified = 304,
/// <summary>
/// 请求应使用位于 Location 头中指定的 URI 的代理服务器
/// </summary>
[Description("使用代理")]
UseProxy = 305,
/// <summary>
/// 服务器未能识别请求
/// </summary>
[Description("错误请求")]
BadRequest = 400,
/// <summary>
/// 请求的资源要求身份验证
/// </summary>
[Description("未授权")]
Unauthorized = 401,
/// <summary>
/// 需要付费
/// </summary>
[Description("需要付费")]
PaymentRequired = 402,
/// <summary>
/// 服务器拒绝满足请求
/// </summary>
[Description("禁止请求")]
Forbidden = 403,
/// <summary>
/// 请求的资源不在服务器上
/// </summary>
[Description("未找到")]
NotFound = 404,
/// <summary>
/// 请求的资源上不允许请求方法POST或 GET
/// </summary>
[Description("请求方法不允许")]
MethodNotAllowed = 405,
/// <summary>
/// 客户端已用 Accept 头指示将不接受资源的任何可用表示形式
/// </summary>
[Description("不接受")]
NotAcceptable = 406,
/// <summary>
/// 请求的代理要求身份验证
/// Proxy-authenticate 头包含如何执行身份验证的详细信息
/// </summary>
[Description("需要代理认证")]
ProxyAuthenticationRequired = 407,
/// <summary>
/// 客户端没有在服务器期望请求的时间内发送请求
/// </summary>
[Description("请求超时")]
RequestTimeout = 408,
/// <summary>
/// 由于服务器上的冲突而未能执行请求
/// </summary>
[Description("冲突")]
Conflict = 409,
/// <summary>
/// 请求的资源不再可用
/// </summary>
[Description("失败")]
Gone = 410,
/// <summary>
/// 缺少必需的 Content-length
/// </summary>
[Description("缺少Content-length头")]
LengthRequired = 411,
/// <summary>
/// 为此请求设置的条件失败,且无法执行此请求
/// 条件是用条件请求标头(如 If-Match、If-None-Match 或 If-Unmodified-Since设置的。
/// </summary>
[Description("条件失败")]
PreconditionFailed = 412,
/// <summary>
/// 请求太大,服务器无法处理
/// </summary>
[Description("请求实体太大")]
RequestEntityTooLarge = 413,
/// <summary>
/// URI 太长
/// </summary>
[Description("请求URI太长")]
RequestUriTooLong = 414,
/// <summary>
/// 请求是不支持的类型
/// </summary>
[Description("不支持的媒体类型")]
UnsupportedMediaType = 415,
/// <summary>
/// 无法返回从资源请求的数据范围,因为范围的开头在资源的开头之前,或因为范围的结尾在资源的结尾之后
/// </summary>
[Description("数据范围不匹配")]
RequestedRangeNotSatisfiable = 416,
/// <summary>
/// 服务器未能符合Expect头中给定的预期值
/// </summary>
[Description("服务器与Expect头不匹配")]
ExpectationFailed = 417,
/// <summary>
/// 服务器拒绝处理客户端使用当前协议发送的请求,但是可以接受其使用升级后的协议发送的请求
/// </summary>
[Description("当前协议不受支持")]
UpgradeRequired = 426,
/// <summary>
/// 服务器上发生了一般错误
/// </summary>
[Description("服务器内部错误")]
InternalServerError = 500,
/// <summary>
/// 服务器不支持请求的函数
/// </summary>
[Description("未实现")]
NotImplemented = 501,
/// <summary>
/// 中间代理服务器从另一代理或原始服务器接收到错误响应
/// </summary>
[Description("网关失败")]
BadGateway = 502,
/// <summary>
/// 服务器暂时不可用,通常是由于过多加载或维护
/// </summary>
[Description("服务器维护")]
ServiceUnavailable = 503,
/// <summary>
/// 中间代理服务器在等待来自另一个代理或原始服务器的响应时已超时
/// </summary>
[Description("网关超时")]
GatewayTimeout = 504,
/// <summary>
/// 服务器不支持请求的HTTP版本
/// </summary>
[Description("HTTP版本不支持")]
HttpVersionNotSupported = 505
}

@ -0,0 +1,39 @@
using System.ComponentModel;
namespace Magic.Core;
/// <summary>
/// 登陆类型
/// </summary>
public enum LoginType
{
/// <summary>
/// 登陆
/// </summary>
[Description("登陆")]
LOGIN = 0,
/// <summary>
/// 登出
/// </summary>
[Description("登出")]
LOGOUT = 1,
/// <summary>
/// 注册
/// </summary>
[Description("注册")]
REGISTER = 2,
/// <summary>
/// 改密
/// </summary>
[Description("改密")]
CHANGEPASSWORD = 3,
/// <summary>
/// 三方授权登陆
/// </summary>
[Description("授权登陆")]
AUTHORIZEDLOGIN = 4
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save