更新 数据库模型
This commit is contained in:
parent
1e4794a879
commit
031272ed6b
|
|
@ -0,0 +1,26 @@
|
||||||
|
using Learn.Archives.API.Controllers.Dto;
|
||||||
|
using Learn.Archives.API.Expand;
|
||||||
|
using Learn.Archives.Core.Common;
|
||||||
|
using Learn.Archives.Core.Model;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Security.Claims;
|
||||||
|
using UserCenter.Model;
|
||||||
|
|
||||||
|
namespace Learn.Archives.API.Controllers
|
||||||
|
{
|
||||||
|
public class SchoolController : BackController<School>
|
||||||
|
{
|
||||||
|
readonly Repository<School> baseService;
|
||||||
|
public SchoolController(Repository<School> baseService) : base(baseService)
|
||||||
|
{
|
||||||
|
this.baseService = baseService;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Task<bool> Del([FromBody] params long[] ids)
|
||||||
|
{
|
||||||
|
return base.Del(ids);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,14 +5,21 @@
|
||||||
"Microsoft.AspNetCore": "Error"
|
"Microsoft.AspNetCore": "Error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Redis": {
|
"Redis": {
|
||||||
"ConnectionString": "redis-external.23544.com:16379,password=poiuyt)(*&^%,defaultDatabase=3"
|
"ConnectionString": "redis-external.23544.com:16379,password=poiuyt)(*&^%,defaultDatabase=3"
|
||||||
},
|
},
|
||||||
"DB": {
|
"DB": {
|
||||||
//"ConnectionString": "AllowLoadLocalInfile=true;Server=10.255.255.3;Port=3306;Database=learn.videoanalysis;User ID=marking;Password=qwe123!@#;CharSet=utf8mb4;pooling=true;SslMode=None",
|
//"ConnectionString": "AllowLoadLocalInfile=true;Server=10.255.255.3;Port=3306;Database=learn.videoanalysis;User ID=marking;Password=qwe123!@#;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
|
"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=learn.videoanalysis;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
"SqlType": "MySql",
|
"SqlType": "MySql",
|
||||||
"UpdateTable": false
|
"UpdateTable": false
|
||||||
|
},
|
||||||
|
"OtherDBArr": [
|
||||||
|
{
|
||||||
|
"ConfigId": 1001, //用户中心
|
||||||
|
"ConnectionString": "AllowLoadLocalInfile=true;Server=rm-2vc20nd3d11g0oh6g2o.rwlb.cn-chengdu.rds.aliyuncs.com;User ID=marking;Password=poiuytPOIUYT098765)(*&^%;Port=3306;Database=usercenter;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
|
"SqlType": "MySql"
|
||||||
}
|
}
|
||||||
}
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
"DB": {
|
"DB": {
|
||||||
"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=learn.archives;CharSet=utf8mb4;pooling=true;SslMode=None",
|
"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=learn.archives;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
"SqlType": "MySql",
|
"SqlType": "MySql",
|
||||||
"UpdateTable": false
|
"UpdateTable": true
|
||||||
},
|
},
|
||||||
"AuthKey": {
|
"AuthKey": {
|
||||||
"Secret": "9FAB7AC7-F2DB-4C52-B81F-044055A34AF2",
|
"Secret": "9FAB7AC7-F2DB-4C52-B81F-044055A34AF2",
|
||||||
|
|
@ -23,11 +23,11 @@
|
||||||
"Expires": 120 // 过期时间120小时
|
"Expires": 120 // 过期时间120小时
|
||||||
},
|
},
|
||||||
"OtherDBArr": [
|
"OtherDBArr": [
|
||||||
//{
|
{
|
||||||
// "ConfigId": 1001, //ResourceBank
|
"ConfigId": 1001, //用户中心
|
||||||
// "ConnectionString": "Server=47.109.35.116;Database=ResourceBank;UID=live;Password=Woshiren^&*();MultipleActiveResultSets=true;Encrypt=True;TrustServerCertificate=True;",
|
"ConnectionString": "AllowLoadLocalInfile=true;Server=192.168.2.9;User ID=root;Password=qwe123!@#;Port=3306;Database=usercenter;CharSet=utf8mb4;pooling=true;SslMode=None",
|
||||||
// "SqlType": "SqlServer"
|
"SqlType": "MySql"
|
||||||
//}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,18 @@ namespace Learn.Archives.Core.Common
|
||||||
/// 主库数据库表类型
|
/// 主库数据库表类型
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly IEnumerable<Type> DbMatserType;
|
public static readonly IEnumerable<Type> DbMatserType;
|
||||||
public static readonly IEnumerable<Type> KnowsType;
|
public static readonly IEnumerable<Type> UserCenterType;
|
||||||
static AppCommon()
|
static AppCommon()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Assemblies = ExpandFunction.GetAssemblies();
|
Assemblies = ExpandFunction.GetAssemblies();
|
||||||
var assembliesType = Assemblies.Where(s => s.FullName.Contains("VideoAnalysis")).SelectMany(s => s.ExportedTypes
|
var assembliesType = Assemblies.Where(s => s.FullName.Contains("Archives")).SelectMany(s => s.ExportedTypes
|
||||||
.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false)));
|
.Where(u => !u.IsInterface && !u.IsAbstract && u.IsClass && u.IsDefined(typeof(SugarTable), false)));
|
||||||
DbMatserType = assembliesType
|
DbMatserType = assembliesType
|
||||||
.Where(u => u.GetInterfaces().Contains(typeof(IDB)));
|
.Where(u => u.GetInterfaces().Contains(typeof(IDB)));
|
||||||
|
UserCenterType = assembliesType
|
||||||
|
.Where(u => u.FullName.Contains("UserCenter"));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,12 +6,12 @@ using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using UserCenter.Model;
|
||||||
|
|
||||||
namespace Learn.Archives.Core.Common
|
namespace Learn.Archives.Core.Common
|
||||||
{
|
{
|
||||||
public class Repository<T> : SimpleClient<T> where T : class, new()
|
public class Repository<T> : SimpleClient<T> where T : class, new()
|
||||||
{
|
{
|
||||||
readonly Dictionary<Type, object?> CID = new Dictionary<Type, object?>();
|
|
||||||
public Repository()
|
public Repository()
|
||||||
{
|
{
|
||||||
SwitchConnection();
|
SwitchConnection();
|
||||||
|
|
@ -19,19 +19,10 @@ namespace Learn.Archives.Core.Common
|
||||||
public void SwitchConnection()
|
public void SwitchConnection()
|
||||||
{
|
{
|
||||||
var t = typeof(T);
|
var t = typeof(T);
|
||||||
if (CID.ContainsKey(t))
|
if (AppCommon.DbMatserType.Contains(t))
|
||||||
{
|
base.Context = DbScoped.Sugar;
|
||||||
base.Context = CID[t] != null
|
else if (AppCommon.UserCenterType.Contains(t))
|
||||||
? DbScoped.Sugar.GetConnectionScope(CID[t])
|
base.Context = DbScoped.Sugar.GetConnectionScope(1001);
|
||||||
: DbScoped.Sugar;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var c = t.GetCustomAttribute<TenantAttribute>();
|
|
||||||
if (!CID.ContainsKey(t))
|
|
||||||
CID.Add(t, c?.configId);
|
|
||||||
base.Context = c != null
|
|
||||||
? DbScoped.Sugar.GetConnectionScope(c.configId)
|
|
||||||
: DbScoped.Sugar;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,21 @@ namespace Learn.Archives.Core.Model
|
||||||
/// 管理员
|
/// 管理员
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("admin")]
|
[SugarTable("admin")]
|
||||||
public class Admin : EntityBaseId,IDB
|
public class Admin : EntityBaseId, IDB
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 账号
|
/// 账号
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarColumn(Length = 12)]
|
[SugarColumn(Length = 12)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 电话号码
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 20)]
|
||||||
|
public string Phone { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 账号
|
||||||
|
/// </summary>
|
||||||
[SugarColumn(Length = 12)]
|
[SugarColumn(Length = 12)]
|
||||||
public string Account { get; set; }
|
public string Account { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,38 @@
|
||||||
|
using Learn.Archives.Core.Model.Interface;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text.Json;
|
||||||
|
using UserCenter.Model;
|
||||||
|
using UserCenter.Model.Enum;
|
||||||
|
using UserCenter.Model.Interface;
|
||||||
|
|
||||||
|
namespace Learn.Archives.Core.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("adminrole")]
|
||||||
|
public class AdminRole : EntityBaseId, IDB
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 角色名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 12)]
|
||||||
|
public string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 备注
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 20)]
|
||||||
|
public string Remark { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 状态
|
||||||
|
/// </summary>
|
||||||
|
public bool Enable { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using SqlSugar;
|
using Learn.Archives.Core.Model.Interface;
|
||||||
|
using SqlSugar;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
@ -13,7 +14,7 @@ namespace Learn.Archives.Core.Model
|
||||||
/// 管理员角色表
|
/// 管理员角色表
|
||||||
///</summary>
|
///</summary>
|
||||||
[SugarTable("httplog")]
|
[SugarTable("httplog")]
|
||||||
public partial class HttpLog : EntityBaseId
|
public partial class HttpLog : EntityBaseId, IDB
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 创建时间
|
/// 创建时间
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,55 @@
|
||||||
|
using Learn.Archives.Core.Model.Interface;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text.Json;
|
||||||
|
using UserCenter.Model;
|
||||||
|
using UserCenter.Model.Enum;
|
||||||
|
using UserCenter.Model.Interface;
|
||||||
|
|
||||||
|
namespace Learn.Archives.Core.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("menu")]
|
||||||
|
public class Menu : EntityBaseId, IDB
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 名称
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 50)]
|
||||||
|
public required string Name { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 标题
|
||||||
|
/// </summary>
|
||||||
|
[SugarColumn(Length = 20)]
|
||||||
|
public required string Title { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 路径
|
||||||
|
/// </summary>
|
||||||
|
public string? Path { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 是按钮权限
|
||||||
|
/// </summary>
|
||||||
|
public bool IsButton { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 图标
|
||||||
|
/// </summary>
|
||||||
|
public string? Icon { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 需要的授权码
|
||||||
|
/// </summary>
|
||||||
|
public string? Auths { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 排名
|
||||||
|
/// </summary>
|
||||||
|
public int Rank { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 显示菜单?
|
||||||
|
/// </summary>
|
||||||
|
public bool ShowLink { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
using Learn.Archives.Core.Model.Interface;
|
||||||
|
using SqlSugar;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Net;
|
||||||
|
using System.Text.Json;
|
||||||
|
using UserCenter.Model;
|
||||||
|
using UserCenter.Model.Enum;
|
||||||
|
using UserCenter.Model.Interface;
|
||||||
|
|
||||||
|
namespace Learn.Archives.Core.Model
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("menurelation")]
|
||||||
|
public class MenuRelation : EntityBaseId, IDB
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 菜单id
|
||||||
|
/// </summary>
|
||||||
|
public required long MenuId { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
/// 管理员id
|
||||||
|
/// </summary>
|
||||||
|
public required long AdminId { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建时间
|
||||||
|
/// </summary>
|
||||||
|
public DateTime CreateTime { get; set; } = DateTime.Now;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -12,8 +12,8 @@ namespace Learn.Archives.Core.Model
|
||||||
/// 用户
|
/// 用户
|
||||||
/// <para>数据中心拓展用户</para>
|
/// <para>数据中心拓展用户</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[SugarTable("user")]
|
[SugarTable("userexpand")]
|
||||||
public class User : EntityBaseId, IDB
|
public class UserExpand : EntityBaseId, IDB
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用户中心的id
|
/// 用户中心的id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue