更新项目配置,新增设备同步模块,优化WebSocket和Swagger配置,增强SCADA系统的免登录接口,支持数据字典项和登录日志的免登录查询与记录。调整Java编译设置,确保更好的开发体验。

This commit is contained in:
geht
2026-04-28 10:23:58 +08:00
parent bbe46dcf2d
commit 142a0bdaba
1013 changed files with 41858 additions and 28 deletions

View File

@@ -0,0 +1,79 @@
using System.Windows.Controls;
using System.Windows;
namespace YY.Admin.Core
{
/// <summary>
/// DataGrid绑定数据源描述
/// </summary>
public class BindDescriptionAttribute : Attribute
{
/// <summary>
/// 列名
/// </summary>
public string HeaderName { get; set; }
/// <summary>
/// 显示为
/// </summary>
public ShowScheme ShowAs { get; set; }
/// <summary>
/// 显示顺序
/// </summary>
public int DisplayIndex { get; set; }
/// <summary>
/// DataGrid列绑定属性名称
/// </summary>
public string PropertyName { get; set; }
/// <summary>
/// 应用内的容模板Key
/// </summary>
public string ResourceKey { get; set; }
/// <summary>
/// 列宽
/// </summary>
public DataGridLength Width { get; set; }
/// <summary>
/// 列宽ByGrid
/// </summary>
public GridLength CloumnWidth { get; set; }
/// <summary>
/// DataGrid绑定数据源描述
/// </summary>
/// <param name="headerName">列名</param>
/// <param name="showAs">显示为</param>
/// <param name="width">宽度</param>
/// <param name="displayIndex">显示顺序</param>
/// <param name="resourceKey">自定义列Key</param>
public BindDescriptionAttribute(string headerName, ShowScheme showAs = ShowScheme., string width = "Auto", int displayIndex = 0, string resourceKey = "")
{
this.HeaderName= headerName;
DisplayIndex = displayIndex;
ResourceKey = resourceKey;
ShowAs = showAs;
var convert = new DataGridLengthConverter();
Width = (DataGridLength)convert.ConvertFrom(width);
var gridCOnvert = new GridLengthConverter();
CloumnWidth = (GridLength)gridCOnvert.ConvertFrom(width);
if (showAs == ShowScheme. && string.IsNullOrWhiteSpace(resourceKey))
throw new ArgumentException($"自定义列时需要指定{nameof(resourceKey)}参数!");
}
}
/// <summary>
/// 展示方式
/// </summary>
public enum ShowScheme
{
= 1,
= 4
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 常量特性
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public class ConstAttribute : Attribute
{
public string Name { get; set; }
public ConstAttribute(string name)
{
Name = name;
}
}
}

View File

@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
// 定义生命周期标记接口
public interface ISingletonDependency { }
public interface ITransientDependency { }
public interface IScopedDependency { }
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 忽略表结构初始化特性(标记在实体)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class IgnoreTableAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 忽略更新种子特性(标记在种子类)
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class IgnoreUpdateSeedAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,11 @@

namespace YY.Admin.Core
{
/// <summary>
/// 忽略更新种子列特性(标记在实体属性)
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
public class IgnoreUpdateSeedColumnAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 增量种子特性
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class IncreSeedAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 增量表特性
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class IncreTableAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
public enum Lifecycle
{
Singleton,
Transient,
Scoped
}
[AttributeUsage(AttributeTargets.Class)]
public class LifecycleAttribute : Attribute
{
public Lifecycle Lifecycle { get; }
public LifecycleAttribute(Lifecycle lifecycle)
{
Lifecycle = lifecycle;
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 日志表特性
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class LogTableAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 表示查询操作的前台操作码
/// </summary>
public class OperateCodeAttribute : Attribute
{
/// <summary>
/// 初始化一个<see cref="OperateCodeAttribute"/>类型的新实例
/// </summary>
public OperateCodeAttribute(string code)
{
Code = code;
}
/// <summary>
/// 获取 属性名称
/// </summary>
public string Code { get; private set; }
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 所属用户数据权限
/// </summary>
[AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = true)]
public class OwnerUserAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 查询规则特性
/// </summary>
[AttributeUsage(AttributeTargets.Property)]
public class QueryRuleAttribute : Attribute
{
/// <summary>
/// 查询字段名称
/// </summary>
public string FieldName { get; set; }
/// <summary>
/// 分组名称
/// </summary>
public string Group { get; set; }
/// <summary>
/// 查询操作符
/// </summary>
public FilterOperateEnum Operate { get; set; }
/// <summary>
/// 分组查询操作符生成sql后面的where 带括号的查询取值只能为or 或 and
/// </summary>
public FilterOperateEnum GroupOperate { get; set; }
/// <summary>
/// 查询规则构造函数
/// </summary>
/// <param name="operate">操作符</param>
/// <param name="fieldName">数据库可接受的查询字段名称,未传直接取属性名称</param>
/// <param name="group">隶属分组</param>
/// <param name="groupOperate">分组查询操作符</param>
public QueryRuleAttribute(FilterOperateEnum operate, string fieldName, string group = "", FilterOperateEnum groupOperate = FilterOperateEnum.And)
{
FieldName = fieldName;
Group = group;
Operate = operate;
GroupOperate = groupOperate;
}
}
}

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 种子数据特性
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class SeedDataAttribute : Attribute
{
/// <summary>
/// 排序(越大越后执行)
/// </summary>
public int Order { get; set; } = 0;
public SeedDataAttribute(int orderNo)
{
Order = orderNo;
}
}
}

View File

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 系统表特性
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class SysTableAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
/// <summary>
/// 枚举拓展主题样式
/// </summary>
[AttributeUsage(AttributeTargets.Enum | AttributeTargets.Field)]
public class ThemeAttribute : Attribute
{
public string Theme { get; private set; }
public ThemeAttribute(string theme)
{
this.Theme = theme;
}
}
}

View File

@@ -0,0 +1,141 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Controls.Primitives;
using System.Windows.Input;
using System.Windows.Media;
using PropertyMetadata = System.Windows.PropertyMetadata;
namespace YY.Admin.Core.Behavior
{
public class TreeViewItemClickBehavior
{
// ICommand attached property
public static readonly DependencyProperty CommandProperty =
DependencyProperty.RegisterAttached(
"Command",
typeof(ICommand),
typeof(TreeViewItemClickBehavior),
new PropertyMetadata(null, OnCommandChanged));
public static void SetCommand(DependencyObject obj, ICommand value) => obj.SetValue(CommandProperty, value);
public static ICommand GetCommand(DependencyObject obj) => (ICommand)obj.GetValue(CommandProperty);
// CommandParameter attached property
public static readonly DependencyProperty CommandParameterProperty =
DependencyProperty.RegisterAttached(
"CommandParameter",
typeof(object),
typeof(TreeViewItemClickBehavior),
new PropertyMetadata(null));
public static void SetCommandParameter(DependencyObject obj, object value) => obj.SetValue(CommandParameterProperty, value);
public static object GetCommandParameter(DependencyObject obj) => obj.GetValue(CommandParameterProperty);
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is TreeViewItem tvi)
{
if (e.NewValue != null && e.OldValue == null)
{
tvi.PreviewMouseLeftButtonUp += OnTreeViewItemMouseLeftButtonUp;
// 监听 TreeViewItem 展开事件Expanded
tvi.Expanded += OnTreeViewItemExpanded;
}
else if (e.NewValue == null && e.OldValue != null)
{
tvi.PreviewMouseLeftButtonUp -= OnTreeViewItemMouseLeftButtonUp;
tvi.Expanded -= OnTreeViewItemExpanded;
}
}
else
{
// 如果Style被应用到容器等也可能不是TreeViewItem延迟订阅由容器化过程处理
// 一般我们只使用在 TreeViewItem 上设置
}
}
private static void OnTreeViewItemMouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
// 忽略点击展开按钮
if (e.OriginalSource is DependencyObject dep)
{
if (FindAncestor<ToggleButton>(dep) != null) return;
// 找到真正的 TreeViewItem
var tvi = FindAncestor<TreeViewItem>(dep);
if (tvi == null) return;
var cmd = GetCommand(tvi);
var param = GetCommandParameter(tvi) ?? tvi.DataContext;
// 检查是否有子项
bool hasChildren = tvi.HasItems;
// 如果有子项,则切换展开状态
if (hasChildren)
{
bool IsExpanded = !tvi.IsExpanded;
tvi.IsExpanded = IsExpanded;
// 展开
//if (IsExpanded)
//{
// // 关闭同级其它节点
// CollapseSiblings(tvi);
//}
e.Handled = true;
return;
}
if (cmd != null && cmd.CanExecute(param))
{
cmd.Execute(param);
e.Handled = true;
}
}
}
private static void OnTreeViewItemExpanded(object sender, RoutedEventArgs e)
{
if (sender is TreeViewItem tvi)
{
// 防止事件冒泡重复执行
if (e.OriginalSource != tvi)
return;
CollapseSiblings(tvi);
}
}
/// <summary>
/// 折叠同级其它 TreeViewItem
/// </summary>
private static void CollapseSiblings(TreeViewItem currentItem)
{
ItemsControl parent = ItemsControl.ItemsControlFromItemContainer(currentItem);
if (parent == null) return;
foreach (var item in parent.Items)
{
var container = parent.ItemContainerGenerator.ContainerFromItem(item) as TreeViewItem;
if (container != null && container != currentItem)
{
container.IsExpanded = false;
}
}
}
// 查找祖先辅助方法
private static T FindAncestor<T>(DependencyObject current) where T : DependencyObject
{
while (current != null)
{
if (current is T t) return t;
current = VisualTreeHelper.GetParent(current);
}
return null;
}
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core.BusinessException
{
public class BusinessException : Exception
{
public ErrorCodeEnum ErrorCode { get; }
public BusinessException(ErrorCodeEnum errorCode, string message)
: base(message) => ErrorCode = errorCode;
}
public static class Oops
{
public static BusinessException Oh(ErrorCodeEnum errorCode)
{
// 获取错误信息
string message = $"业务错误 {errorCode}: {errorCode.GetDescription()}";
return new BusinessException(errorCode, message);
}
public static BusinessException Oh(string error)
{
// 获取错误信息
string message = $"业务错误 {error}";
return new BusinessException(ErrorCodeEnum.A1000, message);
}
}
}

View File

@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core
{
public interface ISysCacheService
{
/// <summary>
/// 申请分布式锁
/// </summary>
IDisposable? BeginCacheLock(string key, int msTimeout = 500, int msExpire = 10000, bool throwOnFailure = true);
/// <summary>
/// 获取缓存键名集合
/// </summary>
List<string> GetKeyList();
/// <summary>
/// 增加缓存
/// </summary>
bool Set(string key, object value);
/// <summary>
/// 增加缓存并设置过期时间
/// </summary>
bool Set(string key, object value, TimeSpan expire);
/// <summary>
/// 异步获取或添加缓存(无参数)
/// </summary>
Task<TR> AdGetAsync<TR>(string cacheName, Func<Task<TR>> del, TimeSpan? expiry = default) where TR : class;
/// <summary>
/// 异步获取或添加缓存1个参数
/// </summary>
Task<TR> AdGetAsync<TR, T1>(string cacheName, Func<T1, Task<TR>> del, T1 t1, TimeSpan? expiry = default) where TR : class;
/// <summary>
/// 异步获取或添加缓存2个参数
/// </summary>
Task<TR> AdGetAsync<TR, T1, T2>(string cacheName, Func<T1, T2, Task<TR>> del, T1 t1, T2 t2, TimeSpan? expiry = default) where TR : class;
/// <summary>
/// 异步获取或添加缓存3个参数
/// </summary>
Task<TR> AdGetAsync<TR, T1, T2, T3>(string cacheName, Func<T1, T2, T3, Task<TR>> del, T1 t1, T2 t2, T3 t3, TimeSpan? expiry = default) where TR : class;
/// <summary>
/// 获取缓存1个参数
/// </summary>
T Get<T>(string cacheName, object t1);
/// <summary>
/// 获取缓存2个参数
/// </summary>
T Get<T>(string cacheName, object t1, object t2);
/// <summary>
/// 获取缓存3个参数
/// </summary>
T Get<T>(string cacheName, object t1, object t2, object t3);
/// <summary>
/// 获取缓存的剩余生存时间
/// </summary>
TimeSpan GetExpire(string key);
/// <summary>
/// 获取缓存
/// </summary>
T Get<T>(string key);
/// <summary>
/// 删除缓存
/// </summary>
int Remove(string key);
/// <summary>
/// 清空所有缓存
/// </summary>
void Clear();
/// <summary>
/// 检查缓存是否存在
/// </summary>
bool ExistKey(string key);
/// <summary>
/// 根据键名前缀删除缓存
/// </summary>
int RemoveByPrefixKey(string prefixKey);
/// <summary>
/// 根据键名前缀获取键名集合
/// </summary>
List<string> GetKeysByPrefixKey(string prefixKey);
/// <summary>
/// 获取缓存值(原始对象)
/// </summary>
object GetValue(string key);
/// <summary>
/// 获取或添加缓存(在数据不存在时执行委托请求数据)
/// </summary>
T GetOrAdd<T>(string key, Func<string, T> callback, int expire = -1);
/// <summary>
/// 获取Hash缓存字典
/// </summary>
IDictionary<string, T> GetHashMap<T>(string key);
/// <summary>
/// 批量添加Hash值
/// </summary>
bool HashSet<T>(string key, Dictionary<string, T> dic);
/// <summary>
/// 添加一条Hash值
/// </summary>
void HashAdd<T>(string key, string hashKey, T value);
/// <summary>
/// 添加或更新一条Hash值
/// </summary>
void HashAddOrUpdate<T>(string key, string hashKey, T value);
/// <summary>
/// 获取多条Hash值
/// </summary>
List<T> HashGet<T>(string key, params string[] fields);
/// <summary>
/// 获取一条Hash值
/// </summary>
T HashGetOne<T>(string key, string field);
/// <summary>
/// 根据KEY获取所有Hash值
/// </summary>
IDictionary<string, T> HashGetAll<T>(string key);
/// <summary>
/// 删除Hash值
/// </summary>
int HashDel<T>(string key, params string[] fields);
}
}

View File

@@ -0,0 +1,437 @@

using NewLife.Caching;
using Newtonsoft.Json;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using YY.Admin.Core.Option;
namespace YY.Admin.Core
{
public class SysCacheService : ISysCacheService
{
private readonly ICacheProvider _cacheProvider;
private readonly BaseCacheOptions _cacheOptions;
public SysCacheService(ICacheProvider provider, BaseCacheOptions cacheOptions)
{
_cacheProvider = provider;
_cacheOptions = cacheOptions;
}
/// <summary>
/// 申请分布式锁 🔖
/// </summary>
/// <param name="key">要锁定的key</param>
/// <param name="msTimeout">申请锁等待的时间,单位毫秒</param>
/// <param name="msExpire">锁过期时间,超过该时间没有主动是放则自动是放,必须整数秒,单位毫秒</param>
/// <param name="throwOnFailure">失败时是否抛出异常,如不抛出异常可通过判断返回null得知申请锁失败</param>
/// <returns></returns>
[DisplayName("申请分布式锁")]
public IDisposable? BeginCacheLock(string key, int msTimeout = 500, int msExpire = 10000, bool throwOnFailure = true)
{
try
{
return _cacheProvider.Cache.AcquireLock(key, msTimeout, msExpire, throwOnFailure);
}
catch
{
return null;
}
}
/// <summary>
/// 获取缓存键名集合 🔖
/// </summary>
/// <returns></returns>
[DisplayName("获取缓存键名集合")]
public List<string> GetKeyList()
{
return _cacheProvider.Cache == Cache.Default
? [.. _cacheProvider.Cache.Keys.Where(u => u.StartsWith(_cacheOptions.Prefix)).Select(u => u[_cacheOptions.Prefix.Length..]).OrderBy(u => u)]
: [.. ((FullRedis)_cacheProvider.Cache).Search($"{_cacheOptions.Prefix}*", int.MaxValue).Select(u => u[_cacheOptions.Prefix.Length..]).OrderBy(u => u)];
}
/// <summary>
/// 增加缓存
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <returns></returns>
public bool Set(string key, object value)
{
return !string.IsNullOrWhiteSpace(key) && _cacheProvider.Cache.Set($"{_cacheOptions.Prefix}{key}", value);
}
/// <summary>
/// 增加缓存并设置过期时间
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="expire"></param>
/// <returns></returns>
public bool Set(string key, object value, TimeSpan expire)
{
return !string.IsNullOrWhiteSpace(key) && _cacheProvider.Cache.Set($"{_cacheOptions.Prefix}{key}", value, expire);
}
public async Task<TR> AdGetAsync<TR>(String cacheName, Func<Task<TR>> del, TimeSpan? expiry = default) where TR : class
{
return await AdGetAsync<TR>(cacheName, del, [], expiry);
}
public async Task<TR> AdGetAsync<TR, T1>(String cacheName, Func<T1, Task<TR>> del, T1 t1, TimeSpan? expiry = default) where TR : class
{
return await AdGetAsync<TR>(cacheName, del, [t1], expiry);
}
public async Task<TR> AdGetAsync<TR, T1, T2>(String cacheName, Func<T1, T2, Task<TR>> del, T1 t1, T2 t2, TimeSpan? expiry = default) where TR : class
{
return await AdGetAsync<TR>(cacheName, del, [t1, t2], expiry);
}
public async Task<TR> AdGetAsync<TR, T1, T2, T3>(String cacheName, Func<T1, T2, T3, Task<TR>> del, T1 t1, T2 t2, T3 t3, TimeSpan? expiry = default) where TR : class
{
return await AdGetAsync<TR>(cacheName, del, [t1, t2, t3], expiry);
}
private async Task<T> AdGetAsync<T>(string cacheName, Delegate del, Object[] obs, TimeSpan? expiry) where T : class
{
var key = Key(cacheName, obs);
// 使用分布式锁
using (_cacheProvider.Cache.AcquireLock($@"lock:AdGetAsync:{cacheName}", 1000))
{
var value = Get<T>(key);
value ??= await ((dynamic)del).DynamicInvokeAsync(obs);
Set(key, value);
return value;
}
}
public T Get<T>(String cacheName, object t1)
{
return Get<T>(cacheName, [t1]);
}
public T Get<T>(String cacheName, object t1, object t2)
{
return Get<T>(cacheName, [t1, t2]);
}
public T Get<T>(String cacheName, object t1, object t2, object t3)
{
return Get<T>(cacheName, [t1, t2, t3]);
}
private T Get<T>(String cacheName, Object[] obs)
{
var key = cacheName + ":" + obs.Aggregate(string.Empty, (current, o) => current + $"<{o}>");
return Get<T>(key);
}
private static string Key(string cacheName, object[] obs)
{
if (obs.OfType<TimeSpan>().Any()) throw new Exception("缓存参数类型不能能是:TimeSpan类型");
StringBuilder sb = new(cacheName + ":");
foreach (var a in obs) sb.Append($"<{KeySingle(a)}>");
return sb.ToString();
}
private static string KeySingle(object t)
{
return t.GetType().IsClass && !t.GetType().IsPrimitive ? JsonConvert.SerializeObject(t) : t.ToString();
}
/// <summary>
/// 获取缓存的剩余生存时间
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public TimeSpan GetExpire(string key)
{
return _cacheProvider.Cache.GetExpire(key);
}
/// <summary>
/// 获取缓存
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public T Get<T>(string key)
{
return _cacheProvider.Cache.Get<T>($"{_cacheOptions.Prefix}{key}");
}
/// <summary>
/// 删除缓存 🔖
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
[DisplayName("删除缓存")]
public int Remove(string key)
{
return _cacheProvider.Cache.Remove($"{_cacheOptions.Prefix}{key}");
}
/// <summary>
/// 清空所有缓存 🔖
/// </summary>
/// <returns></returns>
[DisplayName("清空所有缓存")]
public void Clear()
{
_cacheProvider.Cache.Clear();
Cache.Default.Clear();
}
/// <summary>
/// 检查缓存是否存在
/// </summary>
/// <param name="key">键</param>
/// <returns></returns>
public bool ExistKey(string key)
{
return _cacheProvider.Cache.ContainsKey($"{_cacheOptions.Prefix}{key}");
}
/// <summary>
/// 根据键名前缀删除缓存 🔖
/// </summary>
/// <param name="prefixKey">键名前缀</param>
/// <returns></returns>
[DisplayName("根据键名前缀删除缓存")]
public int RemoveByPrefixKey(string prefixKey)
{
var delKeys = _cacheProvider.Cache == Cache.Default
? _cacheProvider.Cache.Keys.Where(u => u.StartsWith($"{_cacheOptions.Prefix}{prefixKey}")).ToArray()
: ((FullRedis)_cacheProvider.Cache).Search($"{_cacheOptions.Prefix}{prefixKey}*", int.MaxValue).ToArray();
return _cacheProvider.Cache.Remove(delKeys);
}
/// <summary>
/// 根据键名前缀获取键名集合 🔖
/// </summary>
/// <param name="prefixKey">键名前缀</param>
/// <returns></returns>
[DisplayName("根据键名前缀获取键名集合")]
public List<string> GetKeysByPrefixKey(string prefixKey)
{
return _cacheProvider.Cache == Cache.Default
? _cacheProvider.Cache.Keys.Where(u => u.StartsWith($"{_cacheOptions.Prefix}{prefixKey}")).Select(u => u[_cacheOptions.Prefix.Length..]).ToList()
: ((FullRedis)_cacheProvider.Cache).Search($"{_cacheOptions.Prefix}{prefixKey}*", int.MaxValue).Select(u => u[_cacheOptions.Prefix.Length..]).ToList();
}
/// <summary>
/// 获取缓存值 🔖
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
[DisplayName("获取缓存值")]
public object GetValue(string key)
{
if (string.IsNullOrEmpty(key)) return null;
if (Regex.IsMatch(key, @"%[0-9a-fA-F]{2}"))
key = HttpUtility.UrlDecode(key);
var fullKey = $"{_cacheOptions.Prefix}{key}";
if (_cacheProvider.Cache == Cache.Default)
return _cacheProvider.Cache.Get<object>(fullKey);
if (_cacheProvider.Cache is FullRedis redisCache)
{
if (!redisCache.ContainsKey(fullKey))
return null;
try
{
var keyType = redisCache.TYPE(fullKey)?.ToLower();
switch (keyType)
{
case "string":
return redisCache.Get<string>(fullKey);
case "list":
var list = redisCache.GetList<string>(fullKey);
return list?.ToList();
case "hash":
var hash = redisCache.GetDictionary<string>(fullKey);
return hash?.ToDictionary(k => k.Key, v => v.Value);
case "set":
var set = redisCache.GetSet<string>(fullKey);
return set?.ToArray();
case "zset":
var sortedSet = redisCache.GetSortedSet<string>(fullKey);
return sortedSet?.Range(0, -1)?.ToList();
case "none":
return null;
default:
// 未知类型或特殊类型
return new Dictionary<string, object>
{
{ "key", key },
{ "type", keyType ?? "unknown" },
{ "message", "无法使用标准方式获取此类型数据" }
};
}
}
catch (Exception ex)
{
return new Dictionary<string, object>
{
{ "key", key },
{ "error", ex.Message },
{ "type", "exception" }
};
}
}
return _cacheProvider.Cache.Get<object>(fullKey);
}
/// <summary>
/// 获取或添加缓存(在数据不存在时执行委托请求数据)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="callback"></param>
/// <param name="expire">过期时间,单位秒</param>
/// <returns></returns>
public T GetOrAdd<T>(string key, Func<string, T> callback, int expire = -1)
{
if (string.IsNullOrWhiteSpace(key)) return default;
return _cacheProvider.Cache.GetOrAdd($"{_cacheOptions.Prefix}{key}", callback, expire);
}
/// <summary>
/// Hash匹配
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public IDictionary<String, T> GetHashMap<T>(string key)
{
return _cacheProvider.Cache.GetDictionary<T>(key);
}
/// <summary>
/// 批量添加HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="dic"></param>
/// <returns></returns>
public bool HashSet<T>(string key, Dictionary<string, T> dic)
{
var hash = GetHashMap<T>(key);
foreach (var v in dic)
{
hash.Add(v);
}
return true;
}
/// <summary>
/// 添加一条HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="hashKey"></param>
/// <param name="value"></param>
public void HashAdd<T>(string key, string hashKey, T value)
{
var hash = GetHashMap<T>(key);
hash.Add(hashKey, value);
}
/// <summary>
/// 添加或更新一条HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="hashKey"></param>
/// <param name="value"></param>
public void HashAddOrUpdate<T>(string key, string hashKey, T value)
{
var hash = GetHashMap<T>(key);
if (hash.ContainsKey(hashKey))
hash[hashKey] = value;
else
hash.Add(hashKey, value);
}
/// <summary>
/// 获取多条HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="fields"></param>
/// <returns></returns>
public List<T> HashGet<T>(string key, params string[] fields)
{
var hash = GetHashMap<T>(key);
return hash.Where(t => fields.Any(c => t.Key == c)).Select(t => t.Value).ToList();
}
/// <summary>
/// 获取一条HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="field"></param>
/// <returns></returns>
public T HashGetOne<T>(string key, string field)
{
var hash = GetHashMap<T>(key);
return hash.TryGetValue(field, out T value) ? value : default;
}
/// <summary>
/// 根据KEY获取所有HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <returns></returns>
public IDictionary<string, T> HashGetAll<T>(string key)
{
var hash = GetHashMap<T>(key);
return hash;
}
/// <summary>
/// 删除HASH
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key"></param>
/// <param name="fields"></param>
/// <returns></returns>
public int HashDel<T>(string key, params string[] fields)
{
var hash = GetHashMap<T>(key);
fields.ToList().ForEach(t => hash.Remove(t));
return fields.Length;
}
}
}

View File

@@ -0,0 +1,124 @@
namespace YY.Admin.Core.Const;
/// <summary>
/// 缓存相关常量
/// </summary>
public class CacheConst
{
/// <summary>
/// 用户权限缓存(按钮集合)
/// </summary>
public const string KeyUserButton = "sys_user_button:";
/// <summary>
/// 用户机构缓存
/// </summary>
public const string KeyUserOrg = "sys_user_org:";
/// <summary>
/// 角色最大数据范围缓存
/// </summary>
public const string KeyRoleMaxDataScope = "sys_role_maxDataScope:";
/// <summary>
/// 在线用户缓存
/// </summary>
public const string KeyUserOnline = "sys_user_online:";
/// <summary>
/// 图形验证码缓存
/// </summary>
public const string KeyVerCode = "sys_verCode:";
/// <summary>
/// 手机验证码缓存
/// </summary>
public const string KeyPhoneVerCode = "sys_phoneVerCode:";
/// <summary>
/// 密码错误次数缓存
/// </summary>
public const string KeyPasswordErrorTimes = "sys_password_error_times:";
/// <summary>
/// 租户缓存
/// </summary>
public const string KeyTenant = "sys_tenant";
/// <summary>
/// 常量下拉框
/// </summary>
public const string KeyConst = "sys_const:";
/// <summary>
/// 所有缓存关键字集合
/// </summary>
public const string KeyAll = "sys_keys";
/// <summary>
/// SqlSugar二级缓存
/// </summary>
public const string SqlSugar = "sys_sqlSugar:";
/// <summary>
/// 开放接口身份缓存
/// </summary>
public const string KeyOpenAccess = "sys_open_access:";
/// <summary>
/// 开放接口身份随机数缓存
/// </summary>
public const string KeyOpenAccessNonce = "sys_open_access_nonce:";
/// <summary>
/// 登录黑名单
/// </summary>
public const string KeyBlacklist = "sys_blacklist:";
/// <summary>
/// 系统配置缓存
/// </summary>
public const string KeyConfig = "sys_config:";
/// <summary>
/// 系统租户配置缓存
/// </summary>
public const string KeyTenantConfig = "sys_tenant_config:";
/// <summary>
/// 系统用户配置缓存
/// </summary>
public const string KeyUserConfig = "sys_user_config:";
/// <summary>
/// 系统字典缓存
/// </summary>
public const string KeyDict = "sys_dict:";
/// <summary>
/// 系统租户字典缓存
/// </summary>
public const string KeyTenantDict = "sys_tenant_dict:";
/// <summary>
/// 重复请求(幂等)字典缓存
/// </summary>
public const string KeyIdempotent = "sys_idempotent:";
/// <summary>
/// Excel临时文件缓存
/// </summary>
public const string KeyExcelTemp = "sys_excel_temp:";
/// <summary>
/// 系统更新命令日志缓存
/// </summary>
public const string KeySysUpdateLog = "sys_update_log";
/// <summary>
/// 系统更新间隔标记缓存
/// </summary>
public const string KeySysUpdateInterval = "sys_update_interval";
}

View File

@@ -0,0 +1,64 @@

namespace YY.Admin.Core.Const;
/// <summary>
/// Claim相关常量
/// </summary>
public class ClaimConst
{
/// <summary>
/// 用户Id
/// </summary>
public const string UserId = "UserId";
/// <summary>
/// 账号
/// </summary>
public const string Account = "Account";
/// <summary>
/// 真实姓名
/// </summary>
public const string RealName = "RealName";
/// <summary>
/// 昵称
/// </summary>
public const string NickName = "NickName";
/// <summary>
/// 账号类型
/// </summary>
public const string AccountType = "AccountType";
/// <summary>
/// 租户Id
/// </summary>
public const string TenantId = "TenantId";
/// <summary>
/// 组织机构Id
/// </summary>
public const string OrgId = "OrgId";
/// <summary>
/// 组织机构名称
/// </summary>
public const string OrgName = "OrgName";
/// <summary>
/// 组织机构类型
/// </summary>
public const string OrgType = "OrgType";
/// <summary>
/// 微信OpenId
/// </summary>
public const string OpenId = "OpenId";
/// <summary>
/// 登录模式PC、APP
/// </summary>
public const string LoginMode = "LoginMode";
}

View File

@@ -0,0 +1,53 @@
namespace YY.Admin.Core.Const;
/// <summary>
/// 通用常量
/// </summary>
[Const("平台配置")]
public class CommonConst
{
/// <summary>
/// 日志分组名称
/// </summary>
public const string SysLogCategoryName = "System.Logging.LoggingMonitor";
/// <summary>
/// 事件-增加异常日志
/// </summary>
public const string AddExLog = "Add:ExLog";
/// <summary>
/// 事件-发送异常邮件
/// </summary>
public const string SendErrorMail = "Send:ErrorMail";
/// <summary>
/// 默认基本角色名称
/// </summary>
public const string DefaultBaseRoleName = "默认基本角色";
/// <summary>
/// 默认基本角色编码
/// </summary>
public const string DefaultBaseRoleCode = "default_base_role";
/// <summary>
/// MainWinndow 主内容区域名称
/// </summary>
public const string ContentRegion = "ContentRegion";
/// <summary>
/// MainWinndow 菜单区域名称
/// </summary>
public const string MenuRegion = "MenuRegion";
/// <summary>
/// 系统名称
/// </summary>
public const string SystemName = "智能制造MES工控";
/// <summary>
/// 系统设置文件路径
/// </summary>
public const string AppSettingsFilePath = "AppSettings\\{0}\\appsettings.json";
}

View File

@@ -0,0 +1,144 @@
namespace YY.Admin.Core.Const;
/// <summary>
/// 配置常量
/// </summary>
public class ConfigConst
{
/// <summary>
/// 演示环境
/// </summary>
public const string SysDemoEnv = "sys_demo";
/// <summary>
/// 默认密码
/// </summary>
public const string SysPassword = "sys_password";
/// <summary>
/// 密码最大错误次数
/// </summary>
public const string SysPasswordMaxErrorTimes = "sys_password_max_error_times";
/// <summary>
/// 日志保留天数
/// </summary>
public const string SysLogRetentionDays = "sys_log_retention_days";
/// <summary>
/// 记录操作日志
/// </summary>
public const string SysOpLog = "sys_oplog";
/// <summary>
/// 单设备登录
/// </summary>
public const string SysSingleLogin = "sys_single_login";
/// <summary>
/// 登入登出提醒
/// </summary>
public const string SysLoginOutReminder = "sys_login_out_reminder";
/// <summary>
/// 登陆时隐藏租户
/// </summary>
public const string SysHideTenantLogin = "sys_hide_tenant_login";
/// <summary>
/// 登录二次验证
/// </summary>
public const string SysSecondVer = "sys_second_ver";
/// <summary>
/// 图形验证码
/// </summary>
public const string SysCaptcha = "sys_captcha";
/// <summary>
/// Token过期时间
/// </summary>
public const string SysTokenExpire = "sys_token_expire";
/// <summary>
/// RefreshToken过期时间
/// </summary>
public const string SysRefreshTokenExpire = "sys_refresh_token_expire";
/// <summary>
/// 发送异常日志邮件
/// </summary>
public const string SysErrorMail = "sys_error_mail";
/// <summary>
/// 域登录验证
/// </summary>
public const string SysDomainLogin = "sys_domain_login";
// /// <summary>
// /// 租户域名隔离登录验证
// /// </summary>
// public const string SysTenantHostLogin = "sys_tenant_host_login";
/// <summary>
/// 数据校验日志
/// </summary>
public const string SysValidationLog = "sys_validation_log";
/// <summary>
/// 行政区域同步层级 1-省级,2-市级,3-区县级,4-街道级,5-村级
/// </summary>
public const string SysRegionSyncLevel = "sys_region_sync_level";
/// <summary>
/// Default 分组
/// </summary>
public const string SysDefaultGroup = "Default";
/// <summary>
/// 支付宝授权页面地址
/// </summary>
public const string AlipayAuthPageUrl = "alipay_auth_page_url_";
// /// <summary>
// /// 系统图标
// /// </summary>
// public const string SysWebLogo = "sys_web_logo";
//
// /// <summary>
// /// 系统主标题
// /// </summary>
// public const string SysWebTitle = "sys_web_title";
//
// /// <summary>
// /// 系统副标题
// /// </summary>
// public const string SysWebViceTitle = "sys_web_viceTitle";
//
// /// <summary>
// /// 系统描述
// /// </summary>
// public const string SysWebViceDesc = "sys_web_viceDesc";
//
// /// <summary>
// /// 水印内容
// /// </summary>
// public const string SysWebWatermark = "sys_web_watermark";
//
// /// <summary>
// /// 版权说明
// /// </summary>
// public const string SysWebCopyright = "sys_web_copyright";
//
// /// <summary>
// /// ICP备案号
// /// </summary>
// public const string SysWebIcp = "sys_web_icp";
//
// /// <summary>
// /// ICP地址
// /// </summary>
// public const string SysWebIcpUrl = "sys_web_icpUrl";
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace YY.Admin.Core.Const
{
public class SqlSugarConst
{
/// <summary>
/// 默认主数据库标识(默认租户)
/// </summary>
public const string MainConfigId = "1300000000001";
/// <summary>
/// 默认日志数据库标识
/// </summary>
public const string LogConfigId = "1300000000002";
/// <summary>
/// 默认表主键
/// </summary>
public const string PrimaryKey = "Id";
/// <summary>
/// 默认租户Id
/// </summary>
public const long DefaultTenantId = 1300000000001;
}
}

View File

@@ -0,0 +1,300 @@
using System.Windows;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
using PropertyMetadata = System.Windows.PropertyMetadata;
namespace YY.Admin.Core.Controls
{
//图标官网
public enum FontAwesomeStyle
{
/// <summary>
/// 常规
/// </summary>
Regular,
/// <summary>
/// 实心的
/// </summary>
Solid,
/// <summary>
/// 品牌Logo
/// </summary>
Brands
}
public class FontAwesomeIcon : TextBlock
{
#region Icon
public static readonly DependencyProperty IconProperty =
DependencyProperty.Register(nameof(Icon), typeof(string), typeof(FontAwesomeIcon),
new PropertyMetadata(null, (d, e) => ((FontAwesomeIcon)d).Text = e.NewValue?.ToString()));
public string Icon
{
get => (string)GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
#endregion
#region Spin
public static readonly DependencyProperty SpinProperty =
DependencyProperty.Register(nameof(Spin), typeof(bool), typeof(FontAwesomeIcon),
new PropertyMetadata(false, (d, e) => ((FontAwesomeIcon)d).UpdateAnimation()));
public bool Spin
{
get => (bool)GetValue(SpinProperty);
set => SetValue(SpinProperty, value);
}
#endregion
#region SpinSpeed
public static readonly DependencyProperty SpinSpeedProperty =
DependencyProperty.Register(nameof(SpinSpeed), typeof(double), typeof(FontAwesomeIcon),
new PropertyMetadata(1.0, (d, e) =>
{
var fa = (FontAwesomeIcon)d;
if (fa.Spin)
fa.StartSpin();
}));
public double SpinSpeed
{
get => (double)GetValue(SpinSpeedProperty);
set => SetValue(SpinSpeedProperty, value);
}
#endregion
#region Beat
public static readonly DependencyProperty BeatProperty =
DependencyProperty.Register(nameof(Beat), typeof(bool), typeof(FontAwesomeIcon),
new PropertyMetadata(false, (d, e) => ((FontAwesomeIcon)d).UpdateAnimation()));
public bool Beat
{
get => (bool)GetValue(BeatProperty);
set => SetValue(BeatProperty, value);
}
#endregion
#region BeatScale
public static readonly DependencyProperty BeatScaleProperty =
DependencyProperty.Register(nameof(BeatScale), typeof(double), typeof(FontAwesomeIcon),
new PropertyMetadata(1.3));
public double BeatScale
{
get => (double)GetValue(BeatScaleProperty);
set => SetValue(BeatScaleProperty, value);
}
#endregion
#region BeatDuration
public static readonly DependencyProperty BeatDurationProperty =
DependencyProperty.Register(nameof(BeatDuration), typeof(double), typeof(FontAwesomeIcon),
new PropertyMetadata(0.5));
public double BeatDuration
{
get => (double)GetValue(BeatDurationProperty);
set => SetValue(BeatDurationProperty, value);
}
#endregion
#region IconFamily
public static readonly DependencyProperty IconFamilyProperty =
DependencyProperty.Register(nameof(IconFamily), typeof(FontAwesomeStyle), typeof(FontAwesomeIcon),
new PropertyMetadata(FontAwesomeStyle.Regular, OnIconFamilyChanged));
public FontAwesomeStyle IconFamily
{
get => (FontAwesomeStyle)GetValue(IconFamilyProperty);
set => SetValue(IconFamilyProperty, value);
}
private static void OnIconFamilyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var fa = (FontAwesomeIcon)d;
fa.UpdateFontFamily();
}
private void UpdateFontFamily()
{
FontFamily = IconFamily switch
{
FontAwesomeStyle.Regular => (FontFamily)Application.Current.Resources["FontAwesomeRegular"],
FontAwesomeStyle.Solid => (FontFamily)Application.Current.Resources["FontAwesomeSolid"],
FontAwesomeStyle.Brands => (FontFamily)Application.Current.Resources["FontAwesomeBrands"],
_ => (FontFamily)Application.Current.Resources["FontAwesomeRegular"]
};
}
#endregion
// Transform components
private RotateTransform? _rotateTransform;
private ScaleTransform? _scaleTransform;
private TransformGroup? _transformGroup;
private bool _initialized = false;
private DoubleAnimation? _currentSpinAnimation;
public FontAwesomeIcon()
{
// 设置文本对齐方式,确保内容居中
TextAlignment = TextAlignment.Center;
VerticalAlignment = VerticalAlignment.Center;
HorizontalAlignment = HorizontalAlignment.Center;
// 设置默认字体家庭
UpdateFontFamily();
// 创建 transforms
_rotateTransform = new RotateTransform();
_scaleTransform = new ScaleTransform(1, 1);
_transformGroup = new TransformGroup();
_transformGroup.Children.Add(_scaleTransform);
_transformGroup.Children.Add(_rotateTransform);
// 使用 RenderTransform 避免布局抖动
RenderTransform = _transformGroup;
// 关键:设置变换原点为内容中心
RenderTransformOrigin = new Point(0.5, 0.5);
// 延迟初始化到 Loaded
Loaded += OnLoadedSafe;
Unloaded += OnUnloadedSafe;
SizeChanged += OnSizeChangedSafe;
}
private void OnLoadedSafe(object? sender, RoutedEventArgs e)
{
Dispatcher.BeginInvoke((Action)(() =>
{
if (_initialized) return;
_initialized = true;
UpdateAnimation();
}), DispatcherPriority.Loaded);
}
private void OnSizeChangedSafe(object? sender, SizeChangedEventArgs e)
{
// 确保变换原点始终居中
RenderTransformOrigin = new Point(0.5, 0.5);
}
private void OnUnloadedSafe(object? sender, RoutedEventArgs e)
{
// 停止动画,避免内存泄漏
StopSpin();
StopBeat();
}
private void UpdateAnimation()
{
if (DesignerProperties.GetIsInDesignMode(this)) return;
if (!_initialized)
{
return;
}
if (Spin) StartSpin(); else StopSpin();
if (Beat) StartBeat(); else StopBeat();
}
private void StartSpin()
{
if (_rotateTransform == null) return;
// 重新确认 RenderTransform 已正确赋值
if (RenderTransform != _transformGroup)
{
RenderTransform = _transformGroup;
RenderTransformOrigin = new Point(0.5, 0.5);
}
// 先取消旧动画
StopSpin();
// 方法1使用 By 动画实现无缝旋转(推荐)
var anim = new DoubleAnimation
{
By = 360, // 每次增加360度
Duration = TimeSpan.FromSeconds(Math.Max(0.01, SpinSpeed)),
RepeatBehavior = RepeatBehavior.Forever
};
// 动画在 WPF 内部直接使用 Freezable 缓存,提高性能
anim.Freeze();
_currentSpinAnimation = anim;
_rotateTransform.BeginAnimation(RotateTransform.AngleProperty, anim);
// 方法2使用 IsCumulative 属性(备选方案)
/*
var anim = new DoubleAnimation(0, 360, new Duration(TimeSpan.FromSeconds(Math.Max(0.01, SpinSpeed))))
{
RepeatBehavior = RepeatBehavior.Forever,
IsCumulative = true // 累积值避免跳回0度
};
*/
}
private void StopSpin()
{
_rotateTransform?.BeginAnimation(RotateTransform.AngleProperty, null);
_currentSpinAnimation = null;
// 重置旋转角度
if (_rotateTransform != null)
_rotateTransform.Angle = 0;
}
private void StartBeat()
{
if (_scaleTransform == null)
{
return;
}
// 重新确认 RenderTransform 已正确赋值
if (RenderTransform != _transformGroup)
{
RenderTransform = _transformGroup;
RenderTransformOrigin = new Point(0.5, 0.5);
}
// 先停止已有缩放动画
_scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
_scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);
// 使用更平滑的缓动函数
var anim = new DoubleAnimation(1.0, BeatScale, new Duration(TimeSpan.FromSeconds(Math.Max(0.01, BeatDuration))))
{
AutoReverse = true,
RepeatBehavior = RepeatBehavior.Forever,
EasingFunction = new QuadraticEase() { EasingMode = EasingMode.EaseInOut }
};
_scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, anim);
_scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, anim);
}
private void StopBeat()
{
if (_scaleTransform != null)
{
_scaleTransform.BeginAnimation(ScaleTransform.ScaleXProperty, null);
_scaleTransform.BeginAnimation(ScaleTransform.ScaleYProperty, null);
_scaleTransform.ScaleX = 1.0;
_scaleTransform.ScaleY = 1.0;
}
}
}
}

View File

@@ -0,0 +1,255 @@
using System.Windows;
using System.Windows.Controls;
namespace YY.Admin.Core.Controls;
public class GridPanel : Panel
{
// ------------------------------------------------------------
// 间距属性(行列间距)
// ------------------------------------------------------------
public double Gap
{
get => (double)GetValue(GapProperty);
set => SetValue(GapProperty, value);
}
public static readonly DependencyProperty GapProperty =
DependencyProperty.Register(nameof(Gap), typeof(double), typeof(GridPanel),
new FrameworkPropertyMetadata(20.0, FrameworkPropertyMetadataOptions.AffectsMeasure));
// ------------------------------------------------------------
// 横向/纵向布局(类似 CSS flow
// ------------------------------------------------------------
public Orientation Orientation
{
get => (Orientation)GetValue(OrientationProperty);
set => SetValue(OrientationProperty, value);
}
public static readonly DependencyProperty OrientationProperty =
DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(GridPanel),
new FrameworkPropertyMetadata(Orientation.Horizontal, FrameworkPropertyMetadataOptions.AffectsMeasure));
// ------------------------------------------------------------
// 测量
// ------------------------------------------------------------
protected override Size MeasureOverride(Size availableSize)
{
return Orientation == Orientation.Horizontal
? MeasureHorizontal(availableSize)
: MeasureVertical(availableSize);
}
// ------------------------------------------------------------
// 布局
// ------------------------------------------------------------
protected override Size ArrangeOverride(Size finalSize)
{
return Orientation == Orientation.Horizontal
? ArrangeHorizontal(finalSize)
: ArrangeVertical(finalSize);
}
// ------------------------------------------------------------
// 横向布局(类似 CSS grid-template-columns
// ------------------------------------------------------------
private Size MeasureHorizontal(Size availableSize)
{
double panelWidth = double.IsInfinity(availableSize.Width)
? MinWidth * 4 + Gap * 3
: availableSize.Width;
// ---- 修复:不能用 MinWidth+Gap 来估算列数,应使用最小子项宽度 ----
double minChildWidth = MinWidth <= 0 ? 1 : MinWidth;
// ---- 修复:列数 = 能放下多少个最小宽度 ----
int columnCount = Math.Max(1, (int)Math.Floor((panelWidth + Gap) / (minChildWidth + Gap)));
int childCount = InternalChildren.Count;
// ---- 修复2如果列数超过子项数裁到子项数实现 auto-fit 行为) ----
if (childCount > 0 && columnCount > childCount)
{
columnCount = childCount;
}
double columnWidth = (panelWidth - Gap * (columnCount - 1)) / columnCount;
double totalHeight = 0;
double rowHeight = 0;
int col = 0;
for (int i = 0; i < childCount; i++)
{
UIElement child = InternalChildren[i];
child.Measure(new Size(columnWidth, double.PositiveInfinity));
rowHeight = Math.Max(rowHeight, child.DesiredSize.Height);
col++;
if (col >= columnCount || i == childCount - 1)
{
// ------------------------------------------------------------
// 最后一行不加Gap
// ------------------------------------------------------------
totalHeight += rowHeight;
if (i != childCount - 1) totalHeight += Gap;
col = 0;
rowHeight = 0;
}
}
return new Size(panelWidth, totalHeight);
}
private Size ArrangeHorizontal(Size finalSize)
{
double panelWidth = finalSize.Width;
// ---- 修复:与 Measure 保持一致 ----
double minChildWidth = MinWidth <= 0 ? 1 : MinWidth;
int columnCount = Math.Max(1, (int)Math.Floor((panelWidth + Gap) / (minChildWidth + Gap)));
int childCount = InternalChildren.Count;
// ---- 修复2裁到子项数以实现 auto-fit ----
if (childCount > 0 && columnCount > childCount)
{
columnCount = childCount;
}
double columnWidth = (panelWidth - Gap * (columnCount - 1)) / columnCount;
double x = 0;
double y = 0;
double rowHeight = 0;
int col = 0;
for (int i = 0; i < childCount; i++)
{
UIElement child = InternalChildren[i];
// 为了保证每列宽度一致,传入 columnWidth 并在 Arrange 时使用 columnWidth
child.Arrange(new Rect(x, y, columnWidth, child.DesiredSize.Height));
rowHeight = Math.Max(rowHeight, child.DesiredSize.Height);
col++;
if (col >= columnCount || i == childCount - 1)
{
x = 0;
// ------------------------------------------------------------
// 最后一行不加Gap
// ------------------------------------------------------------
if (i != childCount - 1) y += rowHeight + Gap;
else y += rowHeight;
col = 0;
rowHeight = 0;
}
else
{
x += columnWidth + Gap;
}
}
return finalSize;
}
// ------------------------------------------------------------
// 纵向布局(类似 CSS grid-template-rows
// ------------------------------------------------------------
private Size MeasureVertical(Size availableSize)
{
double panelHeight = double.IsInfinity(availableSize.Height)
? MinHeight * 4 + Gap * 3
: availableSize.Height;
// ---- 修复:使用最小子项高度,不能用 MinHeight+Gap ----
double minChildHeight = MinHeight <= 0 ? 1 : MinHeight;
// ---- 修复:行数 = 能放下多少个最小高度 ----
int rowCount = Math.Max(1, (int)Math.Floor((panelHeight + Gap) / (minChildHeight + Gap)));
int childCount = InternalChildren.Count;
// ---- 修复2如果行数超过子项数裁到子项数auto-fit ----
if (childCount > 0 && rowCount > childCount)
{
rowCount = childCount;
}
double rowHeight = (panelHeight - Gap * (rowCount - 1)) / rowCount;
double totalWidth = 0;
double columnWidth = 0;
int row = 0;
for (int i = 0; i < childCount; i++)
{
UIElement child = InternalChildren[i];
child.Measure(new Size(double.PositiveInfinity, rowHeight));
columnWidth = Math.Max(columnWidth, child.DesiredSize.Width);
row++;
if (row >= rowCount || i == childCount - 1)
{
// ------------------------------------------------------------
// 最后一列不加Gap
// ------------------------------------------------------------
totalWidth += columnWidth;
if (i != childCount - 1) totalWidth += Gap;
row = 0;
columnWidth = 0;
}
}
return new Size(totalWidth, panelHeight);
}
private Size ArrangeVertical(Size finalSize)
{
double panelHeight = finalSize.Height;
// ---- 修复:与 MeasureVertical 一致 ----
double minChildHeight = MinHeight <= 0 ? 1 : MinHeight;
int rowCount = Math.Max(1, (int)Math.Floor((panelHeight + Gap) / (minChildHeight + Gap)));
int childCount = InternalChildren.Count;
// ---- 修复2裁到子项数 ----
if (childCount > 0 && rowCount > childCount)
{
rowCount = childCount;
}
double rowHeight = (panelHeight - Gap * (rowCount - 1)) / rowCount;
double x = 0;
double y = 0;
double columnWidth = 0;
int row = 0;
for (int i = 0; i < childCount; i++)
{
UIElement child = InternalChildren[i];
child.Arrange(new Rect(x, y, child.DesiredSize.Width, rowHeight));
columnWidth = Math.Max(columnWidth, child.DesiredSize.Width);
row++;
if (row >= rowCount || i == childCount - 1)
{
// ------------------------------------------------------------
// 最后一列不加Gap
// ------------------------------------------------------------
x += columnWidth;
if (i != childCount - 1) x += Gap;
y = 0;
row = 0;
columnWidth = 0;
}
else
{
y += rowHeight + Gap;
}
}
return finalSize;
}
}

View File

@@ -0,0 +1,74 @@
using LiveChartsCore.SkiaSharpView.Painting;
using SkiaSharp;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using YY.Admin.Core.LiveCharts2;
namespace YY.Admin.Core.Converter
{
public class BrushToSolidColorPaintConverter : IValueConverter
{
public object? Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter is not CusSolidColorPaint sourcePaint)
return new SolidColorPaint(SKColors.Transparent);
var skColor = ResolveColor(sourcePaint.CusColor);
var targetPaint = new CusSolidColorPaint(skColor);
MapProperties(sourcePaint, targetPaint);
return targetPaint;
}
// 统一的颜色解析方法
private SKColor ResolveColor(string? colorKey)
{
if (SKColor.TryParse(colorKey, out var parsedColor))
return parsedColor;
var resource = Application.Current.FindResource(colorKey);
return resource switch
{
Color mediaColor => new SKColor(mediaColor.R, mediaColor.G, mediaColor.B, mediaColor.A),
SolidColorBrush brush => new SKColor(brush.Color.R, brush.Color.G, brush.Color.B, brush.Color.A),
_ => SKColors.Transparent,
};
}
protected void MapProperties(CusSolidColorPaint sourcePaint, CusSolidColorPaint targetPaint)
{
targetPaint.IsAntialias = sourcePaint.IsAntialias;
targetPaint.StrokeThickness = sourcePaint.StrokeThickness;
targetPaint.StrokeCap = sourcePaint.StrokeCap;
targetPaint.StrokeMiter = sourcePaint.StrokeMiter;
targetPaint.StrokeJoin = sourcePaint.StrokeJoin;
targetPaint.ImageFilter = sourcePaint.ImageFilter;
targetPaint.PathEffect = sourcePaint.PathEffect;
#pragma warning disable CS0618 // Type or member is obsolete
if (sourcePaint.FontWeight != SKFontStyleWeight.Normal || sourcePaint.FontWidth != SKFontStyleWidth.Normal || sourcePaint.FontSlant != SKFontStyleSlant.Upright)
targetPaint.SKFontStyle = new SKFontStyle(sourcePaint.FontWeight, sourcePaint.FontWidth, sourcePaint.FontSlant);
#pragma warning restore CS0618 // Type or member is obsolete
if (sourcePaint?.FontFamily is not null)
{
targetPaint.SKTypeface = SKTypeface.FromFamilyName(sourcePaint?.FontFamily);
}
else if (sourcePaint?.TypefaceMatchesChar is not null && sourcePaint.TypefaceMatchesChar.Length > 0)
{
targetPaint.SKTypeface = SKFontManager.Default.MatchCharacter(sourcePaint.TypefaceMatchesChar[0]);
}
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,25 @@
using System.Globalization;
using System.Reflection;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class EnumDescriptionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || value.ToString() == null) return string.Empty;
var field = value.GetType().GetField(value.ToString()!);
if (field == null) return value.ToString()!;
var attribute = field.GetCustomAttribute<DescriptionAttribute>();
return attribute?.Description ?? value.ToString()!;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,60 @@
using System.Globalization;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
/// <summary>
/// 将枚举值和 bool 互转,适用于 ToggleButton 或 RadioButton
/// </summary>
public class EnumToBoolConverter : IValueConverter
{
/// <summary>
/// 将枚举值转换为 bool
/// </summary>
/// <param name="value">绑定的枚举值</param>
/// <param name="targetType"></param>
/// <param name="parameter">ConverterParameter 指定要匹配的枚举值</param>
/// <param name="culture"></param>
/// <returns>匹配返回 true否则 false</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
string enumValue = value?.ToString() ?? string.Empty;
string targetValue = parameter?.ToString() ?? string.Empty;
return enumValue.Equals(targetValue, StringComparison.OrdinalIgnoreCase);
}
/// <summary>
/// 将 bool 转回枚举值
/// </summary>
/// <param name="value">ToggleButton.IsChecked</param>
/// <param name="targetType"></param>
/// <param name="parameter">ConverterParameter 指定对应的枚举值</param>
/// <param name="culture"></param>
/// <returns>如果 true 返回枚举,否则返回 Binding.DoNothing</returns>
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is bool isChecked && isChecked && parameter != null)
{
// 判断 targetType 是否是 Nullable 类型
if (Nullable.GetUnderlyingType(targetType) != null)
{
// 获取 Nullable 的基础类型
Type underlyingType = Nullable.GetUnderlyingType(targetType)!;
// 确保基础类型是枚举类型
if (underlyingType?.IsEnum == true)
{
return Enum.Parse(underlyingType, parameter.ToString()!);
}
}
// 如果不是枚举类型或 Nullable 类型,返回 Binding.DoNothing
else if (targetType.IsEnum)
{
return Enum.Parse(targetType, parameter.ToString()!);
}
}
return Binding.DoNothing;
}
}
}

View File

@@ -0,0 +1,26 @@
using System.Globalization;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class EnumToIntConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is Enum enumValue)
{
System.Convert.ToInt32(enumValue);
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is int intValue && parameter is Type enumType && enumType.IsEnum)
{
return Enum.ToObject(enumType, intValue);
}
return value;
}
}
}

View File

@@ -0,0 +1,29 @@
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class EnumToTagTypeConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is StatusEnum status)
{
return status switch
{
StatusEnum.Enable => Application.Current.FindResource("SuccessBrush"), // 启用 - 绿色
StatusEnum.Disable => Application.Current.FindResource("DangerBrush"), // 禁用 - 红色
_ => Application.Current.FindResource("InfoBrush")
};
}
return Application.Current.FindResource("InfoBrush");
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,33 @@
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
/// <summary>
/// 将枚举值转换为Visibility
/// </summary>
public class EnumToVisibilityConverter : IValueConverter
{
/// <summary>
/// 将枚举值转换为 Visibility
/// </summary>
/// <param name="value">绑定的枚举值</param>
/// <param name="targetType"></param>
/// <param name="parameter">ConverterParameter 指定要匹配的枚举值</param>
/// <param name="culture"></param>
/// <returns>匹配返回Visible</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value == null || parameter == null)
return Visibility.Collapsed;
return value.ToString()!.Equals(parameter.ToString(), StringComparison.OrdinalIgnoreCase)
? Visibility.Visible
: Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
=> throw new NotImplementedException();
}
}

View File

@@ -0,0 +1,23 @@
using System.Globalization;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class MaxWidthConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double totalWidth && totalWidth > 0 && parameter != null && double.TryParse(parameter.ToString(), out var offset) && totalWidth >= offset)
{
// 最大宽度
return totalWidth - offset;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,49 @@
using HandyControl.Data;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
/// <summary>
/// 根据 TitleWidth 计算 Margin.Left如果 TitlePlacement=Top 则不偏移
/// </summary>
public class NegativeLeftThicknessConverter : IMultiValueConverter
{
// 这里改成 MultiBinding方便同时拿 TitleWidth 和 TitlePlacement
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
double left = 0;
double bottomShift = -18;
if (parameter != null && double.TryParse(parameter.ToString(), out var p))
bottomShift = p;
// 如果 TitleWidth 还未设置,直接返回默认 Thickness
if (values.Length > 0 && values[0] != DependencyProperty.UnsetValue)
{
var widthValue = values[0];
if (widthValue is GridLength gridLength && gridLength.IsAbsolute)
left = gridLength.Value;
else if (widthValue is double d)
left = d;
}
// 如果 TitlePlacement 还未设置,也要避免异常
if (values.Length > 1 && values[1] != DependencyProperty.UnsetValue)
{
if (values[1] is TitlePlacementType placement)
{
// 如果标题在上方,则不偏移
if (placement == TitlePlacementType.Top)
left = 0;
}
}
return new Thickness(left, 0, 0, bottomShift);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
=> throw new NotSupportedException();
}
}

View File

@@ -0,0 +1,23 @@
using System.Globalization;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class PercentageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is double actualHeight && parameter is string paramString)
{
double percentage = double.Parse(paramString);
return actualHeight * percentage;
}
return value;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}

View File

@@ -0,0 +1,24 @@
using System.Globalization;
using System.Windows.Data;
namespace YY.Admin.Core.Converter
{
public class RadioButtonEnumMultiConverter : IMultiValueConverter
{
// values[0] = RadioButton 自身
// values[1] = SysUser.Status
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values.Length < 2) return false;
if (values[0] == null || values[1] == null) return false;
return values[0].Equals(values[1]);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
// VM中通过事件实现UI -> VM的同步这里不处理直接返回Binding.DoNothing
return new object[] { Binding.DoNothing, Binding.DoNothing };
}
}
}

View File

@@ -0,0 +1,13 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public sealed class NetworkStatusChangedPayload
{
public bool IsOnline { get; set; }
public DateTime ChangedAt { get; set; }
}
public class NetworkStatusChangedEvent : PubSubEvent<NetworkStatusChangedPayload>
{
}

View File

@@ -0,0 +1,13 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public sealed class RemoteCommandPayload
{
public string DeviceId { get; set; } = string.Empty;
public string CommandJson { get; set; } = string.Empty;
}
public class RemoteCommandReceivedEvent : PubSubEvent<RemoteCommandPayload>
{
}

View File

@@ -0,0 +1,7 @@
using Prism.Events;
namespace YY.Admin.Core.Events;
public class SyncCompletedEvent : PubSubEvent<string>
{
}

View File

@@ -0,0 +1,25 @@
using SqlSugar;
namespace YY.Admin.Core.Models;
/// <summary>
/// 设备本地状态快照。
/// </summary>
[SugarTable("device_status_snapshot")]
public class DeviceStatus
{
[SugarColumn(IsPrimaryKey = true, Length = 64)]
public string DeviceId { get; set; } = string.Empty;
[SugarColumn(IsNullable = false)]
public bool IsOnline { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? LastHeartbeatAt { get; set; }
[SugarColumn(ColumnDataType = "TEXT", IsNullable = true)]
public string? StatusJson { get; set; }
[SugarColumn(IsNullable = false)]
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}

View File

@@ -0,0 +1,43 @@
using SqlSugar;
namespace YY.Admin.Core.Models;
/// <summary>
/// 断联续传消息实体。
/// </summary>
[SugarTable("outbox_messages")]
public class OutboxMessage
{
[SugarColumn(IsPrimaryKey = true, Length = 64)]
public string Id { get; set; } = Guid.NewGuid().ToString("N");
[SugarColumn(Length = 128, IsNullable = false)]
public string AggregateType { get; set; } = string.Empty;
[SugarColumn(Length = 128, IsNullable = false)]
public string AggregateId { get; set; } = string.Empty;
[SugarColumn(Length = 128, IsNullable = false)]
public string EventType { get; set; } = string.Empty;
[SugarColumn(ColumnDataType = "TEXT", IsNullable = false)]
public string Payload { get; set; } = string.Empty;
[SugarColumn(IsNullable = false)]
public int Status { get; set; }
[SugarColumn(IsNullable = false)]
public int RetryCount { get; set; }
[SugarColumn(Length = 2000, IsNullable = true)]
public string? ErrorMessage { get; set; }
[SugarColumn(IsNullable = false)]
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
[SugarColumn(IsNullable = true)]
public DateTime? LastTriedAt { get; set; }
[SugarColumn(IsNullable = true)]
public DateTime? SentAt { get; set; }
}

View File

@@ -0,0 +1,9 @@
namespace YY.Admin.Core.Services;
/// <summary>
/// 通过 RESTSCADA拉取用户并写入本地 jeecg_sys_user供 Outbox 统一线路消费。
/// </summary>
public interface IJeecgUserMirrorPullHandler
{
Task<bool> ExecutePullAsync(CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,9 @@
namespace YY.Admin.Core.Services;
/// <summary>
/// 将「需拉取 Jeecg 用户镜像」写入 Outbox断网不丢、联网续传由 Services 侧协调器调用。
/// </summary>
public interface IJeecgUserMirrorPullOutbox
{
Task EnqueuePullAsync(string eventType, string? payloadJson, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,8 @@
namespace YY.Admin.Core.Services;
public interface INetworkMonitor
{
bool IsOnline { get; }
event Action<bool>? StatusChanged;
Task StartAsync(CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,13 @@
namespace YY.Admin.Core.Services;
public interface ISignalRService
{
Task ConnectAsync(string token, CancellationToken cancellationToken = default);
/// <summary>
/// 设备同步统一通道STOMP 订阅 /topic/sync/jeecg-users免密或带设备 Token与 Outbox+REST 同属一条规范线路。
/// </summary>
Task ConnectUnifiedDeviceChannelAsync(CancellationToken cancellationToken = default);
Task SendDeviceStatusAsync(object status, CancellationToken cancellationToken = default);
}

View File

@@ -0,0 +1,11 @@
namespace YY.Admin.Core.Sync;
/// <summary>
/// 用户镜像同步在 Outbox 中的聚合类型(与设备批量上报区分,走本地拉取 REST 而非 /sys/sync/batch
/// </summary>
public static class JeecgUserMirrorOutbox
{
public const string AggregateType = "JeecgUserMirror";
public const string EventSignal = "Signal";
public const string EventBoot = "Boot";
}

View File

@@ -0,0 +1,192 @@
namespace YY.Admin.Core;
/// <summary>
/// 框架实体基类Id
/// </summary>
public abstract class EntityBaseId
{
/// <summary>
/// 雪花Id
/// </summary>
[SugarColumn(ColumnName = "Id", ColumnDescription = "主键Id", IsPrimaryKey = true, IsIdentity = false)]
public virtual long Id { get; set; }
}
/// <summary>
/// 框架实体基类
/// </summary>
[SugarIndex("index_{table}_CT", nameof(CreateTime), OrderByType.Asc)]
public abstract class EntityBase : EntityBaseId
{
/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDescription = "创建时间", IsNullable = true, IsOnlyIgnoreUpdate = true)]
public virtual DateTime CreateTime { get; set; }
/// <summary>
/// 更新时间
/// </summary>
[SugarColumn(ColumnDescription = "更新时间")]
public virtual DateTime? UpdateTime { get; set; }
/// <summary>
/// 创建者Id
/// </summary>
[OwnerUser]
[SugarColumn(ColumnDescription = "创建者Id", IsOnlyIgnoreUpdate = true)]
public virtual long? CreateUserId { get; set; }
///// <summary>
///// 创建者
///// </summary>
//[Newtonsoft.Json.JsonIgnore]
//[System.Text.Json.Serialization.JsonIgnore]
//[Navigate(NavigateType.OneToOne, nameof(CreateUserId))]
//public virtual SysUser CreateUser { get; set; }
/// <summary>
/// 创建者姓名
/// </summary>
[SugarColumn(ColumnDescription = "创建者姓名", Length = 64, IsOnlyIgnoreUpdate = true)]
public virtual string? CreateUserName { get; set; }
/// <summary>
/// 修改者Id
/// </summary>
[SugarColumn(ColumnDescription = "修改者Id")]
public virtual long? UpdateUserId { get; set; }
///// <summary>
///// 修改者
///// </summary>
//[Newtonsoft.Json.JsonIgnore]
//[System.Text.Json.Serialization.JsonIgnore]
//[Navigate(NavigateType.OneToOne, nameof(UpdateUserId))]
//public virtual SysUser UpdateUser { get; set; }
/// <summary>
/// 修改者姓名
/// </summary>
[SugarColumn(ColumnDescription = "修改者姓名", Length = 64)]
public virtual string? UpdateUserName { get; set; }
}
/// <summary>
/// 框架实体基类(删除标志)
/// </summary>
[SugarIndex("index_{table}_D", nameof(IsDelete), OrderByType.Asc)]
public abstract class EntityBaseDel : EntityBase, IDeletedFilter
{
/// <summary>
/// 软删除
/// </summary>
[SugarColumn(ColumnDescription = "软删除")]
public virtual bool IsDelete { get; set; } = false;
}
/// <summary>
/// 机构实体基类(数据权限)
/// </summary>
public abstract class EntityBaseOrg : EntityBase, IOrgIdFilter
{
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id", IsNullable = true)]
public virtual long OrgId { get; set; }
///// <summary>
///// 创建者部门Id
///// </summary>
//[SugarColumn(ColumnDescription = "创建者部门Id", IsOnlyIgnoreUpdate = true)]
//public virtual long? CreateOrgId { get; set; }
///// <summary>
///// 创建者部门
///// </summary>
//[Newtonsoft.Json.JsonIgnore]
//[System.Text.Json.Serialization.JsonIgnore]
//[Navigate(NavigateType.OneToOne, nameof(CreateOrgId))]
//public virtual SysOrg CreateOrg { get; set; }
///// <summary>
///// 创建者部门名称
///// </summary>
//[SugarColumn(ColumnDescription = "创建者部门名称", Length = 64, IsOnlyIgnoreUpdate = true)]
//public virtual string? CreateOrgName { get; set; }
}
/// <summary>
/// 机构实体基类(数据权限、删除标志)
/// </summary>
public abstract class EntityBaseOrgDel : EntityBaseDel, IOrgIdFilter
{
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id", IsNullable = true)]
public virtual long OrgId { get; set; }
}
/// <summary>
/// 租户实体基类
/// </summary>
public abstract class EntityBaseTenant : EntityBase, ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public virtual long? TenantId { get; set; }
}
/// <summary>
/// 租户实体基类(删除标志)
/// </summary>
public abstract class EntityBaseTenantDel : EntityBaseDel, ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public virtual long? TenantId { get; set; }
}
/// <summary>
/// 租户实体基类Id
/// </summary>
public abstract class EntityBaseTenantId : EntityBaseId, ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public virtual long? TenantId { get; set; }
}
/// <summary>
/// 租户机构实体基类(数据权限)
/// </summary>
public abstract class EntityBaseTenantOrg : EntityBaseOrg, ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public virtual long? TenantId { get; set; }
}
/// <summary>
/// 租户机构实体基类(数据权限、删除标志)
/// </summary>
public abstract class EntityBaseTenantOrgDel : EntityBaseOrgDel, ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public virtual long? TenantId { get; set; }
}

View File

@@ -0,0 +1,36 @@
namespace YY.Admin.Core;
/// <summary>
/// 假删除接口过滤器
/// </summary>
public interface IDeletedFilter
{
/// <summary>
/// 软删除
/// </summary>
bool IsDelete { get; set; }
}
/// <summary>
/// 租户Id接口过滤器
/// </summary>
public interface ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
long? TenantId { get; set; }
}
/// <summary>
/// 机构Id接口过滤器
/// </summary>
public interface IOrgIdFilter
{
/// <summary>
/// 机构Id
/// </summary>
long OrgId { get; set; }
}

View File

@@ -0,0 +1,59 @@
using SqlSugar;
namespace YY.Admin.Core;
/// <summary>
/// Jeecg 数据字典项同构表(桌面端)
/// </summary>
[SugarTable("jeecg_sys_dict_item", "Jeecg数据字典项同构表")]
[SysTable]
public class JeecgSysDictItem
{
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, Length = 64)]
public string Id { get; set; } = string.Empty;
[SugarColumn(ColumnName = "dict_id", Length = 64, IsNullable = true)]
public string? DictId { get; set; }
[SugarColumn(ColumnName = "dict_name", Length = 255, IsNullable = true)]
public string? DictName { get; set; }
[SugarColumn(ColumnName = "dict_code", Length = 255, IsNullable = true)]
public string? DictCode { get; set; }
[SugarColumn(ColumnName = "dict_type", IsNullable = true)]
public int? DictType { get; set; }
[SugarColumn(ColumnName = "dict_description", Length = 500, IsNullable = true)]
public string? DictDescription { get; set; }
[SugarColumn(ColumnName = "item_text", Length = 255, IsNullable = true)]
public string? ItemText { get; set; }
[SugarColumn(ColumnName = "item_value", Length = 255, IsNullable = true)]
public string? ItemValue { get; set; }
[SugarColumn(ColumnName = "item_description", Length = 500, IsNullable = true)]
public string? ItemDescription { get; set; }
[SugarColumn(ColumnName = "sort_order", IsNullable = true)]
public int? SortOrder { get; set; }
[SugarColumn(ColumnName = "status", IsNullable = true)]
public int? Status { get; set; }
[SugarColumn(ColumnName = "item_color", Length = 100, IsNullable = true)]
public string? ItemColor { get; set; }
[SugarColumn(ColumnName = "create_by", Length = 100, IsNullable = true)]
public string? CreateBy { get; set; }
[SugarColumn(ColumnName = "create_time", IsNullable = true)]
public DateTime? CreateTime { get; set; }
[SugarColumn(ColumnName = "update_by", Length = 100, IsNullable = true)]
public string? UpdateBy { get; set; }
[SugarColumn(ColumnName = "update_time", IsNullable = true)]
public DateTime? UpdateTime { get; set; }
}

View File

@@ -0,0 +1,181 @@
using SqlSugar;
namespace YY.Admin.Core;
/// <summary>
/// Jeecg 用户同构表(桌面端)
/// 说明:
/// 1. 按 JeecgBoot 的 sys_user 字段模型定义。
/// 2. 为避免影响现有 YY.Admin 的 sys_user 业务表,这里单独落表 jeecg_sys_user。
/// </summary>
[SugarTable("jeecg_sys_user", "Jeecg用户同构表")]
[SysTable]
public class JeecgSysUser
{
/// <summary>idJeecg为字符串雪花ID</summary>
[SugarColumn(ColumnName = "id", IsPrimaryKey = true, Length = 64)]
public string Id { get; set; } = string.Empty;
/// <summary>登录账号</summary>
[SugarColumn(ColumnName = "username", Length = 64, IsNullable = true)]
public string? Username { get; set; }
/// <summary>真实姓名</summary>
[SugarColumn(ColumnName = "realname", Length = 64, IsNullable = true)]
public string? Realname { get; set; }
/// <summary>密码</summary>
[SugarColumn(ColumnName = "password", Length = 512, IsNullable = true)]
public string? Password { get; set; }
/// <summary>密码盐</summary>
[SugarColumn(ColumnName = "salt", Length = 64, IsNullable = true)]
public string? Salt { get; set; }
/// <summary>头像</summary>
[SugarColumn(ColumnName = "avatar", Length = 512, IsNullable = true)]
public string? Avatar { get; set; }
/// <summary>生日</summary>
[SugarColumn(ColumnName = "birthday", IsNullable = true)]
public DateTime? Birthday { get; set; }
/// <summary>性别1男2女</summary>
[SugarColumn(ColumnName = "sex", IsNullable = true)]
public int? Sex { get; set; }
/// <summary>邮箱</summary>
[SugarColumn(ColumnName = "email", Length = 128, IsNullable = true)]
public string? Email { get; set; }
/// <summary>手机号</summary>
[SugarColumn(ColumnName = "phone", Length = 32, IsNullable = true)]
public string? Phone { get; set; }
/// <summary>登录选择部门编码</summary>
[SugarColumn(ColumnName = "org_code", Length = 128, IsNullable = true)]
public string? OrgCode { get; set; }
/// <summary>登录选择租户ID</summary>
[SugarColumn(ColumnName = "login_tenant_id", IsNullable = true)]
public int? LoginTenantId { get; set; }
/// <summary>状态(1正常 2冻结)</summary>
[SugarColumn(ColumnName = "status", IsNullable = true)]
public int? Status { get; set; }
/// <summary>删除标志0正常 1已删</summary>
[SugarColumn(ColumnName = "del_flag", IsNullable = true)]
public int? DelFlag { get; set; }
/// <summary>工号</summary>
[SugarColumn(ColumnName = "work_no", Length = 64, IsNullable = true)]
public string? WorkNo { get; set; }
/// <summary>座机号</summary>
[SugarColumn(ColumnName = "telephone", Length = 32, IsNullable = true)]
public string? Telephone { get; set; }
/// <summary>创建人</summary>
[SugarColumn(ColumnName = "create_by", Length = 64, IsNullable = true)]
public string? CreateBy { get; set; }
/// <summary>创建时间</summary>
[SugarColumn(ColumnName = "create_time", IsNullable = true)]
public DateTime? CreateTime { get; set; }
/// <summary>更新人</summary>
[SugarColumn(ColumnName = "update_by", Length = 64, IsNullable = true)]
public string? UpdateBy { get; set; }
/// <summary>更新时间</summary>
[SugarColumn(ColumnName = "update_time", IsNullable = true)]
public DateTime? UpdateTime { get; set; }
/// <summary>流程同步标志</summary>
[SugarColumn(ColumnName = "activiti_sync", IsNullable = true)]
public int? ActivitiSync { get; set; }
/// <summary>身份0普通成员 1上级</summary>
[SugarColumn(ColumnName = "user_identity", IsNullable = true)]
public int? UserIdentity { get; set; }
/// <summary>负责部门IDs</summary>
[SugarColumn(ColumnName = "depart_ids", Length = 1024, IsNullable = true)]
public string? DepartIds { get; set; }
/// <summary>设备ID</summary>
[SugarColumn(ColumnName = "client_id", Length = 256, IsNullable = true)]
public string? ClientId { get; set; }
/// <summary>流程状态</summary>
[SugarColumn(ColumnName = "bpm_status", Length = 64, IsNullable = true)]
public string? BpmStatus { get; set; }
/// <summary>个性签名</summary>
[SugarColumn(ColumnName = "sign", Length = 512, IsNullable = true)]
public string? Sign { get; set; }
/// <summary>是否开启个性签名</summary>
[SugarColumn(ColumnName = "sign_enable", IsNullable = true)]
public int? SignEnable { get; set; }
/// <summary>主岗位</summary>
[SugarColumn(ColumnName = "main_dep_post_id", Length = 128, IsNullable = true)]
public string? MainDepPostId { get; set; }
/// <summary>职务(字典)</summary>
[SugarColumn(ColumnName = "position_type", Length = 64, IsNullable = true)]
public string? PositionType { get; set; }
/// <summary>最后修改密码时间</summary>
[SugarColumn(ColumnName = "last_pwd_update_time", IsNullable = true)]
public DateTime? LastPwdUpdateTime { get; set; }
/// <summary>排序</summary>
[SugarColumn(ColumnName = "sort", IsNullable = true)]
public int? Sort { get; set; }
/// <summary>是否隐藏联系方式 0否1是</summary>
[SugarColumn(ColumnName = "iz_hide_contact", Length = 8, IsNullable = true)]
public string? IzHideContact { get; set; }
// ------------------------- 非持久化字段(与 Jeecg 实体保持一致) -------------------------
/// <summary>部门名称(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public string? OrgCodeTxt { get; set; }
/// <summary>职务(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public string? Post { get; set; }
/// <summary>多租户ids临时字段非持久化</summary>
[SugarColumn(IsIgnore = true)]
public string? RelTenantIds { get; set; }
/// <summary>首页路径(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public string? HomePath { get; set; }
/// <summary>职位名称(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public string? PostText { get; set; }
/// <summary>是否绑定第三方(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public bool IzBindThird { get; set; }
/// <summary>兼职岗位(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public string? OtherDepPostId { get; set; }
/// <summary>登录时选择部门编码(非持久化)</summary>
[SugarColumn(IsIgnore = true)]
public string? LoginOrgCode { get; set; }
/// <summary>所属部门IDs非持久化</summary>
[SugarColumn(IsIgnore = true)]
public string? BelongDepIds { get; set; }
}

View File

@@ -0,0 +1,64 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统配置参数表
/// </summary>
[SugarTable("sys_config", "系统配置参数表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc, IsUnique = true)]
public partial class SysConfig : EntityBase
{
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[SugarColumn(ColumnDescription = "编码", Length = 64)]
[MaxLength(64)]
public string? Code { get; set; }
/// <summary>
/// 参数值
/// </summary>
[SugarColumn(ColumnDescription = "参数值", Length = 512)]
[MaxLength(512)]
[IgnoreUpdateSeedColumn]
public string? Value { get; set; }
/// <summary>
/// 是否是内置参数Y-是N-否)
/// </summary>
[SugarColumn(ColumnDescription = "是否是内置参数", DefaultValue = "1")]
public YesNoEnum SysFlag { get; set; } = YesNoEnum.Y;
/// <summary>
/// 分组编码
/// </summary>
[SugarColumn(ColumnDescription = "分组编码", Length = 64)]
[MaxLength(64)]
public string? GroupCode { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序", DefaultValue = "100")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 256)]
[MaxLength(256)]
public string? Remark { get; set; }
}

View File

@@ -0,0 +1,101 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统字典值表
/// </summary>
[SugarTable("sys_dict_data", "系统字典值表")]
[SysTable]
[SugarIndex("index_{table}_TV", nameof(DictTypeId), OrderByType.Asc, nameof(Value), OrderByType.Asc, IsUnique = true)]
public partial class SysDictData : EntityBase
{
/// <summary>
/// 字典类型Id
/// </summary>
[SugarColumn(ColumnDescription = "字典类型Id")]
public long DictTypeId { get; set; }
/// <summary>
/// 字典类型
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(DictTypeId))]
public SysDictType DictType { get; set; }
/// <summary>
/// 显示文本
/// </summary>
[SugarColumn(ColumnDescription = "显示文本", Length = 256)]
[Required, MaxLength(256)]
public virtual string Label { get; set; }
/// <summary>
/// 值
/// </summary>
[SugarColumn(ColumnDescription = "值", Length = 256)]
[Required, MaxLength(256)]
public virtual string Value { get; set; }
/// <summary>
/// 编码
/// </summary>
/// <remarks>
/// </remarks>
[SugarColumn(ColumnDescription = "编码", Length = 256)]
public virtual string? Code { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 256)]
[MaxLength(256)]
public virtual string? Name { get; set; }
/// <summary>
/// 显示样式-标签颜色
/// </summary>
[SugarColumn(ColumnDescription = "显示样式-标签颜色", Length = 16)]
[MaxLength(16)]
public string? TagType { get; set; }
/// <summary>
/// 显示样式-Style(控制显示样式)
/// </summary>
[SugarColumn(ColumnDescription = "显示样式-Style", Length = 512)]
[MaxLength(512)]
public string? StyleSetting { get; set; }
/// <summary>
/// 显示样式-Class(控制显示样式)
/// </summary>
[SugarColumn(ColumnDescription = "显示样式-Class", Length = 512)]
[MaxLength(512)]
public string? ClassSetting { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序", DefaultValue = "100")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 2048)]
[MaxLength(2048)]
public string? Remark { get; set; }
/// <summary>
/// 拓展数据(保存业务功能的配置项)
/// </summary>
[SugarColumn(ColumnDescription = "拓展数据(保存业务功能的配置项)", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? ExtData { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态", DefaultValue = "1")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
}

View File

@@ -0,0 +1,18 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统租户字典值表
/// </summary>
[SugarTable("sys_dict_data_tenant", "系统租户字典值表")]
[SysTable]
[SugarIndex("index_{table}_TV", nameof(DictTypeId), OrderByType.Asc, nameof(Value), OrderByType.Asc)]
public partial class SysDictDataTenant : SysDictData, ITenantIdFilter
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id", IsOnlyIgnoreUpdate = true)]
public virtual long? TenantId { get; set; }
}

View File

@@ -0,0 +1,64 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统字典类型表
/// </summary>
[SugarTable("sys_dict_type", "系统字典类型表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc)]
public partial class SysDictType : EntityBase
{
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[SugarColumn(ColumnDescription = "编码", Length = 64)]
[Required, MaxLength(64)]
public virtual string Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序", DefaultValue = "100")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 256)]
[MaxLength(256)]
public string? Remark { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态", DefaultValue = "1")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 是否是内置字典Y-是N-否)
/// </summary>
[SugarColumn(ColumnDescription = "是否是内置字典", DefaultValue = "1")]
public virtual YesNoEnum SysFlag { get; set; } = YesNoEnum.Y;
/// <summary>
/// 是否是租户字典Y-是N-否)
/// </summary>
[SugarColumn(ColumnDescription = "是否是租户字典", DefaultValue = "2")]
public virtual YesNoEnum IsTenant { get; set; } = YesNoEnum.N;
/// <summary>
/// 字典值集合
/// </summary>
[Navigate(NavigateType.OneToMany, nameof(SysDictData.DictTypeId))]
public List<SysDictData> Children { get; set; }
}

View File

@@ -0,0 +1,100 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统文件表
/// </summary>
[SugarTable("sys_file", "系统文件表")]
[SysTable]
[SugarIndex("index_{table}_F", nameof(FileName), OrderByType.Asc)]
public partial class SysFile : EntityBaseTenantOrg
{
/// <summary>
/// 提供者
/// </summary>
[SugarColumn(ColumnDescription = "提供者", Length = 128)]
[MaxLength(128)]
public string? Provider { get; set; }
/// <summary>
/// 仓储名称
/// </summary>
[SugarColumn(ColumnDescription = "仓储名称", Length = 128)]
[MaxLength(128)]
public string? BucketName { get; set; }
/// <summary>
/// 文件名称(源文件名)
/// </summary>
[SugarColumn(ColumnDescription = "文件名称", Length = 128)]
[MaxLength(128)]
public string? FileName { get; set; }
/// <summary>
/// 文件后缀
/// </summary>
[SugarColumn(ColumnDescription = "文件后缀", Length = 16)]
[MaxLength(16)]
public string? Suffix { get; set; }
/// <summary>
/// 存储路径
/// </summary>
[SugarColumn(ColumnDescription = "存储路径", Length = 512)]
[MaxLength(512)]
public string? FilePath { get; set; }
/// <summary>
/// 文件大小KB
/// </summary>
[SugarColumn(ColumnDescription = "文件大小KB")]
public long SizeKb { get; set; }
/// <summary>
/// 文件大小信息-计算后的
/// </summary>
[SugarColumn(ColumnDescription = "文件大小信息", Length = 64)]
[MaxLength(64)]
public string? SizeInfo { get; set; }
/// <summary>
/// 外链地址-OSS上传后生成外链地址方便前端预览
/// </summary>
[SugarColumn(ColumnDescription = "外链地址", Length = 512)]
[MaxLength(512)]
public string? Url { get; set; }
/// <summary>
/// 文件MD5
/// </summary>
[SugarColumn(ColumnDescription = "文件MD5", Length = 128)]
[MaxLength(128)]
public string? FileMd5 { get; set; }
/// <summary>
/// 文件类别
/// </summary>
[SugarColumn(ColumnDescription = "文件类别", Length = 128)]
[MaxLength(128)]
public virtual string? FileType { get; set; }
/// <summary>
/// 文件别名
/// </summary>
[SugarColumn(ColumnDescription = "文件别名", Length = 128)]
[MaxLength(128)]
public string? FileAlias { get; set; }
/// <summary>
/// 是否公开
/// </summary>
[SugarColumn(ColumnDescription = "是否公开")]
public virtual bool IsPublic { get; set; } = false;
/// <summary>
/// 业务数据Id
/// </summary>
[SugarColumn(ColumnDescription = "业务数据Id")]
public long? DataId { get; set; }
}

View File

@@ -0,0 +1,85 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统域登录信息配置表
/// </summary>
[SugarTable("sys_ldap", "系统域登录信息配置表")]
[SysTable]
public class SysLdap : EntityBaseTenantDel
{
/// <summary>
/// 主机
/// </summary>
[SugarColumn(ColumnDescription = "主机", Length = 128)]
[Required]
public virtual string Host { get; set; }
/// <summary>
/// 端口
/// </summary>
[SugarColumn(ColumnDescription = "端口")]
public virtual int Port { get; set; }
/// <summary>
/// 用户搜索基准
/// </summary>
[SugarColumn(ColumnDescription = "用户搜索基准", Length = 128)]
[Required]
public virtual string BaseDn { get; set; }
/// <summary>
/// 绑定DN(有管理权限制的用户)
/// </summary>
[SugarColumn(ColumnDescription = "绑定DN", Length = 128)]
[Required]
public virtual string BindDn { get; set; }
/// <summary>
/// 绑定密码(有管理权限制的用户密码)
/// </summary>
[SugarColumn(ColumnDescription = "绑定密码", Length = 512)]
[Required]
public virtual string BindPass { get; set; }
/// <summary>
/// 用户过滤规则
/// </summary>
[SugarColumn(ColumnDescription = "用户过滤规则", Length = 128)]
[Required]
public virtual string AuthFilter { get; set; } = "sAMAccountName=%s";
/// <summary>
/// Ldap版本
/// </summary>
[SugarColumn(ColumnDescription = "Ldap版本")]
public int Version { get; set; }
/// <summary>
/// 绑定域账号字段属性值
/// </summary>
[SugarColumn(ColumnDescription = "绑定域账号字段属性值", Length = 32)]
[Required]
public virtual string BindAttrAccount { get; set; } = "sAMAccountName";
/// <summary>
/// 绑定用户EmployeeId属性值
/// </summary>
[SugarColumn(ColumnDescription = "绑定用户EmployeeId属性值", Length = 32)]
[Required]
public virtual string BindAttrEmployeeId { get; set; } = "EmployeeId";
/// <summary>
/// 绑定Code属性值
/// </summary>
[SugarColumn(ColumnDescription = "绑定对象Code属性值", Length = 64)]
[Required]
public virtual string BindAttrCode { get; set; } = "objectGUID";
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
}

View File

@@ -0,0 +1,48 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统差异日志表
/// </summary>
[SugarTable("sys_log_diff", "系统差异日志表")]
[SysTable]
[LogTable]
public partial class SysLogDiff : EntityBaseTenant
{
/// <summary>
/// 差异数据
/// </summary>
[SugarColumn(ColumnDescription = "差异数据", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? DiffData { get; set; }
/// <summary>
/// Sql
/// </summary>
[SugarColumn(ColumnDescription = "Sql", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? Sql { get; set; }
/// <summary>
/// 参数 手动传入的参数
/// </summary>
[SugarColumn(ColumnDescription = "参数", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? Parameters { get; set; }
/// <summary>
/// 业务对象
/// </summary>
[SugarColumn(ColumnDescription = "业务对象", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? BusinessData { get; set; }
/// <summary>
/// 差异操作
/// </summary>
[SugarColumn(ColumnDescription = "差异操作", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? DiffType { get; set; }
/// <summary>
/// 耗时
/// </summary>
[SugarColumn(ColumnDescription = "耗时")]
public long? Elapsed { get; set; }
}

View File

@@ -0,0 +1,68 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统异常日志表
/// </summary>
[SugarTable("sys_log_ex", "系统异常日志表")]
[SysTable]
[LogTable]
public partial class SysLogEx : SysLogVis
{
/// <summary>
/// 请求方式
/// </summary>
[SugarColumn(ColumnDescription = "请求方式", Length = 32)]
[MaxLength(32)]
public string? HttpMethod { get; set; }
/// <summary>
/// 请求地址
/// </summary>
[SugarColumn(ColumnDescription = "请求地址", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? RequestUrl { get; set; }
/// <summary>
/// 请求参数
/// </summary>
[SugarColumn(ColumnDescription = "请求参数", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? RequestParam { get; set; }
/// <summary>
/// 返回结果
/// </summary>
[SugarColumn(ColumnDescription = "返回结果", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? ReturnResult { get; set; }
/// <summary>
/// 事件Id
/// </summary>
[SugarColumn(ColumnDescription = "事件Id")]
public int? EventId { get; set; }
/// <summary>
/// 线程Id
/// </summary>
[SugarColumn(ColumnDescription = "线程Id")]
public int? ThreadId { get; set; }
/// <summary>
/// 请求跟踪Id
/// </summary>
[SugarColumn(ColumnDescription = "请求跟踪Id", Length = 128)]
[MaxLength(128)]
public string? TraceId { get; set; }
/// <summary>
/// 异常信息
/// </summary>
[SugarColumn(ColumnDescription = "异常信息", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? Exception { get; set; }
/// <summary>
/// 日志消息Json
/// </summary>
[SugarColumn(ColumnDescription = "日志消息Json", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? Message { get; set; }
}

View File

@@ -0,0 +1,68 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统操作日志表
/// </summary>
[SugarTable("sys_log_op", "系统操作日志表")]
[SysTable]
[LogTable]
public partial class SysLogOp : SysLogVis
{
/// <summary>
/// 请求方式
/// </summary>
[SugarColumn(ColumnDescription = "请求方式", Length = 32)]
[MaxLength(32)]
public string? HttpMethod { get; set; }
/// <summary>
/// 请求地址
/// </summary>
[SugarColumn(ColumnDescription = "请求地址", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? RequestUrl { get; set; }
/// <summary>
/// 请求参数
/// </summary>
[SugarColumn(ColumnDescription = "请求参数", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? RequestParam { get; set; }
/// <summary>
/// 返回结果
/// </summary>
[SugarColumn(ColumnDescription = "返回结果", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? ReturnResult { get; set; }
/// <summary>
/// 事件Id
/// </summary>
[SugarColumn(ColumnDescription = "事件Id")]
public int? EventId { get; set; }
/// <summary>
/// 线程Id
/// </summary>
[SugarColumn(ColumnDescription = "线程Id")]
public int? ThreadId { get; set; }
/// <summary>
/// 请求跟踪Id
/// </summary>
[SugarColumn(ColumnDescription = "请求跟踪Id", Length = 128)]
[MaxLength(128)]
public string? TraceId { get; set; }
/// <summary>
/// 异常信息
/// </summary>
[SugarColumn(ColumnDescription = "异常信息", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? Exception { get; set; }
/// <summary>
/// 日志消息Json
/// </summary>
[SugarColumn(ColumnDescription = "日志消息Json", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? Message { get; set; }
}

View File

@@ -0,0 +1,113 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统访问日志表
/// </summary>
[SugarTable("sys_log_vis", "系统访问日志表")]
[SysTable]
[LogTable]
public partial class SysLogVis : EntityBaseTenant
{
/// <summary>
/// 模块名称
/// </summary>
[SugarColumn(ColumnDescription = "模块名称", Length = 256)]
[MaxLength(256)]
public string? ControllerName { get; set; }
/// <summary>
/// 方法名称
///</summary>
[SugarColumn(ColumnDescription = "方法名称", Length = 256)]
[MaxLength(256)]
public string? ActionName { get; set; }
/// <summary>
/// 显示名称
///</summary>
[SugarColumn(ColumnDescription = "显示名称", Length = 256)]
[MaxLength(256)]
public string? DisplayTitle { get; set; }
/// <summary>
/// 执行状态
/// </summary>
[SugarColumn(ColumnDescription = "执行状态", Length = 32)]
[MaxLength(32)]
public string? Status { get; set; }
/// <summary>
/// IP地址
/// </summary>
[SugarColumn(ColumnDescription = "IP地址", Length = 256)]
[MaxLength(256)]
public string? RemoteIp { get; set; }
/// <summary>
/// 登录地点
/// </summary>
[SugarColumn(ColumnDescription = "登录地点", Length = 128)]
[MaxLength(128)]
public string? Location { get; set; }
/// <summary>
/// 经度
/// </summary>
[SugarColumn(ColumnDescription = "经度")]
public double? Longitude { get; set; }
/// <summary>
/// 维度
/// </summary>
[SugarColumn(ColumnDescription = "维度")]
public double? Latitude { get; set; }
/// <summary>
/// 浏览器
/// </summary>
[SugarColumn(ColumnDescription = "浏览器", Length = 1024)]
[MaxLength(1024)]
public string? Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
[SugarColumn(ColumnDescription = "操作系统", Length = 256)]
[MaxLength(256)]
public string? Os { get; set; }
/// <summary>
/// 操作用时
/// </summary>
[SugarColumn(ColumnDescription = "操作用时")]
public long? Elapsed { get; set; }
/// <summary>
/// 日志时间
/// </summary>
[SugarColumn(ColumnDescription = "日志时间")]
public DateTime? LogDateTime { get; set; }
/// <summary>
/// 日志级别
/// </summary>
[SugarColumn(ColumnDescription = "日志级别")]
public LogLevel? LogLevel { get; set; }
/// <summary>
/// 账号
/// </summary>
[SugarColumn(ColumnDescription = "账号", Length = 32)]
[MaxLength(32)]
public string? Account { get; set; }
/// <summary>
/// 真实姓名
/// </summary>
[SugarColumn(ColumnDescription = "真实姓名", Length = 32)]
[MaxLength(32)]
public string? RealName { get; set; }
}

View File

@@ -0,0 +1,130 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统菜单表
/// </summary>
[SugarTable("sys_menu", "系统菜单表")]
[SysTable]
[SugarIndex("index_{table}_T", nameof(Title), OrderByType.Asc)]
[SugarIndex("index_{table}_T2", nameof(Type), OrderByType.Asc)]
public partial class SysMenu : EntityBase
{
/// <summary>
/// 父Id
/// </summary>
[SugarColumn(ColumnDescription = "父Id")]
public long Pid { get; set; }
/// <summary>
/// 菜单类型1目录 2菜单 3按钮
/// </summary>
[SugarColumn(ColumnDescription = "菜单类型")]
public MenuTypeEnum Type { get; set; }
/// <summary>
/// 路由名称
/// </summary>
[SugarColumn(ColumnDescription = "路由名称", Length = 64)]
[MaxLength(64)]
public string? Name { get; set; }
/// <summary>
/// 路由地址
/// </summary>
[SugarColumn(ColumnDescription = "路由地址", Length = 128)]
[MaxLength(128)]
public string? Path { get; set; }
/// <summary>
/// 组件路径
/// </summary>
[SugarColumn(ColumnDescription = "组件路径", Length = 128)]
[MaxLength(128)]
public string? Component { get; set; }
/// <summary>
/// 重定向
/// </summary>
[SugarColumn(ColumnDescription = "重定向", Length = 128)]
[MaxLength(128)]
public string? Redirect { get; set; }
/// <summary>
/// 权限标识
/// </summary>
[SugarColumn(ColumnDescription = "权限标识", Length = 128)]
[MaxLength(128)]
public string? Permission { get; set; }
/// <summary>
/// 菜单名称
/// </summary>
[SugarColumn(ColumnDescription = "菜单名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Title { get; set; }
/// <summary>
/// 图标
/// </summary>
[SugarColumn(ColumnDescription = "图标", Length = 128)]
[MaxLength(128)]
public string? Icon { get; set; } = "ele-Menu";
/// <summary>
/// 是否内嵌
/// </summary>
[SugarColumn(ColumnDescription = "是否内嵌")]
public bool IsIframe { get; set; }
/// <summary>
/// 外链链接
/// </summary>
[SugarColumn(ColumnDescription = "外链链接", Length = 256)]
[MaxLength(256)]
public string? OutLink { get; set; }
/// <summary>
/// 是否隐藏
/// </summary>
[SugarColumn(ColumnDescription = "是否隐藏")]
public bool IsHide { get; set; }
/// <summary>
/// 是否缓存
/// </summary>
[SugarColumn(ColumnDescription = "是否缓存")]
public bool IsKeepAlive { get; set; } = true;
/// <summary>
/// 是否固定
/// </summary>
[SugarColumn(ColumnDescription = "是否固定")]
public bool IsAffix { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 256)]
[MaxLength(256)]
public string? Remark { get; set; }
/// <summary>
/// 菜单子项
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<SysMenu> Children { get; set; } = new();
}

View File

@@ -0,0 +1,76 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统通知公告表
/// </summary>
[SugarTable("sys_notice", "系统通知公告表")]
[SysTable]
[SugarIndex("index_{table}_T", nameof(Type), OrderByType.Asc)]
public partial class SysNotice : EntityBase
{
/// <summary>
/// 标题
/// </summary>
[SugarColumn(ColumnDescription = "标题", Length = 32)]
[Required, MaxLength(32)]
public virtual string Title { get; set; }
/// <summary>
/// 内容
/// </summary>
[SugarColumn(ColumnDescription = "内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
[Required]
public virtual string Content { get; set; }
/// <summary>
/// 类型1通知 2公告
/// </summary>
[SugarColumn(ColumnDescription = "类型1通知 2公告")]
public NoticeTypeEnum Type { get; set; }
/// <summary>
/// 发布人Id
/// </summary>
[SugarColumn(ColumnDescription = "发布人Id")]
public long PublicUserId { get; set; }
/// <summary>
/// 发布人姓名
/// </summary>
[SugarColumn(ColumnDescription = "发布人姓名", Length = 32)]
[MaxLength(32)]
public string? PublicUserName { get; set; }
/// <summary>
/// 发布机构Id
/// </summary>
[SugarColumn(ColumnDescription = "发布机构Id")]
public long PublicOrgId { get; set; }
/// <summary>
/// 发布机构名称
/// </summary>
[SugarColumn(ColumnDescription = "发布机构名称", Length = 64)]
[MaxLength(64)]
public string? PublicOrgName { get; set; }
/// <summary>
/// 发布时间
/// </summary>
[SugarColumn(ColumnDescription = "发布时间")]
public DateTime? PublicTime { get; set; }
/// <summary>
/// 撤回时间
/// </summary>
[SugarColumn(ColumnDescription = "撤回时间")]
public DateTime? CancelTime { get; set; }
/// <summary>
/// 状态0草稿 1发布 2撤回 3删除
/// </summary>
[SugarColumn(ColumnDescription = "状态0草稿 1发布 2撤回 3删除")]
public NoticeStatusEnum Status { get; set; }
}

View File

@@ -0,0 +1,41 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统通知公告用户表
/// </summary>
[SugarTable("sys_notice_user", "系统通知公告用户表")]
[SysTable]
public partial class SysNoticeUser : EntityBaseId
{
/// <summary>
/// 通知公告Id
/// </summary>
[SugarColumn(ColumnDescription = "通知公告Id")]
public long NoticeId { get; set; }
/// <summary>
/// 通知公告
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(NoticeId))]
public SysNotice SysNotice { get; set; }
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 阅读时间
/// </summary>
[SugarColumn(ColumnDescription = "阅读时间")]
public DateTime? ReadTime { get; set; }
/// <summary>
/// 状态0未读 1已读
/// </summary>
[SugarColumn(ColumnDescription = "状态0未读 1已读")]
public NoticeUserStatusEnum ReadStatus { get; set; } = NoticeUserStatusEnum.UNREAD;
}

View File

@@ -0,0 +1,64 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统在线用户表
/// </summary>
[SugarTable("sys_online_user", "系统在线用户表")]
[SysTable]
public partial class SysOnlineUser : EntityBaseTenantId
{
/// <summary>
/// 连接Id
/// </summary>
[SugarColumn(ColumnDescription = "连接Id")]
public string? ConnectionId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 账号
/// </summary>
[SugarColumn(ColumnDescription = "账号", Length = 32)]
[Required, MaxLength(32)]
public virtual string UserName { get; set; }
/// <summary>
/// 真实姓名
/// </summary>
[SugarColumn(ColumnDescription = "真实姓名", Length = 32)]
[MaxLength(32)]
public string? RealName { get; set; }
/// <summary>
/// 连接时间
/// </summary>
[SugarColumn(ColumnDescription = "连接时间")]
public DateTime? Time { get; set; }
/// <summary>
/// 连接IP
/// </summary>
[SugarColumn(ColumnDescription = "连接IP", Length = 256)]
[MaxLength(256)]
public string? Ip { get; set; }
/// <summary>
/// 浏览器
/// </summary>
[SugarColumn(ColumnDescription = "浏览器", Length = 128)]
[MaxLength(128)]
public string? Browser { get; set; }
/// <summary>
/// 操作系统
/// </summary>
[SugarColumn(ColumnDescription = "操作系统", Length = 128)]
[MaxLength(128)]
public string? Os { get; set; }
}

View File

@@ -0,0 +1,92 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统机构表
/// </summary>
[SugarTable("sys_org", "系统机构表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc)]
[SugarIndex("index_{table}_T", nameof(Type), OrderByType.Asc)]
public partial class SysOrg : EntityBaseTenant
{
/// <summary>
/// 父Id
/// </summary>
[SugarColumn(ColumnDescription = "父Id")]
public long Pid { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[SugarColumn(ColumnDescription = "编码", Length = 64)]
[MaxLength(64)]
public string? Code { get; set; }
/// <summary>
/// 级别
/// </summary>
[SugarColumn(ColumnDescription = "级别")]
public int? Level { get; set; }
/// <summary>
/// 机构类型-数据字典
/// </summary>
[SugarColumn(ColumnDescription = "机构类型", Length = 64)]
[MaxLength(64)]
public virtual string? Type { get; set; }
/// <summary>
/// 负责人Id
/// </summary>
[SugarColumn(ColumnDescription = "负责人Id", IsNullable = true)]
public long? DirectorId { get; set; }
/// <summary>
/// 负责人
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(DirectorId))]
public SysUser Director { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public string? Remark { get; set; }
/// <summary>
/// 机构子项
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<SysOrg> Children { get; set; }
/// <summary>
/// 是否禁止选中
/// </summary>
[SugarColumn(IsIgnore = true)]
public bool Disabled { get; set; }
}

View File

@@ -0,0 +1,52 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统职位表
/// </summary>
[SugarTable("sys_pos", "系统职位表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc)]
public partial class SysPos : EntityBaseTenant
{
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[SugarColumn(ColumnDescription = "编码", Length = 64)]
[MaxLength(64)]
public string? Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public string? Remark { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 在职人员
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<SysUser> UserList { get; set; }
}

View File

@@ -0,0 +1,71 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统打印模板表
/// </summary>
[SugarTable("sys_print", "系统打印模板表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
public partial class SysPrint : EntityBaseTenant
{
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
/// <summary>
/// 打印模板
/// </summary>
[SugarColumn(ColumnDescription = "打印模板", ColumnDataType = StaticConfig.CodeFirst_BigString)]
[Required]
public virtual string Template { get; set; }
/// <summary>
/// 打印类型
/// </summary>
[SugarColumn(ColumnDescription = "打印类型")]
[Required]
public virtual PrintTypeEnum? PrintType { get; set; }
/// <summary>
/// 客户端服务地址
/// </summary>
[SugarColumn(ColumnDescription = "客户端服务地址", Length = 128)]
[MaxLength(128)]
public virtual string? ClientServiceAddress { get; set; }
/// <summary>
/// 打印参数
/// </summary>
[SugarColumn(ColumnDescription = "打印参数", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public virtual string? PrintParam { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public string? Remark { get; set; }
/// <summary>
/// 打印预览测试数据
/// </summary>
[SugarColumn(ColumnDescription = "打印预览测试数据", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public string? PrintDataDemo { get; set; }
}

View File

@@ -0,0 +1,105 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统行政地区表
/// </summary>
[SugarTable("sys_region", "系统行政地区表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc, IsUnique = true)]
public partial class SysRegion : EntityBaseId
{
/// <summary>
/// 父Id
/// </summary>
[SugarColumn(ColumnDescription = "父Id")]
public long Pid { get; set; }
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 128)]
[Required, MaxLength(128)]
public virtual string Name { get; set; }
/// <summary>
/// 简称
/// </summary>
[SugarColumn(ColumnDescription = "简称", Length = 32)]
[MaxLength(32)]
public string? ShortName { get; set; }
/// <summary>
/// 组合名
/// </summary>
[SugarColumn(ColumnDescription = "组合名", Length = 64)]
[MaxLength(64)]
public string? MergerName { get; set; }
/// <summary>
/// 行政代码
/// </summary>
[SugarColumn(ColumnDescription = "行政代码", Length = 32)]
[MaxLength(32)]
public string? Code { get; set; }
/// <summary>
/// 邮政编码
/// </summary>
[SugarColumn(ColumnDescription = "邮政编码", Length = 6)]
[MaxLength(6)]
public string? ZipCode { get; set; }
/// <summary>
/// 区号
/// </summary>
[SugarColumn(ColumnDescription = "区号", Length = 6)]
[MaxLength(6)]
public string? CityCode { get; set; }
/// <summary>
/// 层级
/// </summary>
[SugarColumn(ColumnDescription = "层级")]
public int Level { get; set; }
/// <summary>
/// 拼音
/// </summary>
[SugarColumn(ColumnDescription = "拼音", Length = 128)]
[MaxLength(128)]
public string? PinYin { get; set; }
/// <summary>
/// 经度
/// </summary>
[SugarColumn(ColumnDescription = "经度")]
public float Lng { get; set; }
/// <summary>
/// 维度
/// </summary>
[SugarColumn(ColumnDescription = "维度")]
public float Lat { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public string? Remark { get; set; }
/// <summary>
/// 机构子项
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<SysRegion> Children { get; set; }
}

View File

@@ -0,0 +1,52 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统角色表
/// </summary>
[SugarTable("sys_role", "系统角色表")]
[SysTable]
[SugarIndex("index_{table}_N", nameof(Name), OrderByType.Asc)]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc)]
public partial class SysRole : EntityBaseTenant
{
/// <summary>
/// 名称
/// </summary>
[SugarColumn(ColumnDescription = "名称", Length = 64)]
[Required, MaxLength(64)]
public virtual string Name { get; set; }
/// <summary>
/// 编码
/// </summary>
[SugarColumn(ColumnDescription = "编码", Length = 64)]
[MaxLength(64)]
public string? Code { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 数据范围1全部数据 2本部门及以下数据 3本部门数据 4仅本人数据 5自定义数据
/// </summary>
[SugarColumn(ColumnDescription = "数据范围")]
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.Self;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public string? Remark { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
}

View File

@@ -0,0 +1,31 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统角色菜单表
/// </summary>
[SugarTable("sys_role_menu", "系统角色菜单表")]
[SysTable]
public class SysRoleMenu : EntityBaseId
{
/// <summary>
/// 角色Id
/// </summary>
[SugarColumn(ColumnDescription = "角色Id")]
public long RoleId { get; set; }
/// <summary>
/// 菜单Id
/// </summary>
[SugarColumn(ColumnDescription = "菜单Id")]
public long MenuId { get; set; }
/// <summary>
/// 菜单
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(MenuId))]
public SysMenu SysMenu { get; set; }
}

View File

@@ -0,0 +1,31 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统角色机构表
/// </summary>
[SugarTable("sys_role_org", "系统角色机构表")]
[SysTable]
public class SysRoleOrg : EntityBaseId
{
/// <summary>
/// 角色Id
/// </summary>
[SugarColumn(ColumnDescription = "角色Id")]
public long RoleId { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long OrgId { get; set; }
/// <summary>
/// 机构
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(OrgId))]
public SysOrg SysOrg { get; set; }
}

View File

@@ -0,0 +1,48 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统日程表
/// </summary>
[SugarTable("sys_schedule", "系统日程表")]
[SysTable]
public class SysSchedule : EntityBaseTenant
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 日程日期
/// </summary>
[SugarColumn(ColumnDescription = "日程日期")]
public DateTime? ScheduleTime { get; set; }
/// <summary>
/// 开始时间
/// </summary>
[SugarColumn(ColumnDescription = "开始时间", Length = 10)]
public string? StartTime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
[SugarColumn(ColumnDescription = "结束时间", Length = 10)]
public string? EndTime { get; set; }
/// <summary>
/// 日程内容
/// </summary>
[SugarColumn(ColumnDescription = "日程内容", Length = 256)]
[Required, MaxLength(256)]
public virtual string Content { get; set; }
/// <summary>
/// 完成状态
/// </summary>
[SugarColumn(ColumnDescription = "完成状态")]
public FinishStatusEnum Status { get; set; } = FinishStatusEnum.UnFinish;
}

View File

@@ -0,0 +1,59 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统模板表
/// </summary>
[SysTable]
[SugarTable("sys_template", "系统模板表")]
[SugarIndex("index_{table}_C", nameof(Code), OrderByType.Asc, IsUnique = true)]
[SugarIndex("index_{table}_G", nameof(GroupName), OrderByType.Asc)]
public partial class SysTemplate : EntityBaseTenant
{
/// <summary>
/// 名称
/// </summary>
[MaxLength(128)]
[SugarColumn(ColumnDescription = "名称", Length = 128)]
public virtual string Name { get; set; }
/// <summary>
/// 分组名称
/// </summary>
[SugarColumn(ColumnDescription = "分组名称")]
public virtual TemplateTypeEnum Type { get; set; }
/// <summary>
/// 编码
/// </summary>
[MaxLength(128)]
[SugarColumn(ColumnDescription = "编码", Length = 128)]
public virtual string Code { get; set; }
/// <summary>
/// 分组名称
/// </summary>
[MaxLength(32)]
[SugarColumn(ColumnDescription = "分组名称", Length = 32)]
public virtual string GroupName { get; set; }
/// <summary>
/// 模板内容
/// </summary>
[SugarColumn(ColumnDescription = "模板内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public virtual string Content { get; set; }
/// <summary>
/// 备注
/// </summary>
[MaxLength(128)]
[SugarColumn(ColumnDescription = "备注", Length = 128)]
public virtual string? Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public virtual int OrderNo { get; set; } = 100;
}

View File

@@ -0,0 +1,141 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统租户表
/// </summary>
[SugarTable("sys_tenant", "系统租户表")]
[SysTable]
public partial class SysTenant : EntityBase
{
/// <summary>
/// 租管用户Id
/// </summary>
[SugarColumn(ColumnDescription = "租管用户Id")]
public virtual long UserId { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public virtual long OrgId { get; set; }
/// <summary>
/// 域名
/// </summary>
[SugarColumn(ColumnDescription = "域名", Length = 128)]
[MaxLength(128)]
public virtual string? Host { get; set; }
/// <summary>
/// 租户类型
/// </summary>
[SugarColumn(ColumnDescription = "租户类型")]
public virtual TenantTypeEnum TenantType { get; set; }
/// <summary>
/// 数据库类型
/// </summary>
[SugarColumn(ColumnDescription = "数据库类型")]
public virtual DbType DbType { get; set; }
/// <summary>
/// 数据库连接
/// </summary>
[SugarColumn(ColumnDescription = "数据库连接", Length = 256)]
[MaxLength(256)]
public virtual string? Connection { get; set; }
/// <summary>
/// 数据库标识
/// </summary>
[SugarColumn(ColumnDescription = "数据库标识", Length = 64)]
[MaxLength(64)]
public virtual string? ConfigId { get; set; }
/// <summary>
/// 从库连接/读写分离
/// </summary>
[SugarColumn(ColumnDescription = "从库连接/读写分离", ColumnDataType = StaticConfig.CodeFirst_BigString)]
public virtual string? SlaveConnections { get; set; }
/// <summary>
/// 启用注册功能
/// </summary>
[SugarColumn(ColumnDescription = "启用注册功能")]
public virtual YesNoEnum? EnableReg { get; set; } = YesNoEnum.N;
/// <summary>
/// 默认注册方案Id
/// </summary>
[SugarColumn(ColumnDescription = "默认注册方案")]
public virtual long? RegWayId { get; set; }
/// <summary>
/// 图标
/// </summary>
[SugarColumn(ColumnDescription = "图标", Length = 256), MaxLength(256)]
public virtual string? Logo { get; set; }
/// <summary>
/// 标题
/// </summary>
[SugarColumn(ColumnDescription = "标题", Length = 32), MaxLength(32)]
public virtual string? Title { get; set; }
/// <summary>
/// 副标题
/// </summary>
[SugarColumn(ColumnDescription = "副标题", Length = 32), MaxLength(32)]
public virtual string? ViceTitle { get; set; }
/// <summary>
/// 副描述
/// </summary>
[SugarColumn(ColumnDescription = "副描述", Length = 64), MaxLength(64)]
public virtual string? ViceDesc { get; set; }
/// <summary>
/// 水印
/// </summary>
[SugarColumn(ColumnDescription = "水印", Length = 32), MaxLength(32)]
public virtual string? Watermark { get; set; }
/// <summary>
/// 版权信息
/// </summary>
[SugarColumn(ColumnDescription = "版权信息", Length = 64), MaxLength(64)]
public virtual string? Copyright { get; set; }
/// <summary>
/// ICP备案号
/// </summary>
[SugarColumn(ColumnDescription = "ICP备案号", Length = 32), MaxLength(32)]
public virtual string? Icp { get; set; }
/// <summary>
/// ICP地址
/// </summary>
[SugarColumn(ColumnDescription = "ICP地址", Length = 32), MaxLength(32)]
public virtual string? IcpUrl { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public virtual int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 128)]
[MaxLength(128)]
public virtual string? Remark { get; set; }
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public virtual StatusEnum Status { get; set; } = StatusEnum.Enable;
}

View File

@@ -0,0 +1,17 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统租户配置参数表
/// </summary>
[SugarTable("sys_tenant_config", "系统租户配置参数表")]
[SysTable]
public partial class SysTenantConfig : SysConfig
{
/// <summary>
/// 无效字段用于忽略实体类的Value字段
/// </summary>
[SugarColumn(IsIgnore = true)]
private new string? Value { get; set; }
}

View File

@@ -0,0 +1,25 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统租户配置参数值表
/// </summary>
[SugarTable("sys_tenant_config_data", "系统租户配置参数值表")]
[SysTable]
[SugarIndex("index_{table}_TC", nameof(TenantId), OrderByType.Asc, nameof(ConfigId), OrderByType.Asc)]
public class SysTenantConfigData : EntityBaseTenantId
{
/// <summary>
/// 配置项Id
/// </summary>
[SugarColumn(ColumnDescription = "配置项Id")]
public long ConfigId { get; set; }
/// <summary>
/// 参数值
/// </summary>
[SugarColumn(ColumnDescription = "参数值", Length = 512)]
[MaxLength(512)]
public string? Value { get; set; }
}

View File

@@ -0,0 +1,23 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统租户菜单表
/// </summary>
[SysTable]
[SugarTable("sys_tenant_menu", "系统租户菜单表")]
public class SysTenantMenu : EntityBaseId
{
/// <summary>
/// 租户Id
/// </summary>
[SugarColumn(ColumnDescription = "租户Id")]
public long TenantId { get; set; }
/// <summary>
/// 菜单Id
/// </summary>
[SugarColumn(ColumnDescription = "菜单Id")]
public long MenuId { get; set; }
}

View File

@@ -0,0 +1,390 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统用户表
/// </summary>
[SugarTable("sys_user", "系统用户表")]
[SysTable]
[SugarIndex("index_{table}_A", nameof(Account), OrderByType.Asc)]
[SugarIndex("index_{table}_P", nameof(Phone), OrderByType.Asc)]
public partial class SysUser : EntityBaseTenantOrg
{
/// <summary>
/// 账号
/// </summary>
[SugarColumn(ColumnDescription = "账号", Length = 32)]
[Required, MaxLength(32)]
public virtual string Account { get; set; }
/// <summary>
/// 密码
/// </summary>
[SugarColumn(ColumnDescription = "密码", Length = 512)]
[MaxLength(512)]
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
public virtual string Password { get; set; }
/// <summary>
/// Jeecg 用户表中的 salt用于 PBEWithMD5AndDES 与后台密码字段一致;从 Jeecg 同步时写入
/// </summary>
[SugarColumn(ColumnDescription = "Jeecg密码盐", Length = 64, IsNullable = true)]
[MaxLength(64)]
public string? JeecgPasswordSalt { get; set; }
/// <summary>
/// 真实姓名
/// </summary>
[SugarColumn(ColumnDescription = "真实姓名", Length = 32)]
[MaxLength(32)]
public virtual string RealName { get; set; }
/// <summary>
/// 昵称
/// </summary>
[SugarColumn(ColumnDescription = "昵称", Length = 32)]
[MaxLength(32)]
public string? NickName { get; set; }
/// <summary>
/// 头像
/// </summary>
[SugarColumn(ColumnDescription = "头像", Length = 512)]
[MaxLength(512)]
public string? Avatar { get; set; }
/// <summary>
/// Jeecg 侧用户更新时间(用于增量同步时跳过未变化记录)
/// </summary>
[SugarColumn(ColumnDescription = "Jeecg更新时间", IsNullable = true)]
public DateTime? JeecgUpdateTime { get; set; }
/// <summary>
/// Jeecg/业务后台用户主键(雪花 ID 等,以字符串保存避免溢出)
/// </summary>
[SugarColumn(ColumnDescription = "Jeecg用户ID", Length = 64, IsNullable = true)]
[MaxLength(64)]
public string? JeecgBizUserId { get; set; }
/// <summary>
/// Jeecg 机构编码 orgCode
/// </summary>
[SugarColumn(ColumnDescription = "Jeecg机构编码", Length = 64, IsNullable = true)]
[MaxLength(64)]
public string? JeecgOrgCode { get; set; }
/// <summary>
/// Jeecg 部门 id 列表(逗号分隔的 departIds
/// </summary>
[SugarColumn(ColumnDescription = "Jeecg部门IDs", Length = 512, IsNullable = true)]
[MaxLength(512)]
public string? JeecgDepartIds { get; set; }
/// <summary>
/// 性别-男_1、女_2
/// </summary>
[SugarColumn(ColumnDescription = "性别")]
public GenderEnum? Sex { get; set; }
/// <summary>
/// 年龄
/// </summary>
[SugarColumn(ColumnDescription = "年龄")]
public int Age { get; set; }
/// <summary>
/// 出生日期
/// </summary>
[SugarColumn(ColumnDescription = "出生日期")]
public DateTime? Birthday { get; set; }
/// <summary>
/// 民族
/// </summary>
[SugarColumn(ColumnDescription = "民族", Length = 32)]
[MaxLength(32)]
public string? Nation { get; set; }
/// <summary>
/// 手机号码
/// </summary>
[SugarColumn(ColumnDescription = "手机号码", Length = 16)]
[MaxLength(16)]
public string? Phone { get; set; }
/// <summary>
/// 证件类型
/// </summary>
[SugarColumn(ColumnDescription = "证件类型")]
public CardTypeEnum CardType { get; set; }
/// <summary>
/// 身份证号
/// </summary>
[SugarColumn(ColumnDescription = "身份证号", Length = 32)]
[MaxLength(32)]
public string? IdCardNum { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[SugarColumn(ColumnDescription = "邮箱", Length = 64)]
[MaxLength(64)]
public string? Email { get; set; }
/// <summary>
/// 地址
/// </summary>
[SugarColumn(ColumnDescription = "地址", Length = 256)]
[MaxLength(256)]
public string? Address { get; set; }
/// <summary>
/// 文化程度
/// </summary>
[SugarColumn(ColumnDescription = "文化程度")]
public CultureLevelEnum CultureLevel { get; set; }
/// <summary>
/// 政治面貌
/// </summary>
[SugarColumn(ColumnDescription = "政治面貌", Length = 16)]
[MaxLength(16)]
public string? PoliticalOutlook { get; set; }
/// <summary>
/// 毕业院校
/// </summary>
[SugarColumn(ColumnDescription = "毕业院校", Length = 128)]
[MaxLength(128)]
public string? College { get; set; }
/// <summary>
/// 办公电话
/// </summary>
[SugarColumn(ColumnDescription = "办公电话", Length = 16)]
[MaxLength(16)]
public string? OfficePhone { get; set; }
/// <summary>
/// 紧急联系人
/// </summary>
[SugarColumn(ColumnDescription = "紧急联系人", Length = 32)]
[MaxLength(32)]
public string? EmergencyContact { get; set; }
/// <summary>
/// 紧急联系人电话
/// </summary>
[SugarColumn(ColumnDescription = "紧急联系人电话", Length = 16)]
[MaxLength(16)]
public string? EmergencyPhone { get; set; }
/// <summary>
/// 紧急联系人地址
/// </summary>
[SugarColumn(ColumnDescription = "紧急联系人地址", Length = 256)]
[MaxLength(256)]
public string? EmergencyAddress { get; set; }
/// <summary>
/// 个人简介
/// </summary>
[SugarColumn(ColumnDescription = "个人简介", Length = 512)]
[MaxLength(512)]
public string? Introduction { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDescription = "状态")]
public StatusEnum Status { get; set; } = StatusEnum.Enable;
/// <summary>
/// 备注
/// </summary>
[SugarColumn(ColumnDescription = "备注", Length = 256)]
[MaxLength(256)]
public string? Remark { get; set; }
/// <summary>
/// 账号类型
/// </summary>
[SugarColumn(ColumnDescription = "账号类型")]
public AccountTypeEnum AccountType { get; set; } = AccountTypeEnum.NormalUser;
///// <summary>
///// 直属机构Id
///// </summary>
//[SugarColumn(ColumnDescription = "直属机构Id")]
//public long OrgId { get; set; }
/// <summary>
/// 直属机构
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(OrgId))]
public SysOrg SysOrg { get; set; }
/// <summary>
/// 直属主管Id
/// </summary>
[SugarColumn(ColumnDescription = "直属主管Id")]
public long? ManagerUserId { get; set; }
/// <summary>
/// 直属主管
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(ManagerUserId))]
public SysUser ManagerUser { get; set; }
/// <summary>
/// 职位Id
/// </summary>
[SugarColumn(ColumnDescription = "职位Id")]
public long PosId { get; set; }
/// <summary>
/// 职位
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(PosId))]
public SysPos SysPos { get; set; }
/// <summary>
/// 工号
/// </summary>
[SugarColumn(ColumnDescription = "工号", Length = 32)]
[MaxLength(32)]
public string? JobNum { get; set; }
/// <summary>
/// 职级
/// </summary>
[SugarColumn(ColumnDescription = "职级", Length = 32)]
[MaxLength(32)]
public string? PosLevel { get; set; }
/// <summary>
/// 职称
/// </summary>
[SugarColumn(ColumnDescription = "职称", Length = 32)]
[MaxLength(32)]
public string? PosTitle { get; set; }
/// <summary>
/// 擅长领域
/// </summary>
[SugarColumn(ColumnDescription = "擅长领域", Length = 32)]
[MaxLength(32)]
public string? Expertise { get; set; }
/// <summary>
/// 办公区域
/// </summary>
[SugarColumn(ColumnDescription = "办公区域", Length = 32)]
[MaxLength(32)]
public string? OfficeZone { get; set; }
/// <summary>
/// 办公室
/// </summary>
[SugarColumn(ColumnDescription = "办公室", Length = 32)]
[MaxLength(32)]
public string? Office { get; set; }
/// <summary>
/// 入职日期
/// </summary>
[SugarColumn(ColumnDescription = "入职日期")]
public DateTime? JoinDate { get; set; }
/// <summary>
/// 最新登录Ip
/// </summary>
[SugarColumn(ColumnDescription = "最新登录Ip", Length = 256)]
[MaxLength(256)]
public string? LastLoginIp { get; set; }
/// <summary>
/// 最新登录地点
/// </summary>
[SugarColumn(ColumnDescription = "最新登录地点", Length = 128)]
[MaxLength(128)]
public string? LastLoginAddress { get; set; }
/// <summary>
/// 最新登录时间
/// </summary>
[SugarColumn(ColumnDescription = "最新登录时间")]
public DateTime? LastLoginTime { get; set; }
/// <summary>
/// 最新登录设备
/// </summary>
[SugarColumn(ColumnDescription = "最新登录设备", Length = 128)]
[MaxLength(128)]
public string? LastLoginDevice { get; set; }
/// <summary>
/// 电子签名
/// </summary>
[SugarColumn(ColumnDescription = "电子签名", Length = 512)]
[MaxLength(512)]
public string? Signature { get; set; }
[SugarColumn(IsIgnore = true)]
public string? AccountTypeZh { get {
return this.AccountType.GetDescription();
} }
[SugarColumn(IsIgnore = true)]
public bool IsSuperAdmin
{
get
{
return this.AccountType== AccountTypeEnum.SuperAdmin;
}
}
[SugarColumn(IsIgnore = true)]
public bool IsSysAdmin
{
get
{
return this.AccountType == AccountTypeEnum.SysAdmin;
}
}
/// <summary>
/// 验证超级管理员类型,若账号类型为超级管理员则报错
/// </summary>
/// <param name="errorMsg">自定义错误消息</param>
public void ValidateIsSuperAdminAccountType(ErrorCodeEnum? errorMsg = ErrorCodeEnum.D1014)
{
if (AccountType == AccountTypeEnum.SuperAdmin)
{
throw new Exception(errorMsg.GetDescription());
}
}
/// <summary>
/// 验证用户Id是否相同若用户Id相同则报错
/// </summary>
/// <param name="userId">用户Id</param>
/// <param name="errorMsg">自定义错误消息</param>
public void ValidateIsUserId(long userId, ErrorCodeEnum? errorMsg = ErrorCodeEnum.D1001)
{
if (Id == userId)
{
throw new Exception(errorMsg.GetDescription());
}
}
}

View File

@@ -0,0 +1,17 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统用户配置参数表
/// </summary>
[SugarTable("sys_user_config", "系统用户配置参数表")]
[SysTable]
public partial class SysUserConfig : SysConfig
{
/// <summary>
/// 无效字段用于忽略实体类的Value字段
/// </summary>
[SugarColumn(IsIgnore = true)]
private new string? Value { get; set; }
}

View File

@@ -0,0 +1,31 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统租户配置参数值表
/// </summary>
[SugarTable("sys_user_config_data", "系统租户配置参数值表")]
[SysTable]
[SugarIndex("index_{table}_UC", nameof(UserId), OrderByType.Asc, nameof(ConfigId), OrderByType.Asc)]
public class SysUserConfigData : EntityBaseId
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 配置项Id
/// </summary>
[SugarColumn(ColumnDescription = "配置项Id")]
public long ConfigId { get; set; }
/// <summary>
/// 参数值
/// </summary>
[SugarColumn(ColumnDescription = "参数值", Length = 512)]
[MaxLength(512)]
public string? Value { get; set; }
}

View File

@@ -0,0 +1,73 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统用户扩展机构表
/// </summary>
[SugarTable("sys_user_ext_org", "系统用户扩展机构表")]
[SysTable]
public partial class SysUserExtOrg : EntityBaseId
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 用户
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(UserId))]
public SysUser SysUser { get; set; }
/// <summary>
/// 机构Id
/// </summary>
[SugarColumn(ColumnDescription = "机构Id")]
public long OrgId { get; set; }
/// <summary>
/// 机构
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(OrgId))]
public SysOrg SysOrg { get; set; }
/// <summary>
/// 职位Id
/// </summary>
[SugarColumn(ColumnDescription = "职位Id")]
public long PosId { get; set; }
/// <summary>
/// 职位
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(PosId))]
public SysPos SysPos { get; set; }
/// <summary>
/// 工号
/// </summary>
[SugarColumn(ColumnDescription = "工号", Length = 32)]
[MaxLength(32)]
public string? JobNum { get; set; }
/// <summary>
/// 职级
/// </summary>
[SugarColumn(ColumnDescription = "职级", Length = 32)]
[MaxLength(32)]
public string? PosLevel { get; set; }
/// <summary>
/// 入职日期
/// </summary>
[SugarColumn(ColumnDescription = "入职日期")]
public DateTime? JoinDate { get; set; }
}

View File

@@ -0,0 +1,76 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统用户域配置表
/// </summary>
[SugarTable("sys_user_ldap", "系统用户域配置表")]
[SysTable]
[SugarIndex("index_{table}_A", nameof(Account), OrderByType.Asc)]
[SugarIndex("index_{table}_U", nameof(UserId), OrderByType.Asc)]
public class SysUserLdap : EntityBaseTenantId
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 域账号
/// AD域对应sAMAccountName
/// Ldap对应uid
/// </summary>
[SugarColumn(ColumnDescription = "域账号", Length = 32)]
[Required]
public string Account { get; set; }
/// <summary>
/// 域用户名
/// </summary>
[SugarColumn(ColumnDescription = "域用户名", Length = 32)]
public string UserName { get; set; }
/// <summary>
/// 对应EmployeeId(用于数据导入对照)
/// </summary>
[SugarColumn(ColumnDescription = "对应EmployeeId", Length = 32)]
public string? EmployeeId { get; set; }
/// <summary>
/// 组织代码
/// </summary>
[SugarColumn(ColumnDescription = "组织代码", Length = 64)]
public string? DeptCode { get; set; }
/// <summary>
/// 最后设置密码时间
/// </summary>
[SugarColumn(ColumnDescription = "最后设置密码时间")]
public DateTime? PwdLastSetTime { get; set; }
/// <summary>
/// 邮箱
/// </summary>
[SugarColumn(ColumnDescription = "组织代码", Length = 64)]
public string? Mail { get; set; }
/// <summary>
/// 检查账户是否已过期
/// </summary>
[SugarColumn(ColumnDescription = "检查账户是否已过期")]
public bool AccountExpiresFlag { get; set; } = false;
/// <summary>
/// 密码设置是否永不过期
/// </summary>
[SugarColumn(ColumnDescription = "密码设置是否永不过期")]
public bool DontExpiresFlag { get; set; } = false;
/// <summary>
/// DN
/// </summary>
[SugarColumn(ColumnDescription = "DN", Length = 512)]
public string Dn { get; set; }
}

View File

@@ -0,0 +1,37 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统用户菜单快捷导航表
/// </summary>
[SugarTable("sys_user_menu", "系统用户菜单快捷导航表")]
[SysTable]
public partial class SysUserMenu : EntityBaseId
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 用户
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(UserId))]
public SysUser SysUser { get; set; }
/// <summary>
/// 菜单Id
/// </summary>
[SugarColumn(ColumnDescription = "菜单Id")]
public long MenuId { get; set; }
/// <summary>
/// 菜单
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(MenuId))]
public SysMenu SysMenu { get; set; }
}

View File

@@ -0,0 +1,55 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统用户注册方案表
/// </summary>
[SugarTable("sys_user_reg_way", "系统用户注册方案表")]
[SysTable]
public partial class SysUserRegWay : EntityBaseTenant
{
/// <summary>
/// 方案名称
/// </summary>
[MaxLength(32)]
[SugarColumn(ColumnDescription = "方案名称", Length = 32)]
public virtual string Name { get; set; }
/// <summary>
/// 账号类型
/// </summary>
[SugarColumn(ColumnDescription = "账号类型")]
public virtual AccountTypeEnum AccountType { get; set; } = AccountTypeEnum.NormalUser;
/// <summary>
/// 注册用户默认角色
/// </summary>
[SugarColumn(ColumnDescription = "角色")]
public virtual long RoleId { get; set; }
/// <summary>
/// 注册用户默认机构
/// </summary>
[SugarColumn(ColumnDescription = "机构")]
public virtual long OrgId { get; set; }
/// <summary>
/// 注册用户默认职位
/// </summary>
[SugarColumn(ColumnDescription = "职位")]
public virtual long PosId { get; set; }
/// <summary>
/// 排序
/// </summary>
[SugarColumn(ColumnDescription = "排序")]
public int OrderNo { get; set; } = 100;
/// <summary>
/// 备注
/// </summary>
[MaxLength(128)]
[SugarColumn(ColumnDescription = "备注", Length = 128)]
public string? Remark { get; set; }
}

View File

@@ -0,0 +1,37 @@

namespace YY.Admin.Core;
/// <summary>
/// 系统用户角色表
/// </summary>
[SugarTable("sys_user_role", "系统用户角色表")]
[SysTable]
public class SysUserRole : EntityBaseId
{
/// <summary>
/// 用户Id
/// </summary>
[SugarColumn(ColumnDescription = "用户Id")]
public long UserId { get; set; }
/// <summary>
/// 用户
/// </summary>
[Newtonsoft.Json.JsonIgnore]
[System.Text.Json.Serialization.JsonIgnore]
[Navigate(NavigateType.OneToOne, nameof(UserId))]
public SysUser SysUser { get; set; }
/// <summary>
/// 角色Id
/// </summary>
[SugarColumn(ColumnDescription = "角色Id")]
public long RoleId { get; set; }
/// <summary>
/// 角色
/// </summary>
[Navigate(NavigateType.OneToOne, nameof(RoleId))]
public SysRole SysRole { get; set; }
}

View File

@@ -0,0 +1,35 @@
namespace YY.Admin.Core;
/// <summary>
/// 账号类型枚举
/// </summary>
[Description("账号类型枚举")]
public enum AccountTypeEnum
{
/// <summary>
/// 超级管理员
/// </summary>
[Description("超级管理员")]
SuperAdmin = 999,
/// <summary>
/// 系统管理员
/// </summary>
[Description("系统管理员")]
SysAdmin = 888,
/// <summary>
/// 普通账号
/// </summary>
[Description("普通账号")]
NormalUser = 777,
/// <summary>
/// 会员
/// </summary>
[Description("会员")]
Member = 666,
}

View File

@@ -0,0 +1,16 @@

namespace YY.Admin.Core;
/// <summary>
/// 参与方的证件类型枚举
/// </summary>
[Description("参与方的证件类型枚举")]
public enum AlipayCertTypeEnum
{
[Description("身份证")]
IDENTITY_CARD,
[Description("护照")]
PASSPORT
}

View File

@@ -0,0 +1,16 @@

namespace YY.Admin.Core;
/// <summary>
/// 参与方的标识类型枚举
/// </summary>
[Description("参与方的标识类型枚举")]
public enum AlipayIdentityTypeEnum
{
[Description("支付宝用户UID")]
ALIPAY_USER_ID,
[Description("支付宝登录号")]
ALIPAY_LOGON_ID
}

View File

@@ -0,0 +1,22 @@

namespace YY.Admin.Core;
/// <summary>
/// 缓存类型枚举
/// </summary>
[Description("缓存类型枚举")]
public enum CacheTypeEnum
{
/// <summary>
/// 内存缓存
/// </summary>
[Description("内存缓存")]
Memory,
/// <summary>
/// Redis缓存
/// </summary>
[Description("Redis缓存")]
Redis
}

View File

@@ -0,0 +1,46 @@

namespace YY.Admin.Core;
/// <summary>
/// 证件类型枚举
/// </summary>
[Description("证件类型枚举")]
public enum CardTypeEnum
{
/// <summary>
/// 身份证
/// </summary>
[Description("身份证")]
IdCard = 0,
/// <summary>
/// 护照
/// </summary>
[Description("护照")]
PassportCard = 1,
/// <summary>
/// 出生证
/// </summary>
[Description("出生证")]
BirthCard = 2,
/// <summary>
/// 港澳台通行证
/// </summary>
[Description("港澳台通行证")]
GatCard = 3,
/// <summary>
/// 外国人居留证
/// </summary>
[Description("外国人居留证")]
ForeignCard = 4,
/// <summary>
/// 营业执照
/// </summary>
[Description("营业执照")]
License = 5,
}

View File

@@ -0,0 +1,28 @@

namespace YY.Admin.Core;
/// <summary>
/// 密码加密枚举
/// </summary>
[Description("密码加密枚举")]
public enum CryptogramEnum
{
/// <summary>
/// MD5
/// </summary>
[Description("MD5")]
MD5 = 0,
/// <summary>
/// SM2国密
/// </summary>
[Description("SM2")]
SM2 = 1,
/// <summary>
/// SM4国密
/// </summary>
[Description("SM4")]
SM4 = 2
}

View File

@@ -0,0 +1,88 @@

namespace YY.Admin.Core;
/// <summary>
/// 文化程度枚举
/// </summary>
[Description("文化程度枚举")]
public enum CultureLevelEnum
{
/// <summary>
/// 其他
/// </summary>
[Description("其他"), Theme("info")]
Level0 = 0,
/// <summary>
/// 文盲
/// </summary>
[Description("文盲")]
Level1 = 1,
/// <summary>
/// 小学
/// </summary>
[Description("小学")]
Level2 = 2,
/// <summary>
/// 初中
/// </summary>
[Description("初中")]
Level3 = 3,
/// <summary>
/// 普通高中
/// </summary>
[Description("普通高中")]
Level4 = 4,
/// <summary>
/// 技工学校
/// </summary>
[Description("技工学校")]
Level5 = 5,
/// <summary>
/// 职业教育
/// </summary>
[Description("职业教育")]
Level6 = 6,
/// <summary>
/// 职业高中
/// </summary>
[Description("职业高中")]
Level7 = 7,
/// <summary>
/// 中等专科
/// </summary>
[Description("中等专科")]
Level8 = 8,
/// <summary>
/// 大学专科
/// </summary>
[Description("大学专科")]
Level9 = 9,
/// <summary>
/// 大学本科
/// </summary>
[Description("大学本科")]
Level10 = 10,
/// <summary>
/// 硕士研究生
/// </summary>
[Description("硕士研究生")]
Level11 = 11,
/// <summary>
/// 博士研究生
/// </summary>
[Description("博士研究生")]
Level12 = 12,
}

View File

@@ -0,0 +1,88 @@

namespace YY.Admin.Core;
/// <summary>
/// 数据操作类型枚举
/// </summary>
[Description("数据操作类型枚举")]
public enum DataOpTypeEnum
{
/// <summary>
/// 其它
/// </summary>
[Description("其它"), Theme("info")]
Other,
/// <summary>
/// 增加
/// </summary>
[Description("增加")]
Add,
/// <summary>
/// 删除
/// </summary>
[Description("删除")]
Delete,
/// <summary>
/// 编辑
/// </summary>
[Description("编辑")]
Edit,
/// <summary>
/// 更新
/// </summary>
[Description("更新")]
Update,
/// <summary>
/// 查询
/// </summary>
[Description("查询")]
Query,
/// <summary>
/// 详情
/// </summary>
[Description("详情")]
Detail,
/// <summary>
/// 树
/// </summary>
[Description("树")]
Tree,
/// <summary>
/// 导入
/// </summary>
[Description("导入")]
Import,
/// <summary>
/// 导出
/// </summary>
[Description("导出")]
Export,
/// <summary>
/// 授权
/// </summary>
[Description("授权")]
Grant,
/// <summary>
/// 强退
/// </summary>
[Description("强退")]
Force,
/// <summary>
/// 清空
/// </summary>
[Description("清空")]
Clean
}

View File

@@ -0,0 +1,40 @@

namespace YY.Admin.Core;
/// <summary>
/// 角色数据范围枚举
/// </summary>
[Description("角色数据范围枚举")]
public enum DataScopeEnum
{
/// <summary>
/// 全部数据
/// </summary>
[Description("全部数据")]
All = 1,
/// <summary>
/// 本部门及以下数据
/// </summary>
[Description("本部门及以下数据")]
DeptChild = 2,
/// <summary>
/// 本部门数据
/// </summary>
[Description("本部门数据")]
Dept = 3,
/// <summary>
/// 仅本人数据
/// </summary>
[Description("仅本人数据")]
Self = 4,
/// <summary>
/// 自定义数据
/// </summary>
[Description("自定义数据")]
Define = 5
}

View File

@@ -0,0 +1,29 @@

namespace YY.Admin.Core;
/// <summary>
/// ES认证类型枚举
/// <para>https://www.elastic.co/guide/en/elasticsearch/client/net-api/current/_options_on_elasticsearchclientsettings.html</para>
/// </summary>
[Description("ES认证类型枚举")]
public enum ElasticSearchAuthTypeEnum
{
/// <summary>
/// BasicAuthentication
/// </summary>
[Description("BasicAuthentication")]
Basic = 1,
/// <summary>
/// ApiKey
/// </summary>
[Description("ApiKey")]
ApiKey = 2,
/// <summary>
/// Base64ApiKey
/// </summary>
[Description("Base64ApiKey")]
Base64ApiKey = 3
}

View File

@@ -0,0 +1,904 @@
namespace YY.Admin.Core;
/// <summary>
/// 系统错误码
/// </summary>
[Description("系统错误码")]
public enum ErrorCodeEnum
{
/// <summary>
/// 验证码错误
/// </summary>
[Description("验证码错误")]
D0008,
/// <summary>
/// 账号不存在
/// </summary>
[Description("账号不存在")]
D0009,
/// <summary>
/// 密匙不匹配
/// </summary>
[Description("密匙不匹配")]
D0010,
/// <summary>
/// 密码不正确
/// </summary>
[Description("密码不正确")]
D1000,
/// <summary>
/// 非法操作!禁止删除自己
/// </summary>
[Description("非法操作,禁止删除自己")]
D1001,
/// <summary>
/// 记录不存在
/// </summary>
[Description("记录不存在")]
D1002,
/// <summary>
/// 账号已存在
/// </summary>
[Description("账号已存在")]
D1003,
/// <summary>
/// 旧密码不匹配
/// </summary>
[Description("旧密码输入错误")]
D1004,
/// <summary>
/// 测试数据禁止更改admin密码
/// </summary>
[Description("测试数据禁止更改用户【admin】密码")]
D1005,
/// <summary>
/// 数据已存在
/// </summary>
[Description("数据已存在")]
D1006,
/// <summary>
/// 数据不存在或含有关联引用,禁止删除
/// </summary>
[Description("数据不存在或含有关联引用,禁止删除")]
D1007,
/// <summary>
/// 禁止为管理员分配角色
/// </summary>
[Description("禁止为管理员分配角色")]
D1008,
/// <summary>
/// 重复数据或记录含有不存在数据
/// </summary>
[Description("重复数据或记录含有不存在数据")]
D1009,
/// <summary>
/// 禁止为超级管理员角色分配权限
/// </summary>
[Description("禁止为超级管理员角色分配权限")]
D1010,
/// <summary>
/// 非法操作,未登录
/// </summary>
[Description("非法操作,未登录")]
D1011,
/// <summary>
/// Id不能为空
/// </summary>
[Description("Id不能为空")]
D1012,
/// <summary>
/// 所属机构不在自己的数据范围内
/// </summary>
[Description("没有权限操作该数据")]
D1013,
/// <summary>
/// 禁止删除超级管理员
/// </summary>
[Description("禁止删除超级管理员")]
D1014,
/// <summary>
/// 禁止修改超级管理员状态
/// </summary>
[Description("禁止修改超级管理员状态")]
D1015,
/// <summary>
/// 没有权限
/// </summary>
[Description("没有权限")]
D1016,
/// <summary>
/// 账号已冻结
/// </summary>
[Description("账号已冻结")]
D1017,
/// <summary>
/// 该租户下角色菜单权限集为空
/// </summary>
[Description("该租户下角色菜单权限集为空")]
D1019,
/// <summary>
/// 禁止删除默认租户
/// </summary>
[Description("禁止删除默认租户")]
D1023,
/// <summary>
/// 已将其他地方登录账号下线
/// </summary>
[Description("已将其他地方登录账号下线")]
D1024,
/// <summary>
/// 此角色下面存在账号禁止删除
/// </summary>
[Description("此角色下面存在账号禁止删除")]
D1025,
/// <summary>
/// 禁止修改本人账号状态
/// </summary>
[Description("禁止修改本人账号状态")]
D1026,
/// <summary>
/// 密码错误次数过多,账号已锁定,请半小时后重试!
/// </summary>
[Description("密码错误次数过多,账号已锁定,请半小时后重试!")]
D1027,
/// <summary>
/// 新密码不能与旧密码相同
/// </summary>
[Description("新密码不能与旧密码相同")]
D1028,
/// <summary>
/// 系统默认账号禁止删除
/// </summary>
[Description("系统默认账号禁止删除")]
D1029,
/// <summary>
/// 开放接口绑定账号禁止删除
/// </summary>
[Description("开放接口绑定账号禁止删除")]
D1030,
/// <summary>
/// 开放接口绑定租户禁止删除
/// </summary>
[Description("开放接口绑定租户禁止删除")]
D1031,
/// <summary>
/// 手机号已存在
/// </summary>
[Description("手机号已存在")]
D1032,
/// <summary>
/// 此角色下存在注册方案禁止删除
/// </summary>
[Description("此角色下存在注册方案禁止删除")]
D1033,
/// <summary>
/// 注册功能未开启禁止注册
/// </summary>
[Description("注册功能未开启禁止注册")]
D1034,
/// <summary>
/// 注册方案不存在
/// </summary>
[Description("注册方案不存在")]
D1035,
/// <summary>
/// 角色不存在
/// </summary>
[Description("角色不存在")]
D1036,
/// <summary>
/// 禁止注册超级管理员和系统管理员
/// </summary>
[Description("禁止注册超级管理员和系统管理员")]
D1037,
/// <summary>
/// 禁止越权操作系统账户
/// </summary>
[Description("禁止越权操作系统账户")]
D1038,
/// <summary>
/// 父机构不存在
/// </summary>
[Description("父机构不存在")]
D2000,
/// <summary>
/// 当前机构Id不能与父机构Id相同
/// </summary>
[Description("当前机构Id不能与父机构Id相同")]
D2001,
/// <summary>
/// 已有相同组织机构,编码或名称相同
/// </summary>
[Description("已有相同组织机构,编码或名称相同")]
D2002,
/// <summary>
/// 没有权限操作机构
/// </summary>
[Description("没有权限操作机构")]
D2003,
/// <summary>
/// 该机构下有用户禁止删除
/// </summary>
[Description("该机构下有用户禁止删除")]
D2004,
/// <summary>
/// 附属机构下有用户禁止删除
/// </summary>
[Description("附属机构下有用户禁止删除")]
D2005,
/// <summary>
/// 只能增加下级机构
/// </summary>
[Description("只能增加下级机构")]
D2006,
/// <summary>
/// 下级机构下有用户禁止删除
/// </summary>
[Description("下级机构下有用户禁止删除")]
D2007,
/// <summary>
/// 系统默认机构禁止删除
/// </summary>
[Description("系统默认机构禁止删除")]
D2008,
/// <summary>
/// 禁止增加根节点机构
/// </summary>
[Description("禁止增加根节点机构")]
D2009,
/// <summary>
/// 此机构下存在注册方案禁止删除
/// </summary>
[Description("此机构下存在注册方案禁止删除")]
D2010,
/// <summary>
/// 机构不存在
/// </summary>
[Description("机构不存在")]
D2011,
/// <summary>
/// 系统默认机构禁止修改
/// </summary>
[Description("系统默认机构禁止修改")]
D2012,
/// <summary>
/// 字典类型不存在
/// </summary>
[Description("字典类型不存在")]
D3000,
/// <summary>
/// 字典类型已存在
/// </summary>
[Description("字典类型已存在,名称或编码重复")]
D3001,
/// <summary>
/// 字典类型下面有字典值禁止删除
/// </summary>
[Description("字典类型下面有字典值禁止删除")]
D3002,
/// <summary>
/// 字典值已存在
/// </summary>
[Description("字典值已存在")]
D3003,
/// <summary>
/// 字典值不存在
/// </summary>
[Description("字典值不存在")]
D3004,
/// <summary>
/// 字典状态错误
/// </summary>
[Description("字典状态错误")]
D3005,
/// <summary>
/// 字典编码不能以Enum结尾
/// </summary>
[Description("字典编码不能以Enum结尾")]
D3006,
/// <summary>
/// 禁止修改枚举类型的字典编码
/// </summary>
[Description("禁止修改枚举类型的字典编码")]
D3007,
/// <summary>
/// 禁止迁移枚举字典
/// </summary>
[Description("禁止迁移枚举字典")]
D3008,
/// <summary>
/// 字典已在该租户禁止迁移
/// </summary>
[Description("字典已在该租户禁止迁移")]
D3009,
/// <summary>
/// 非超管用户禁止操作系统字典
/// </summary>
[Description("非超管用户禁止操作系统字典")]
D3010,
/// <summary>
/// 获取字典值集合入参有误
/// </summary>
[Description("获取字典值集合入参有误")]
D3011,
/// <summary>
/// 禁止修改租户字典状态
/// </summary>
[Description("禁止修改租户字典状态")]
D3012,
/// <summary>
/// 菜单已存在
/// </summary>
[Description("菜单已存在")]
D4000,
/// <summary>
/// 路由地址为空
/// </summary>
[Description("路由地址为空")]
D4001,
/// <summary>
/// 打开方式为空
/// </summary>
[Description("打开方式为空")]
D4002,
/// <summary>
/// 权限标识格式为空
/// </summary>
[Description("权限标识格式为空")]
D4003,
/// <summary>
/// 权限标识格式错误
/// </summary>
[Description("权限标识格式错误 如xxx:xxx")]
D4004,
/// <summary>
/// 权限不存在
/// </summary>
[Description("权限不存在")]
D4005,
/// <summary>
/// 父级菜单不能为当前节点,请重新选择父级菜单
/// </summary>
[Description("父级菜单不能为当前节点,请重新选择父级菜单")]
D4006,
/// <summary>
/// 不能移动根节点
/// </summary>
[Description("不能移动根节点")]
D4007,
/// <summary>
/// 禁止本节点与父节点相同
/// </summary>
[Description("禁止本节点与父节点相同")]
D4008,
/// <summary>
/// 路由名称重复
/// </summary>
[Description("路由名称重复")]
D4009,
/// <summary>
/// 父节点不能为按钮类型
/// </summary>
[Description("父节点不能为按钮类型")]
D4010,
/// <summary>
/// 租户不能为空
/// </summary>
[Description("租户不能为空")]
D4011,
/// <summary>
/// 系统菜单禁止修改
/// </summary>
[Description("系统菜单禁止修改")]
D4012,
/// <summary>
/// 系统菜单禁止删除
/// </summary>
[Description("系统菜单禁止删除")]
D4013,
/// <summary>
/// 已存在同名或同编码应用
/// </summary>
[Description("已存在同名或同编码应用")]
D5000,
/// <summary>
/// 默认激活系统只能有一个
/// </summary>
[Description("默认激活系统只能有一个")]
D5001,
/// <summary>
/// 该应用下有菜单禁止删除
/// </summary>
[Description("该应用下有菜单禁止删除")]
D5002,
/// <summary>
/// 已存在同名或同编码应用
/// </summary>
[Description("已存在同名或同编码应用")]
D5003,
/// <summary>
/// 已存在同名或同编码职位
/// </summary>
[Description("已存在同名或同编码职位")]
D6000,
/// <summary>
/// 该职位下有用户禁止删除
/// </summary>
[Description("该职位下有用户禁止删除")]
D6001,
/// <summary>
/// 无权修改本职位
/// </summary>
[Description("无权修改本职位")]
D6002,
/// <summary>
/// 职位不存在
/// </summary>
[Description("职位不存在")]
D6003,
/// <summary>
/// 此职位下存在注册方案禁止删除
/// </summary>
[Description("此职位下存在注册方案禁止删除")]
D6004,
/// <summary>
/// 通知公告状态错误
/// </summary>
[Description("通知公告状态错误")]
D7000,
/// <summary>
/// 通知公告删除失败
/// </summary>
[Description("通知公告删除失败")]
D7001,
/// <summary>
/// 通知公告编辑失败
/// </summary>
[Description("通知公告编辑失败,类型必须为草稿")]
D7002,
/// <summary>
/// 通知公告操作失败,非发布者不能进行操作
/// </summary>
[Description("通知公告操作失败,非发布者不能进行操作")]
D7003,
/// <summary>
/// 文件不存在
/// </summary>
[Description("文件不存在")]
D8000,
/// <summary>
/// 不允许的文件类型
/// </summary>
[Description("不允许的文件类型")]
D8001,
/// <summary>
/// 文件超过允许大小
/// </summary>
[Description("文件超过允许大小")]
D8002,
/// <summary>
/// 文件后缀错误
/// </summary>
[Description("文件后缀错误")]
D8003,
/// <summary>
/// 文件已存在
/// </summary>
[Description("文件已存在")]
D8004,
/// <summary>
/// 无效的文件名
/// </summary>
[Description("无效的文件名")]
D8005,
/// <summary>
/// 已存在同名或同编码参数配置
/// </summary>
[Description("已存在同名或同编码参数配置")]
D9000,
/// <summary>
/// 禁止删除系统参数
/// </summary>
[Description("禁止删除系统参数")]
D9001,
/// <summary>
/// 已存在同名任务调度
/// </summary>
[Description("已存在同名任务调度")]
D1100,
/// <summary>
/// 任务调度不存在
/// </summary>
[Description("任务调度不存在")]
D1101,
/// <summary>
/// 演示环境禁止修改数据
/// </summary>
[Description("演示环境禁止修改数据")]
D1200,
/// <summary>
/// 已存在同名的租户
/// </summary>
[Description("已存在同名的租户")]
D1300,
/// <summary>
/// 已存在同名的租户管理员
/// </summary>
[Description("已存在同名的租户管理员")]
D1301,
/// <summary>
/// 租户从库配置错误
/// </summary>
[Description("租户从库配置错误")]
D1302,
/// <summary>
/// 已存在同名的租户域名
/// </summary>
[Description("已存在同名的租户域名")]
D1303,
/// <summary>
/// 授权菜单存在重复项
/// </summary>
[Description("授权菜单存在重复项")]
D1304,
/// <summary>
/// 该表代码模板已经生成过
/// </summary>
[Description("该表代码模板已经生成过")]
D1400,
/// <summary>
/// 数据库配置不存在
/// </summary>
[Description("数据库配置不存在")]
D1401,
/// <summary>
/// 该类型不存在
/// </summary>
[Description("该类型不存在")]
D1501,
/// <summary>
/// 该字段不存在
/// </summary>
[Description("该字段不存在")]
D1502,
/// <summary>
/// 该类型不是枚举类型
/// </summary>
[Description("该类型不是枚举类型")]
D1503,
/// <summary>
/// 该实体不存在
/// </summary>
[Description("该实体不存在")]
D1504,
/// <summary>
/// 父菜单不存在
/// </summary>
[Description("父菜单不存在")]
D1505,
/// <summary>
/// 父资源不存在
/// </summary>
[Description("父资源不存在")]
D1600,
/// <summary>
/// 当前资源Id不能与父资源Id相同
/// </summary>
[Description("当前资源Id不能与父资源Id相同")]
D1601,
/// <summary>
/// 已有相同编码或名称
/// </summary>
[Description("已有相同编码或名称")]
D1602,
/// <summary>
/// 脚本代码不能为空
/// </summary>
[Description("脚本代码不能为空")]
D1701,
/// <summary>
/// 脚本代码中的作业类,需要定义 [JobDetail] 特性
/// </summary>
[Description("脚本代码中的作业类,需要定义 [JobDetail] ")]
D1702,
/// <summary>
/// 作业编号需要与脚本代码中的作业类 [JobDetail('jobId')] 一致
/// </summary>
[Description("作业编号需要与脚本代码中的作业类 [JobDetail('jobId')] ")]
D1703,
/// <summary>
/// 禁止修改作业编号
/// </summary>
[Description("禁止修改作业编号")]
D1704,
/// <summary>
/// 执行作业失败
/// </summary>
[Description("执行作业失败")]
D1705,
/// <summary>
/// 已存在同名打印模板
/// </summary>
[Description("已存在同名打印模板")]
D1800,
/// <summary>
/// 已存在同名功能或同名程序及插件
/// </summary>
[Description("已存在同名功能或同名程序及插件")]
D1900,
/// <summary>
/// 注册方案名称已存在
/// </summary>
[Description("注册方案名称已存在")]
D2101,
/// <summary>
/// 已存在同名模板
/// </summary>
[Description("已存在同名模板")]
T1000,
/// <summary>
/// 已存在相同编码模板
/// </summary>
[Description("已存在相同编码模板")]
T1001,
/// <summary>
/// 禁止删除存在关联租户的应用
/// </summary>
[Description("禁止删除存在关联租户的应用")]
A1001,
/// <summary>
/// 禁止删除存在关联菜单的应用
/// </summary>
[Description("禁止删除存在关联菜单的应用")]
A1002,
/// <summary>
/// 找不到系统应用
/// </summary>
[Description("找不到系统应用")]
A1000,
/// <summary>
/// 已存在同名或同编码项目
/// </summary>
[Description("已存在同名或同编码项目")]
xg1000,
/// <summary>
/// 已存在相同证件号码人员
/// </summary>
[Description("已存在相同证件号码人员")]
xg1001,
/// <summary>
/// 检测数据不存在
/// </summary>
[Description("检测数据不存在")]
xg1002,
/// <summary>
/// 请添加数据列
/// </summary>
[Description("请添加数据列")]
db1000,
/// <summary>
/// 数据表不存在
/// </summary>
[Description("数据表不存在")]
db1001,
/// <summary>
/// 数据表不存在
/// </summary>
[Description("不允许添加相同字段名")]
db1002,
/// <summary>
/// 实体文件不存在或匹配不到。如果是刚刚生成的实体,请重启服务后再试
/// </summary>
[Description("实体文件不存在或匹配不到。如果是刚刚生成的实体,请重启服务后再试")]
db1003,
/// <summary>
/// 父节点不存在
/// </summary>
[Description("父节点不存在")]
R2000,
/// <summary>
/// 当前节点Id不能与父节点Id相同
/// </summary>
[Description("当前节点Id不能与父节点Id相同")]
R2001,
/// <summary>
/// 已有相同编码或名称
/// </summary>
[Description("已有相同编码或名称")]
R2002,
/// <summary>
/// 行政区代码只能为6、9或12位
/// </summary>
[Description("行政区代码只能为6、9或12位")]
R2003,
/// <summary>
/// 父节点不能为自己的子节点
/// </summary>
[Description("父节点不能为自己的子节点")]
R2004,
/// <summary>
/// 同步国家统计局数据异常,请稍后重试
/// </summary>
[Description("同步国家统计局数据异常,请稍后重试")]
R2005,
/// <summary>
/// 默认租户状态禁止修改
/// </summary>
[Description("默认租户状态禁止修改")]
Z1001,
/// <summary>
/// 禁止创建此类型的数据库
/// </summary>
[Description("禁止创建此类型的数据库")]
Z1002,
/// <summary>
/// 租户不存在或已禁用
/// </summary>
[Description("租户不存在或已禁用")]
Z1003,
/// <summary>
/// 租户库连接不能为空
/// </summary>
[Description("租户库连接不能为空")]
Z1004,
/// <summary>
/// 身份标识已存在
/// </summary>
[Description("身份标识已存在")]
O1000,
/// <summary>
/// 禁止非超级管理员操作
/// </summary>
[Description("禁止非超级管理员操作")]
SA001
}

View File

@@ -0,0 +1,32 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace YY.Admin.Core;
/// <summary>
/// 过滤条件
/// </summary>
[Description("过滤条件")]
public enum FilterLogicEnum
{
/// <summary>
/// 并且
/// </summary>
[Description("并且")]
And,
/// <summary>
/// 或者
/// </summary>
[Description("或者")]
Or,
/// <summary>
/// 异或
/// </summary>
[Description("异或")]
Xor
}

View File

@@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.ComponentModel;
namespace YY.Admin.Core
{
/// <summary>
/// 筛选操作方式
/// </summary>
public enum FilterOperateEnum
{
/// <summary>
/// 并且
/// </summary>
[OperateCode("and")]
[Description("并且")]
And = 1,
/// <summary>
/// 或者
/// </summary>
[OperateCode("or")]
[Description("或者")]
Or = 2,
/// <summary>
/// 等于
/// </summary>
[OperateCode("equal")]
[Description("等于")]
Equal = 3,
/// <summary>
/// 不等于
/// </summary>
[OperateCode("notequal")]
[Description("不等于")]
NotEqual = 4,
/// <summary>
/// 小于
/// </summary>
[OperateCode("less")]
[Description("小于")]
Less = 5,
/// <summary>
/// 小于或等于
/// </summary>
[OperateCode("lessorequal")]
[Description("小于等于")]
LessOrEqual = 6,
/// <summary>
/// 大于
/// </summary>
[OperateCode("greater")]
[Description("大于")]
Greater = 7,
/// <summary>
/// 大于或等于
/// </summary>
[OperateCode("greaterorequal")]
[Description("大于等于")]
GreaterOrEqual = 8,
/// <summary>
/// 以……开始
/// </summary>
[OperateCode("startswith")]
[Description("开始于")]
StartsWith = 9,
/// <summary>
/// 以……结束
/// </summary>
[OperateCode("endswith")]
[Description("结束于")]
EndsWith = 10,
/// <summary>
/// 字符串的包含(相似)
/// </summary>
[OperateCode("contains")]
[Description("包含")]
Contains = 11,
/// <summary>
/// 字符串的不包含
/// </summary>
[OperateCode("notcontains")]
[Description("不包含")]
NotContains = 12
}
}

View File

@@ -0,0 +1,68 @@
// Admin.NET 项目的版权、商标、专利和其他相关权利均受相应法律法规的保护。使用本项目应遵守相关法律法规和许可证的要求。
//
// 本项目主要遵循 MIT 许可证和 Apache 许可证(版本 2.0)进行分发和使用。许可证位于源代码树根目录中的 LICENSE-MIT 和 LICENSE-APACHE 文件。
//
// 不得利用本项目从事危害国家安全、扰乱社会秩序、侵犯他人合法权益等法律法规禁止的活动!任何基于本项目二次开发而产生的一切法律纠纷和责任,我们不承担任何责任!
namespace YY.Admin.Core;
/// <summary>
/// 过滤逻辑运算符
/// </summary>
[Description("过滤逻辑运算符")]
public enum FilterOperatorEnum
{
/// <summary>
/// 等于(=)
/// </summary>
[Description("等于")]
EQ,
/// <summary>
/// 不等于(!=)
/// </summary>
[Description("不等于")]
NEQ,
/// <summary>
/// 小于<![CDATA[ < ]]>
/// </summary>
[Description("小于")]
LT,
/// <summary>
/// 小于等于<![CDATA[ <= ]]>
/// </summary>
[Description("小于等于")]
LTE,
/// <summary>
/// 大于(>)
/// </summary>
[Description("大于")]
GT,
/// <summary>
/// 大于等于(>=)
/// </summary>
[Description("大于等于")]
GTE,
/// <summary>
/// 开始包含
/// </summary>
[Description("开始包含")]
StartsWith,
/// <summary>
/// 末尾包含
/// </summary>
[Description("末尾包含")]
EndsWith,
/// <summary>
/// 包含
/// </summary>
[Description("包含")]
Contains
}

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