init commit
This commit is contained in:
19
20220330_Vote/Ewide.Core/Attributes/OpAttribute.cs
Normal file
19
20220330_Vote/Ewide.Core/Attributes/OpAttribute.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Attributes
|
||||
{
|
||||
public class OpAttribute : Attribute
|
||||
{
|
||||
private readonly LogOpType logOpType;
|
||||
public OpAttribute(LogOpType logOpType)
|
||||
{
|
||||
this.logOpType = logOpType;
|
||||
}
|
||||
public int OpType { get => (int)logOpType; }
|
||||
//测试修改
|
||||
}
|
||||
}
|
||||
33
20220330_Vote/Ewide.Core/Cache/CacheOptions.cs
Normal file
33
20220330_Vote/Ewide.Core/Cache/CacheOptions.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using Furion.ConfigurableOptions;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存配置
|
||||
/// </summary>
|
||||
public class CacheOptions : IConfigurableOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存类型
|
||||
/// </summary>
|
||||
public CacheType CacheType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Redis配置
|
||||
/// </summary>
|
||||
public string RedisConnectionString { get; set; }
|
||||
}
|
||||
|
||||
public enum CacheType
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存缓存
|
||||
/// </summary>
|
||||
MemoryCache,
|
||||
|
||||
/// <summary>
|
||||
/// Redis缓存
|
||||
/// </summary>
|
||||
RedisCache
|
||||
}
|
||||
}
|
||||
107
20220330_Vote/Ewide.Core/Cache/ICache.cs
Normal file
107
20220330_Vote/Ewide.Core/Cache/ICache.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 缓存接口
|
||||
/// </summary>
|
||||
public interface ICache
|
||||
{
|
||||
/// <summary>
|
||||
/// 用于在 key 存在时删除 key
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
long Del(params string[] key);
|
||||
|
||||
/// <summary>
|
||||
/// 用于在 key 存在时删除 key
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
Task<long> DelAsync(params string[] key);
|
||||
|
||||
/// <summary>
|
||||
/// 用于在 key 模板存在时删除
|
||||
/// </summary>
|
||||
/// <param name="pattern">key模板</param>
|
||||
/// <returns></returns>
|
||||
Task<long> DelByPatternAsync(string pattern);
|
||||
|
||||
/// <summary>
|
||||
/// 检查给定 key 是否存在
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
bool Exists(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 检查给定 key 是否存在
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> ExistsAsync(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定 key 的值
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
string Get(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定 key 的值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">byte[] 或其他类型</typeparam>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
T Get<T>(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定 key 的值
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetAsync(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定 key 的值
|
||||
/// </summary>
|
||||
/// <typeparam name="T">byte[] 或其他类型</typeparam>
|
||||
/// <param name="key">键</param>
|
||||
/// <returns></returns>
|
||||
Task<T> GetAsync<T>(string key);
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="value">值</param>
|
||||
bool Set(string key, object value);
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="value">值</param>
|
||||
/// <param name="expire">有效期</param>
|
||||
bool Set(string key, object value, TimeSpan expire);
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="value">值</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> SetAsync(string key, object value);
|
||||
|
||||
/// <summary>
|
||||
/// 设置指定 key 的值,所有写入参数object都支持string | byte[] | 数值 | 对象
|
||||
/// </summary>
|
||||
/// <param name="key">键</param>
|
||||
/// <param name="value">值</param>
|
||||
/// <param name="expire">有效期</param>
|
||||
/// <returns></returns>
|
||||
Task<bool> SetAsync(string key, object value, TimeSpan expire);
|
||||
}
|
||||
}
|
||||
125
20220330_Vote/Ewide.Core/Cache/MemoryCache.cs
Normal file
125
20220330_Vote/Ewide.Core/Cache/MemoryCache.cs
Normal file
@@ -0,0 +1,125 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Furion.DependencyInjection;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 内存缓存
|
||||
/// </summary>
|
||||
public class MemoryCache : ICache, ISingleton
|
||||
{
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
|
||||
public MemoryCache(IMemoryCache memoryCache)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
}
|
||||
|
||||
public long Del(params string[] key)
|
||||
{
|
||||
foreach (var k in key)
|
||||
{
|
||||
_memoryCache.Remove(k);
|
||||
}
|
||||
return key.Length;
|
||||
}
|
||||
|
||||
public Task<long> DelAsync(params string[] key)
|
||||
{
|
||||
foreach (var k in key)
|
||||
{
|
||||
_memoryCache.Remove(k);
|
||||
}
|
||||
|
||||
return Task.FromResult((long)key.Length);
|
||||
}
|
||||
|
||||
public async Task<long> DelByPatternAsync(string pattern)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pattern))
|
||||
return default;
|
||||
|
||||
//pattern = Regex.Replace(pattern, @"\{*.\}", "(.*)");
|
||||
var keys = GetAllKeys().Where(k => k.StartsWith(pattern));
|
||||
if (keys != null && keys.Any())
|
||||
return await DelAsync(keys.ToArray());
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public bool Exists(string key)
|
||||
{
|
||||
return _memoryCache.TryGetValue(key, out _);
|
||||
}
|
||||
|
||||
public Task<bool> ExistsAsync(string key)
|
||||
{
|
||||
return Task.FromResult(_memoryCache.TryGetValue(key, out _));
|
||||
}
|
||||
|
||||
public string Get(string key)
|
||||
{
|
||||
return _memoryCache.Get(key)?.ToString();
|
||||
}
|
||||
|
||||
public T Get<T>(string key)
|
||||
{
|
||||
return _memoryCache.Get<T>(key);
|
||||
}
|
||||
|
||||
public Task<string> GetAsync(string key)
|
||||
{
|
||||
return Task.FromResult(Get(key));
|
||||
}
|
||||
|
||||
public Task<T> GetAsync<T>(string key)
|
||||
{
|
||||
return Task.FromResult(Get<T>(key));
|
||||
}
|
||||
|
||||
public bool Set(string key, object value)
|
||||
{
|
||||
_memoryCache.Set(key, value);
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Set(string key, object value, TimeSpan expire)
|
||||
{
|
||||
_memoryCache.Set(key, value, expire);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Task<bool> SetAsync(string key, object value)
|
||||
{
|
||||
Set(key, value);
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
public Task<bool> SetAsync(string key, object value, TimeSpan expire)
|
||||
{
|
||||
Set(key, value, expire);
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
private List<string> GetAllKeys()
|
||||
{
|
||||
const BindingFlags flags = BindingFlags.Instance | BindingFlags.NonPublic;
|
||||
var entries = _memoryCache.GetType().GetField("_entries", flags).GetValue(_memoryCache);
|
||||
var cacheItems = entries.GetType().GetProperty("Keys").GetValue(entries) as ICollection<object>; //entries as IDictionary;
|
||||
var keys = new List<string>();
|
||||
if (cacheItems == null) return keys;
|
||||
return cacheItems.Select(u => u.ToString()).ToList();
|
||||
//foreach (DictionaryEntry cacheItem in cacheItems)
|
||||
//{
|
||||
// keys.Add(cacheItem.Key.ToString());
|
||||
//}
|
||||
//return keys;
|
||||
}
|
||||
}
|
||||
}
|
||||
95
20220330_Vote/Ewide.Core/Cache/RedisCache.cs
Normal file
95
20220330_Vote/Ewide.Core/Cache/RedisCache.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using Furion.DependencyInjection;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Redis缓存
|
||||
/// </summary>
|
||||
public class RedisCache : ICache, ISingleton
|
||||
{
|
||||
public RedisCache(IOptions<CacheOptions> cacheOptions)
|
||||
{
|
||||
var csredis = new CSRedis.CSRedisClient(cacheOptions.Value.RedisConnectionString);
|
||||
RedisHelper.Initialization(csredis);
|
||||
}
|
||||
|
||||
public long Del(params string[] key)
|
||||
{
|
||||
return RedisHelper.Del(key);
|
||||
}
|
||||
|
||||
public Task<long> DelAsync(params string[] key)
|
||||
{
|
||||
return RedisHelper.DelAsync(key);
|
||||
}
|
||||
|
||||
public async Task<long> DelByPatternAsync(string pattern)
|
||||
{
|
||||
if (string.IsNullOrEmpty(pattern))
|
||||
return default;
|
||||
|
||||
//pattern = Regex.Replace(pattern, @"\{.*\}", "*");
|
||||
var keys = (await RedisHelper.KeysAsync(pattern));
|
||||
if (keys != null && keys.Length > 0)
|
||||
{
|
||||
return await RedisHelper.DelAsync(keys);
|
||||
}
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
public bool Exists(string key)
|
||||
{
|
||||
return RedisHelper.Exists(key);
|
||||
}
|
||||
|
||||
public Task<bool> ExistsAsync(string key)
|
||||
{
|
||||
return RedisHelper.ExistsAsync(key);
|
||||
}
|
||||
|
||||
public string Get(string key)
|
||||
{
|
||||
return RedisHelper.Get(key);
|
||||
}
|
||||
|
||||
public T Get<T>(string key)
|
||||
{
|
||||
return RedisHelper.Get<T>(key);
|
||||
}
|
||||
|
||||
public Task<string> GetAsync(string key)
|
||||
{
|
||||
return RedisHelper.GetAsync(key);
|
||||
}
|
||||
|
||||
public Task<T> GetAsync<T>(string key)
|
||||
{
|
||||
return RedisHelper.GetAsync<T>(key);
|
||||
}
|
||||
|
||||
public bool Set(string key, object value)
|
||||
{
|
||||
return RedisHelper.Set(key, value);
|
||||
}
|
||||
|
||||
public bool Set(string key, object value, TimeSpan expire)
|
||||
{
|
||||
return RedisHelper.Set(key, value, expire);
|
||||
}
|
||||
|
||||
public Task<bool> SetAsync(string key, object value)
|
||||
{
|
||||
return RedisHelper.SetAsync(key, value);
|
||||
}
|
||||
|
||||
public Task<bool> SetAsync(string key, object value, TimeSpan expire)
|
||||
{
|
||||
return RedisHelper.SetAsync(key, value, expire);
|
||||
}
|
||||
}
|
||||
}
|
||||
227
20220330_Vote/Ewide.Core/Captcha/ClickWord/ClickWordCaptcha.cs
Normal file
227
20220330_Vote/Ewide.Core/Captcha/ClickWord/ClickWordCaptcha.cs
Normal file
@@ -0,0 +1,227 @@
|
||||
using Furion;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.DistributedIDGenerator;
|
||||
using Furion.JsonSerialization;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 点选验证码
|
||||
/// </summary>
|
||||
public class ClickWordCaptcha : IClickWordCaptcha, ITransient
|
||||
{
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
|
||||
public ClickWordCaptcha(IMemoryCache memoryCache)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成验证码图片
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="width"></param>
|
||||
/// <param name="height"></param>
|
||||
/// <returns></returns>
|
||||
public ClickWordCaptchaResult CreateCaptchaImage(string code, int width, int height)
|
||||
{
|
||||
var rtnResult = new ClickWordCaptchaResult();
|
||||
|
||||
// 变化点: 3个字
|
||||
int rightCodeLength = 3;
|
||||
|
||||
Bitmap bitmap = null;
|
||||
Graphics g = null;
|
||||
MemoryStream ms = null;
|
||||
Random random = new Random();
|
||||
|
||||
Color[] colorArray = { Color.Black, Color.DarkBlue, Color.Green, Color.Orange, Color.Brown, Color.DarkCyan, Color.Purple };
|
||||
|
||||
string bgImagesDir = Path.Combine(App.WebHostEnvironment.WebRootPath, "Captcha/Image");
|
||||
string[] bgImagesFiles = Directory.GetFiles(bgImagesDir);
|
||||
//if (bgImagesFiles == null || bgImagesFiles.Length == 0)
|
||||
// throw Oops.Oh("背景图片文件丢失");
|
||||
|
||||
// 字体来自:https://www.zcool.com.cn/special/zcoolfonts/
|
||||
string fontsDir = Path.Combine(App.WebHostEnvironment.WebRootPath, "Captcha/Font");
|
||||
string[] fontFiles = new DirectoryInfo(fontsDir)?.GetFiles()
|
||||
?.Where(m => m.Extension.ToLower() == ".ttf")
|
||||
?.Select(m => m.FullName).ToArray();
|
||||
//if (fontFiles == null || fontFiles.Length == 0)
|
||||
// throw Oops.Oh("字体文件丢失");
|
||||
|
||||
int imgIndex = random.Next(bgImagesFiles.Length);
|
||||
string randomImgFile = bgImagesFiles[imgIndex];
|
||||
var imageStream = Image.FromFile(randomImgFile);
|
||||
|
||||
bitmap = new Bitmap(imageStream, width, height);
|
||||
imageStream.Dispose();
|
||||
g = Graphics.FromImage(bitmap);
|
||||
Color[] penColor = { Color.Red, Color.Green, Color.Blue };
|
||||
int code_length = code.Length;
|
||||
List<string> words = new List<string>();
|
||||
for (int i = 0; i < code_length; i++)
|
||||
{
|
||||
int colorIndex = random.Next(colorArray.Length);
|
||||
int fontIndex = random.Next(fontFiles.Length);
|
||||
Font f = LoadFont(fontFiles[fontIndex], 15, FontStyle.Regular);
|
||||
Brush b = new SolidBrush(colorArray[colorIndex]);
|
||||
int _y = random.Next(height);
|
||||
if (_y > (height - 30))
|
||||
_y = _y - 60;
|
||||
|
||||
int _x = width / (i + 1);
|
||||
if ((width - _x) < 50)
|
||||
{
|
||||
_x = width - 60;
|
||||
}
|
||||
string word = code.Substring(i, 1);
|
||||
if (rtnResult.repData.point.Count < rightCodeLength)
|
||||
{
|
||||
// (int, int) percentPos = ToPercentPos((width, height), (_x, _y));
|
||||
// 添加正确答案 位置数据
|
||||
rtnResult.repData.point.Add(new PointPosModel()
|
||||
{
|
||||
X = _x, //percentPos.Item1,
|
||||
Y = _y //percentPos.Item2,
|
||||
});
|
||||
words.Add(word);
|
||||
}
|
||||
g.DrawString(word, f, b, _x, _y);
|
||||
}
|
||||
rtnResult.repData.wordList = words;
|
||||
|
||||
ms = new MemoryStream();
|
||||
bitmap.Save(ms, ImageFormat.Jpeg);
|
||||
g.Dispose();
|
||||
bitmap.Dispose();
|
||||
ms.Dispose();
|
||||
rtnResult.repData.originalImageBase64 = Convert.ToBase64String(ms.GetBuffer()); //"data:image/jpg;base64," +
|
||||
rtnResult.repData.token = IDGen.NextID().ToString();
|
||||
|
||||
// 缓存验证码正确位置集合
|
||||
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(30));
|
||||
_memoryCache.Set(CommonConst.CACHE_KEY_CODE + rtnResult.repData.token, rtnResult.repData.point, cacheOptions);
|
||||
|
||||
rtnResult.repData.point = null; // 清空位置信息
|
||||
return rtnResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 转换为相对于图片的百分比单位
|
||||
/// </summary>
|
||||
/// <param name="widthAndHeight">图片宽高</param>
|
||||
/// <param name="xAndy">相对于图片的绝对尺寸</param>
|
||||
/// <returns>(int:xPercent, int:yPercent)</returns>
|
||||
private (int, int) ToPercentPos((int, int) widthAndHeight, (int, int) xAndy)
|
||||
{
|
||||
(int, int) rtnResult = (0, 0);
|
||||
// 注意: int / int = int (小数部分会被截断)
|
||||
rtnResult.Item1 = (int)(((double)xAndy.Item1) / ((double)widthAndHeight.Item1) * 100);
|
||||
rtnResult.Item2 = (int)(((double)xAndy.Item2) / ((double)widthAndHeight.Item2) * 100);
|
||||
|
||||
return rtnResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载字体
|
||||
/// </summary>
|
||||
/// <param name="path">字体文件路径,包含字体文件名和后缀名</param>
|
||||
/// <param name="size">大小</param>
|
||||
/// <param name="fontStyle">字形(常规/粗体/斜体/粗斜体)</param>
|
||||
private Font LoadFont(string path, int size, FontStyle fontStyle)
|
||||
{
|
||||
var pfc = new System.Drawing.Text.PrivateFontCollection();
|
||||
pfc.AddFontFile(path);// 字体文件路径
|
||||
Font myFont = new Font(pfc.Families[0], size, fontStyle);
|
||||
return myFont;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 随机绘制字符串
|
||||
/// </summary>
|
||||
/// <param name="number"></param>
|
||||
/// <returns></returns>
|
||||
public string RandomCode(int number)
|
||||
{
|
||||
var str = "左怀军天地玄黄宇宙洪荒日月盈昃辰宿列张寒来暑往秋收冬藏闰余成岁律吕调阳云腾致雨露结为霜金生丽水玉出昆冈剑号巨阙珠称夜光果珍李柰菜重芥姜海咸河淡鳞潜羽翔龙师火帝鸟官人皇始制文字乃服衣裳推位让国有虞陶唐吊民伐罪周发殷汤坐朝问道垂拱平章爱育黎首臣伏戎羌遐迩体率宾归王";
|
||||
char[] str_char_arrary = str.ToArray();
|
||||
Random rand = new Random();
|
||||
HashSet<string> hs = new HashSet<string>();
|
||||
bool randomBool = true;
|
||||
while (randomBool)
|
||||
{
|
||||
if (hs.Count == number)
|
||||
break;
|
||||
int rand_number = rand.Next(str_char_arrary.Length);
|
||||
hs.Add(str_char_arrary[rand_number].ToString());
|
||||
}
|
||||
return string.Join("", hs);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证码验证
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public dynamic CheckCode(ClickWordCaptchaInput input)
|
||||
{
|
||||
var res = new ClickWordCaptchaResult();
|
||||
|
||||
var rightVCodePos = _memoryCache.Get(CommonConst.CACHE_KEY_CODE + input.Token) as List<PointPosModel>;
|
||||
if (rightVCodePos == null)
|
||||
{
|
||||
res.repCode = "6110";
|
||||
res.repMsg = "验证码已失效,请重新获取";
|
||||
return res;
|
||||
}
|
||||
|
||||
var userVCodePos = JSON.GetJsonSerializer().Deserialize<List<PointPosModel>>(input.PointJson);
|
||||
if (userVCodePos == null || userVCodePos.Count < rightVCodePos.Count)
|
||||
{
|
||||
res.repCode = "6111";
|
||||
res.repMsg = "验证码无效";
|
||||
return res;
|
||||
}
|
||||
|
||||
int allowOffset = 20; // 允许的偏移量(点触容错)
|
||||
for (int i = 0; i < userVCodePos.Count; i++)
|
||||
{
|
||||
var xOffset = userVCodePos[i].X - rightVCodePos[i].X;
|
||||
var yOffset = userVCodePos[i].Y - rightVCodePos[i].Y;
|
||||
xOffset = Math.Abs(xOffset); // x轴偏移量
|
||||
yOffset = Math.Abs(yOffset); // y轴偏移量
|
||||
// 只要有一个点的任意一个轴偏移量大于allowOffset,则验证不通过
|
||||
if (xOffset > allowOffset || yOffset > allowOffset)
|
||||
{
|
||||
res.repCode = "6112";
|
||||
res.repMsg = "验证码错误";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
_memoryCache.Remove(CommonConst.CACHE_KEY_CODE + input.Token);
|
||||
res.repCode = "0000";
|
||||
res.repMsg = "验证成功";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录正确位置
|
||||
/// </summary>
|
||||
public class PointPosModel
|
||||
{
|
||||
public int X { get; set; }
|
||||
|
||||
public int Y { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Furion.DependencyInjection;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 点击验证码输入参数
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class ClickWordCaptchaInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 验证码类型
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "验证码类型")]
|
||||
public string CaptchaType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 坐标点集合
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "坐标点集合不能为空")]
|
||||
public string PointJson { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token
|
||||
/// </summary>
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using Furion.DependencyInjection;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 验证码输出参数
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class ClickWordCaptchaResult
|
||||
{
|
||||
public string repCode { get; set; } = "0000";
|
||||
public string repMsg { get; set; }
|
||||
public RepData repData { get; set; } = new RepData();
|
||||
public bool error { get; set; }
|
||||
public bool success { get; set; } = true;
|
||||
}
|
||||
|
||||
[SuppressSniffer]
|
||||
public class RepData
|
||||
{
|
||||
public string captchaId { get; set; }
|
||||
public string projectCode { get; set; }
|
||||
public string captchaType { get; set; }
|
||||
public string captchaOriginalPath { get; set; }
|
||||
public string captchaFontType { get; set; }
|
||||
public string captchaFontSize { get; set; }
|
||||
public string secretKey { get; set; }
|
||||
public string originalImageBase64 { get; set; }
|
||||
public List<PointPosModel> point { get; set; } = new List<PointPosModel>();
|
||||
public string jigsawImageBase64 { get; set; }
|
||||
public List<string> wordList { get; set; } = new List<string>();
|
||||
public string pointList { get; set; }
|
||||
public string pointJson { get; set; }
|
||||
public string token { get; set; }
|
||||
public bool result { get; set; }
|
||||
public string captchaVerification { get; set; }
|
||||
}
|
||||
|
||||
[SuppressSniffer]
|
||||
public class WordList
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public interface IClickWordCaptcha
|
||||
{
|
||||
dynamic CheckCode(ClickWordCaptchaInput input);
|
||||
ClickWordCaptchaResult CreateCaptchaImage(string code, int width, int height);
|
||||
string RandomCode(int number);
|
||||
}
|
||||
}
|
||||
130
20220330_Vote/Ewide.Core/Captcha/General/GeneralCaptcha.cs
Normal file
130
20220330_Vote/Ewide.Core/Captcha/General/GeneralCaptcha.cs
Normal file
@@ -0,0 +1,130 @@
|
||||
using Furion.DependencyInjection;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 常规验证码
|
||||
/// </summary>
|
||||
public class GeneralCaptcha : IGeneralCaptcha, ITransient
|
||||
{
|
||||
private readonly IMemoryCache _memoryCache;
|
||||
|
||||
public GeneralCaptcha(IMemoryCache memoryCache)
|
||||
{
|
||||
_memoryCache = memoryCache;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成验证码图片
|
||||
/// </summary>
|
||||
/// <param name="length"></param>
|
||||
/// <returns></returns>
|
||||
public string CreateCaptchaImage(int length = 4)
|
||||
{
|
||||
return Convert.ToBase64String(Draw(length));
|
||||
}
|
||||
|
||||
private string GenerateRandom(int length)
|
||||
{
|
||||
var chars = new StringBuilder();
|
||||
// 验证码的字符集,去掉了一些容易混淆的字符
|
||||
char[] character = { '2', '3', '4', '5', '6', '8', '9', 'a', 'b', 'd', 'e', 'f', 'h', 'k', 'm', 'n', 'r', 'x', 'y', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'R', 'S', 'T', 'W', 'X', 'Y' };
|
||||
Random rnd = new Random();
|
||||
// 生成验证码字符串
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
chars.Append(character[rnd.Next(character.Length)]);
|
||||
}
|
||||
return chars.ToString();
|
||||
}
|
||||
|
||||
private byte[] Draw(int length = 4)
|
||||
{
|
||||
int codeW = 110;
|
||||
int codeH = 36;
|
||||
int fontSize = 22;
|
||||
|
||||
// 颜色列表,用于验证码、噪线、噪点
|
||||
Color[] color = { Color.Black, Color.Red, Color.Blue, Color.Green, Color.Orange, Color.Brown, Color.Brown, Color.DarkBlue };
|
||||
// 字体列表,用于验证码
|
||||
string[] fonts = new[] { "Times New Roman", "Verdana", "Arial", "Gungsuh", "Impact" };
|
||||
|
||||
var code = GenerateRandom(length); // 随机字符串集合
|
||||
|
||||
using (Bitmap bmp = new Bitmap(codeW, codeH))
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
g.Clear(Color.White);
|
||||
Random rnd = new Random();
|
||||
// 画噪线
|
||||
for (int i = 0; i < 1; i++)
|
||||
{
|
||||
int x1 = rnd.Next(codeW);
|
||||
int y1 = rnd.Next(codeH);
|
||||
int x2 = rnd.Next(codeW);
|
||||
int y2 = rnd.Next(codeH);
|
||||
var clr = color[rnd.Next(color.Length)];
|
||||
g.DrawLine(new Pen(clr), x1, y1, x2, y2);
|
||||
}
|
||||
|
||||
// 画验证码字符串
|
||||
string fnt;
|
||||
Font ft;
|
||||
for (int i = 0; i < code.Length; i++)
|
||||
{
|
||||
fnt = fonts[rnd.Next(fonts.Length)];
|
||||
ft = new Font(fnt, fontSize);
|
||||
var clr = color[rnd.Next(color.Length)];
|
||||
g.DrawString(code[i].ToString(), ft, new SolidBrush(clr), (float)i * 24 + 2, (float)0);
|
||||
}
|
||||
|
||||
// 缓存验证码正确集合
|
||||
var cacheOptions = new MemoryCacheEntryOptions().SetSlidingExpiration(TimeSpan.FromSeconds(30));
|
||||
_memoryCache.Set(CommonConst.CACHE_KEY_CODE + Guid.NewGuid().ToString(), code, cacheOptions);
|
||||
|
||||
// 将验证码图片写入内存流
|
||||
bmp.Save(ms, ImageFormat.Png);
|
||||
return ms.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证码验证
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public dynamic CheckCode(GeneralCaptchaInput input)
|
||||
{
|
||||
var res = new ClickWordCaptchaResult();
|
||||
|
||||
var code = _memoryCache.Get(CommonConst.CACHE_KEY_CODE + input.Token);
|
||||
if (code == null)
|
||||
{
|
||||
res.repCode = "6110";
|
||||
res.repMsg = "验证码已失效,请重新获取";
|
||||
return res;
|
||||
}
|
||||
if (input.CaptchaCode != (string)code)
|
||||
{
|
||||
res.repCode = "6112";
|
||||
res.repMsg = "验证码错误";
|
||||
return res;
|
||||
}
|
||||
|
||||
_memoryCache.Remove(CommonConst.CACHE_KEY_CODE + input.Token);
|
||||
res.repCode = "0000";
|
||||
res.repMsg = "验证成功";
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Furion.DependencyInjection;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 常规验证码输入
|
||||
/// </summary>
|
||||
[SuppressSniffer]
|
||||
public class GeneralCaptchaInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 验证码类型
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "验证码类型")]
|
||||
public string CaptchaType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证码字符
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "验证码字符不能为空")]
|
||||
public string CaptchaCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token
|
||||
/// </summary>
|
||||
public string Token { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public interface IGeneralCaptcha
|
||||
{
|
||||
dynamic CheckCode(GeneralCaptchaInput input);
|
||||
string CreateCaptchaImage(int length = 4);
|
||||
}
|
||||
}
|
||||
26
20220330_Vote/Ewide.Core/Const/ClaimConst.cs
Normal file
26
20220330_Vote/Ewide.Core/Const/ClaimConst.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public class ClaimConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
public const string CLAINM_USERID = "UserId";
|
||||
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public const string CLAINM_ACCOUNT = "Account";
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public const string CLAINM_NAME = "Name";
|
||||
|
||||
/// <summary>
|
||||
/// 是否超级管理
|
||||
/// </summary>
|
||||
public const string CLAINM_SUPERADMIN = "SuperAdmin";
|
||||
|
||||
}
|
||||
}
|
||||
49
20220330_Vote/Ewide.Core/Const/CommonConst.cs
Normal file
49
20220330_Vote/Ewide.Core/Const/CommonConst.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public class CommonConst
|
||||
{
|
||||
/// <summary>
|
||||
/// 默认密码
|
||||
/// </summary>
|
||||
public const string DEFAULT_PASSWORD = "123456";
|
||||
|
||||
/// <summary>
|
||||
/// 用户缓存
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_USER = "user_";
|
||||
|
||||
/// <summary>
|
||||
/// 菜单缓存
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_MENU = "menu_";
|
||||
|
||||
/// <summary>
|
||||
/// 权限缓存
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_PERMISSION = "permission_";
|
||||
|
||||
/// <summary>
|
||||
/// 数据范围缓存
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_DATASCOPE = "datascope_";
|
||||
|
||||
/// <summary>
|
||||
/// 验证码缓存
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_CODE = "vercode_";
|
||||
/// <summary>
|
||||
/// 区域缓存
|
||||
/// </summary>
|
||||
public const string CACHE_AREA_CODE = "areaCode";
|
||||
|
||||
/// <summary>
|
||||
/// 所有缓存关键字集合
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_ALL = "allkey";
|
||||
|
||||
/// <summary>
|
||||
/// 定时任务缓存
|
||||
/// </summary>
|
||||
public const string CACHE_KEY_TIMER_JOB = "timerjob";
|
||||
}
|
||||
}
|
||||
91
20220330_Vote/Ewide.Core/Controller/AreaCodeController.cs
Normal file
91
20220330_Vote/Ewide.Core/Controller/AreaCodeController.cs
Normal file
@@ -0,0 +1,91 @@
|
||||
using Ewide.Core.Service;
|
||||
using Ewide.Core.Service.Area;
|
||||
using Ewide.Core.Service.Area.Dto;
|
||||
using Furion.DynamicApiController;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// 区域代码相关服务
|
||||
/// </summary>
|
||||
[ApiDescriptionSettings(Name = "AreaCode", Order = 160)]
|
||||
public class AreaCodeController : IDynamicApiController
|
||||
{
|
||||
private readonly IAreaCodeService _areaCodeService;
|
||||
private readonly IUserManager _userManager;
|
||||
private readonly ISysUserService _sysUserService;
|
||||
public AreaCodeController(IAreaCodeService areaCodeService, IUserManager userManager, ISysUserService sysUserService)
|
||||
{
|
||||
_areaCodeService = areaCodeService;
|
||||
_userManager = userManager;
|
||||
_sysUserService = sysUserService;
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/sysArea/page")]
|
||||
public async Task<dynamic> QueryAreaCodePageList([FromBody] AreaCodeInput input)
|
||||
{
|
||||
return (await _areaCodeService.QueryAreaCodePageList(input));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/sysArea/{code}")]
|
||||
public async Task<AreaCodeOutput> GetAreaCode([FromRoute]string code)
|
||||
{
|
||||
return (await _areaCodeService.GetAreaCode(code)).Adapt<AreaCodeOutput>();
|
||||
}
|
||||
/// <summary>
|
||||
/// 添加区域信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/sysArea/add")]
|
||||
public async Task AddAreaCode(AreaCodeInput input)
|
||||
{
|
||||
await _areaCodeService.AddAreaCode(input);
|
||||
}
|
||||
/// <summary>
|
||||
/// 更新区域信息
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/sysArea/edit")]
|
||||
public async Task UpdateAreaCode(AreaCodeInput input)
|
||||
{
|
||||
await _areaCodeService.UpdateAreaCode(input);
|
||||
}
|
||||
/// <summary>
|
||||
/// 删除区域
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("/sysArea/delete")]
|
||||
public async Task DeleteAreaCode(DeleteAreaCodeInput input)
|
||||
{
|
||||
await _areaCodeService.DeleteAreaCode(input);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取目录树
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet("/sysArea/tree")]
|
||||
public async Task<List<AreaTreeNode>> GetAreaCodeTree([FromQuery]int? level)
|
||||
{
|
||||
return await _areaCodeService.GetAreaCodeTree(level);
|
||||
}
|
||||
}
|
||||
}
|
||||
72
20220330_Vote/Ewide.Core/Entity/DEntityBase.cs
Normal file
72
20220330_Vote/Ewide.Core/Entity/DEntityBase.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 自定义实体基类
|
||||
/// </summary>
|
||||
public abstract class DEntityBase : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键Id
|
||||
/// </summary>
|
||||
[Key]
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Comment("Id主键")]
|
||||
[Column("Id", TypeName = "varchar(36)")]
|
||||
public virtual string Id { get; set; } = String.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
[Comment("创建时间")]
|
||||
public virtual DateTime? CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[Comment("更新时间")]
|
||||
public virtual DateTime? UpdatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者Id
|
||||
/// </summary>
|
||||
[Comment("创建者Id")]
|
||||
[Column("CreatedUserId", TypeName = "varchar(36)")]
|
||||
public virtual string CreatedUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建者名称
|
||||
/// </summary>
|
||||
[Comment("创建者名称")]
|
||||
[MaxLength(20)]
|
||||
public virtual string CreatedUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改者Id
|
||||
/// </summary>
|
||||
[Comment("修改者Id")]
|
||||
[Column("UpdatedUserId", TypeName = "varchar(36)")]
|
||||
public virtual string UpdatedUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 修改者名称
|
||||
/// </summary>
|
||||
[Comment("修改者名称")]
|
||||
[MaxLength(20)]
|
||||
public virtual string UpdatedUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 软删除
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
[Comment("软删除标记")]
|
||||
[Column("IsDeleted", TypeName = "bit")]
|
||||
public virtual bool IsDeleted { get; set; } = false;
|
||||
}
|
||||
}
|
||||
57
20220330_Vote/Ewide.Core/Entity/SysApp.cs
Normal file
57
20220330_Vote/Ewide.Core/Entity/SysApp.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统应用表
|
||||
/// </summary>
|
||||
[Table("sys_app")]
|
||||
[Comment("系统应用表")]
|
||||
public class SysApp : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Comment("图标")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标颜色
|
||||
/// </summary>
|
||||
[Comment("图标颜色")]
|
||||
public string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认激活(Y-是,N-否),只能有一个系统默认激活
|
||||
/// 用户登录后默认展示此系统菜单
|
||||
/// </summary>
|
||||
[Comment("是否默认激活")]
|
||||
[Column("Active", TypeName = "bit")]
|
||||
public bool Active { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
}
|
||||
}
|
||||
83
20220330_Vote/Ewide.Core/Entity/SysAreaCode.cs
Normal file
83
20220330_Vote/Ewide.Core/Entity/SysAreaCode.cs
Normal file
@@ -0,0 +1,83 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
[Table("sys_area_code")]
|
||||
[Comment("区域表")]
|
||||
public class SysAreaCode: IEntity
|
||||
{
|
||||
[Key]
|
||||
[Comment("系统使用的区域编码")]
|
||||
[MaxLength(50)]
|
||||
public string Code { get; set; }
|
||||
[Comment("区域的行政编码")]
|
||||
[MaxLength(50)]
|
||||
public string AdCode { get; set; }
|
||||
|
||||
[Comment("名称")]
|
||||
[Required]
|
||||
[MaxLength(100)]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Comment("备注")]
|
||||
[MaxLength(1000)]
|
||||
public string Note { get; set; }
|
||||
|
||||
[Comment("类别")]
|
||||
[Required]
|
||||
public int LevelType { get; set; }
|
||||
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父节点就是去掉后面两位
|
||||
/// </summary>
|
||||
public string ParentCode => LevelType switch
|
||||
{
|
||||
// 市级 => 没有父级 3302
|
||||
1 => string.Empty,
|
||||
// 区级 => 6位取4位得到市级 330201
|
||||
2 => Code[0..(Code.Length - 2)],
|
||||
// 其他 => 去除后3位得到上级 330201001
|
||||
_ => Code[0..(Code.Length - 3)],
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 多个区域有多个用户绑定自定义数据
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysUser> SysUsers { get; set; }
|
||||
/// <summary>
|
||||
/// 中间表
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysUserArea> SysUserAreas { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多个区域有多个角色绑定权限数据
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysRole> SysRoles { get; set; }
|
||||
/// <summary>
|
||||
/// 中间表
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysRoleArea> SysRoleAreas { get; set; }
|
||||
/// <summary>
|
||||
/// 一个区域有多个组织
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysOrg> SysOrgs { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
49
20220330_Vote/Ewide.Core/Entity/SysCodeGen.cs
Normal file
49
20220330_Vote/Ewide.Core/Entity/SysCodeGen.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成表
|
||||
/// </summary>
|
||||
[Table("sys_code_gen")]
|
||||
[Comment("代码生成表")]
|
||||
public class SysCodeGen : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 作者姓名
|
||||
/// </summary>
|
||||
[Comment("作者姓名")]
|
||||
public string AuthorName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否移除表前缀
|
||||
/// </summary>
|
||||
[Comment("是否移除表前缀")]
|
||||
public string TablePrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生成方式
|
||||
/// </summary>
|
||||
[Comment("生成方式")]
|
||||
public string GenerateType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库表名
|
||||
/// </summary>
|
||||
[Comment("数据库表名")]
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 命名空间
|
||||
/// </summary>
|
||||
[Comment("命名空间")]
|
||||
public string NameSpace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务名
|
||||
/// </summary>
|
||||
[Comment("业务名")]
|
||||
public string BusName { get; set; }
|
||||
}
|
||||
}
|
||||
104
20220330_Vote/Ewide.Core/Entity/SysCodeGenConfig.cs
Normal file
104
20220330_Vote/Ewide.Core/Entity/SysCodeGenConfig.cs
Normal file
@@ -0,0 +1,104 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成字段配置表
|
||||
/// </summary>
|
||||
[Table("sys_code_gen_config")]
|
||||
[Comment("代码生成字段配置表")]
|
||||
public class SysCodeGenConfig : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成主表ID
|
||||
/// </summary>
|
||||
[Comment("代码生成主表ID")]
|
||||
[Column("CodeGenId", TypeName = "varchar(36)")]
|
||||
public string CodeGenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库字段名
|
||||
/// </summary>
|
||||
[Comment("数据库字段名")]
|
||||
public string ColumnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字段描述
|
||||
/// </summary>
|
||||
[Comment("字段描述")]
|
||||
public string ColumnComment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// .NET数据类型
|
||||
/// </summary>
|
||||
[Comment(".NET数据类型")]
|
||||
public string NetType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 作用类型(字典)
|
||||
/// </summary>
|
||||
[Comment("作用类型")]
|
||||
public string EffectType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字典code
|
||||
/// </summary>
|
||||
[Comment("字典Code")]
|
||||
public string DictTypeCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表是否缩进(字典)
|
||||
/// </summary>
|
||||
[Comment("列表是否缩进")]
|
||||
public string WhetherRetract { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否必填(字典)
|
||||
/// </summary>
|
||||
[Comment("是否必填")]
|
||||
public string WhetherRequired { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是查询条件
|
||||
/// </summary>
|
||||
[Comment("是否是查询条件")]
|
||||
public string QueryWhether { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询方式
|
||||
/// </summary>
|
||||
[Comment("查询方式")]
|
||||
public string QueryType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列表显示
|
||||
/// </summary>
|
||||
[Comment("列表显示")]
|
||||
public string WhetherTable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 增改
|
||||
/// </summary>
|
||||
[Comment("增改")]
|
||||
public string WhetherAddUpdate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主外键
|
||||
/// </summary>
|
||||
[Comment("主外键")]
|
||||
public string ColumnKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库中类型(物理类型)
|
||||
/// </summary>
|
||||
[Comment("数据库中类型")]
|
||||
public string DataType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否通用字段
|
||||
/// </summary>
|
||||
[Comment("是否通用字段")]
|
||||
public string WhetherCommon { get; set; }
|
||||
}
|
||||
}
|
||||
73
20220330_Vote/Ewide.Core/Entity/SysConfig.cs
Normal file
73
20220330_Vote/Ewide.Core/Entity/SysConfig.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Ewide.Core.Service;
|
||||
using Furion;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 参数配置表
|
||||
/// </summary>
|
||||
[Table("sys_config")]
|
||||
[Comment("参数配置表")]
|
||||
public class SysConfig : DEntityBase, IEntityChangedListener<SysConfig>
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 属性值
|
||||
/// </summary>
|
||||
[Comment("属性值")]
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否是系统参数(Y-是,N-否)
|
||||
/// </summary>
|
||||
[Comment("是否是系统参数")]
|
||||
public string SysFlag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 常量所属分类的编码,来自于“常量的分类”字典
|
||||
/// </summary>
|
||||
[Comment("常量所属分类的编码")]
|
||||
public string GroupCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 监听实体更改之后
|
||||
/// </summary>
|
||||
/// <param name="newEntity"></param>
|
||||
/// <param name="oldEntity"></param>
|
||||
/// <param name="dbContext"></param>
|
||||
/// <param name="dbContextLocator"></param>
|
||||
/// <param name="state"></param>
|
||||
public void OnChanged(SysConfig newEntity, SysConfig oldEntity, DbContext dbContext, Type dbContextLocator, EntityState state)
|
||||
{
|
||||
// 刷新配置缓存
|
||||
App.GetService<ISysConfigService>().UpdateConfigCache(newEntity.Code, newEntity.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
60
20220330_Vote/Ewide.Core/Entity/SysDictData.cs
Normal file
60
20220330_Vote/Ewide.Core/Entity/SysDictData.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典值表
|
||||
/// </summary>
|
||||
[Table("sys_dict_data")]
|
||||
[Comment("字典值表")]
|
||||
public class SysDictData : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典类型Id
|
||||
/// </summary>
|
||||
[Comment("字典类型Id")]
|
||||
[Column("TypeId", TypeName = "varchar(36)")]
|
||||
public string TypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 值
|
||||
/// </summary>
|
||||
[Comment("值")]
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
[Comment("扩展编码,以json形式存储")]
|
||||
public string ExtCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 所属类型
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysDictType SysDictType { get; set; }
|
||||
}
|
||||
}
|
||||
73
20220330_Vote/Ewide.Core/Entity/SysDictType.cs
Normal file
73
20220330_Vote/Ewide.Core/Entity/SysDictType.cs
Normal file
@@ -0,0 +1,73 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典类型表
|
||||
/// </summary>
|
||||
[Table("sys_dict_type")]
|
||||
[Comment("字典类型表")]
|
||||
public class SysDictType : DEntityBase, IEntityTypeBuilder<SysDictType>
|
||||
{
|
||||
/// <summary>
|
||||
/// 父Id
|
||||
/// </summary>
|
||||
[Comment("父Id")]
|
||||
[Column("Pid", TypeName = "varchar(36)")]
|
||||
public string Pid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父Ids
|
||||
/// </summary>
|
||||
[Comment("父Ids")]
|
||||
public string Pids { get; set; }
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 字典数据
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysDictData> SysDictDatas { get; set; }
|
||||
|
||||
public void Configure(EntityTypeBuilder<SysDictType> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||
{
|
||||
entityBuilder.HasMany(x => x.SysDictDatas)
|
||||
.WithOne(x => x.SysDictType)
|
||||
.HasForeignKey(x => x.TypeId);
|
||||
}
|
||||
}
|
||||
}
|
||||
74
20220330_Vote/Ewide.Core/Entity/SysEmp.cs
Normal file
74
20220330_Vote/Ewide.Core/Entity/SysEmp.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 员工表
|
||||
/// </summary>
|
||||
[Table("sys_emp")]
|
||||
[Comment("员工表")]
|
||||
public class SysEmp : IEntity, IEntityTypeBuilder<SysEmp>
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
[Comment("用户Id")]
|
||||
[Column("Id", TypeName = "varchar(36)")]
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
[Comment("工号")]
|
||||
public string JobNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机构Id
|
||||
/// </summary>
|
||||
[Comment("机构Id")]
|
||||
[Column("OrgId", TypeName = "varchar(36)")]
|
||||
public string OrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机构名称
|
||||
/// </summary>
|
||||
[Comment("机构名称")]
|
||||
public string OrgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(职位)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysPos> SysPos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(员工-职位)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysEmpPos> SysEmpPos { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多配置关系
|
||||
/// </summary>
|
||||
/// <param name="entityBuilder"></param>
|
||||
/// <param name="dbContext"></param>
|
||||
/// <param name="dbContextLocator"></param>
|
||||
public void Configure(EntityTypeBuilder<SysEmp> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||
{
|
||||
entityBuilder.HasMany(p => p.SysPos).WithMany(p => p.SysEmps).UsingEntity<SysEmpPos>(
|
||||
u => u.HasOne(c => c.SysPos).WithMany(c => c.SysEmpPos).HasForeignKey(c => c.SysPosId),
|
||||
u => u.HasOne(c => c.SysEmp).WithMany(c => c.SysEmpPos).HasForeignKey(c => c.SysEmpId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysEmpId, c.SysPosId });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
74
20220330_Vote/Ewide.Core/Entity/SysEmpExtOrgPos.cs
Normal file
74
20220330_Vote/Ewide.Core/Entity/SysEmpExtOrgPos.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 员工附属机构职位表
|
||||
/// </summary>
|
||||
[Table("sys_emp_ext_org_pos")]
|
||||
[Comment("员工附属机构职位表")]
|
||||
public class SysEmpExtOrgPos : IEntity, IEntityTypeBuilder<SysEmpExtOrgPos>
|
||||
{
|
||||
/// <summary>
|
||||
/// 员工Id
|
||||
/// </summary>
|
||||
[Comment("员工Id")]
|
||||
[Column("SysEmpId", TypeName = "varchar(36)")]
|
||||
public string SysEmpId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(员工)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysEmp SysEmp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机构Id
|
||||
/// </summary>
|
||||
[Comment("机构Id")]
|
||||
[Column("SysOrgId", TypeName = "varchar(36)")]
|
||||
public string SysOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(机构)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysOrg SysOrg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职位Id
|
||||
/// </summary>
|
||||
[Comment("职位Id")]
|
||||
[Column("SysPosId", TypeName = "varchar(36)")]
|
||||
public string SysPosId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(职位)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysPos SysPos { get; set; }
|
||||
|
||||
public void Configure(EntityTypeBuilder<SysEmpExtOrgPos> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||
{
|
||||
entityBuilder.HasKey(c => new { c.SysEmpId, c.SysOrgId, c.SysPosId });
|
||||
}
|
||||
|
||||
//public IEnumerable<SysEmpExtOrgPos> HasData(DbContext dbContext, Type dbContextLocator)
|
||||
//{
|
||||
// return new[]
|
||||
// {
|
||||
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "12d888de-f55d-4c88-b0a0-7c3510664d97", SysPosId = "269236c4-d74e-4e54-9d50-f6f61580a197" },
|
||||
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "8a2271d6-5bda-4544-bdd3-27e53a8b418e", SysPosId = "46c68a62-f119-4ff7-b621-0bbd77504538" },
|
||||
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "127c0a5d-43ac-4370-b313-082361885aca", SysPosId = "5bd8c466-2bca-4386-a551-daac78e3cee8" },
|
||||
// new SysEmpExtOrgPos { SysEmpId = "d0ead3dc-5096-4e15-bc6d-f640be5301ec", SysOrgId = "f236ab2d-e1b5-4e9d-844f-a59ec32c20e4", SysPosId = "d89a3afe-e6ba-4018-bdae-3c98bb47ad66" },
|
||||
// new SysEmpExtOrgPos { SysEmpId = "16a74726-e156-499f-9942-0e0e24ad0c3f", SysOrgId = "f236ab2d-e1b5-4e9d-844f-a59ec32c20e4", SysPosId = "269236c4-d74e-4e54-9d50-f6f61580a197" }
|
||||
// };
|
||||
//}
|
||||
}
|
||||
}
|
||||
41
20220330_Vote/Ewide.Core/Entity/SysEmpPos.cs
Normal file
41
20220330_Vote/Ewide.Core/Entity/SysEmpPos.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 员工职位表
|
||||
/// </summary>
|
||||
[Table("sys_emp_pos")]
|
||||
[Comment("员工职位表")]
|
||||
public class SysEmpPos : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 员工Id
|
||||
/// </summary>
|
||||
[Comment("员工Id")]
|
||||
[Column("SysEmpId", TypeName = "varchar(36)")]
|
||||
public string SysEmpId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(员工)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysEmp SysEmp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 职位Id
|
||||
/// </summary>
|
||||
[Comment("职位Id")]
|
||||
[Column("SysPosId", TypeName = "varchar(36)")]
|
||||
public string SysPosId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(职位)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysPos SysPos { get; set; }
|
||||
}
|
||||
}
|
||||
61
20220330_Vote/Ewide.Core/Entity/SysFile.cs
Normal file
61
20220330_Vote/Ewide.Core/Entity/SysFile.cs
Normal file
@@ -0,0 +1,61 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件信息表
|
||||
/// </summary>
|
||||
[Table("sys_file")]
|
||||
[Comment("文件信息表")]
|
||||
public class SysFile : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储位置(1:阿里云,2:腾讯云,3:minio,4:本地)
|
||||
/// </summary>
|
||||
[Comment("文件存储位置")]
|
||||
public int FileLocation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件仓库
|
||||
/// </summary>
|
||||
[Comment("文件仓库")]
|
||||
public string FileBucket { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件名称(上传时候的文件名)
|
||||
/// </summary>
|
||||
[Comment("文件名称")]
|
||||
public string FileOriginName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件后缀
|
||||
/// </summary>
|
||||
[Comment("文件后缀")]
|
||||
public string FileSuffix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小kb
|
||||
/// </summary>
|
||||
[Comment("文件大小kb")]
|
||||
public long FileSizeKb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 文件大小信息,计算后的
|
||||
/// </summary>
|
||||
[Comment("文件大小信息")]
|
||||
public string FileSizeInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存储到bucket的名称(文件唯一标识id)
|
||||
/// </summary>
|
||||
[Comment("存储到bucket的名称")]
|
||||
public string FileObjectName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 存储路径
|
||||
/// </summary>
|
||||
[Comment("存储路径")]
|
||||
public string FilePath { get; set; }
|
||||
}
|
||||
}
|
||||
64
20220330_Vote/Ewide.Core/Entity/SysLogAudit.cs
Normal file
64
20220330_Vote/Ewide.Core/Entity/SysLogAudit.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统操作/审计日志表
|
||||
/// </summary>
|
||||
[Table("sys_log_audit")]
|
||||
[Comment("审计日志表")]
|
||||
public class SysLogAudit : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 表名
|
||||
/// </summary>
|
||||
[Comment("表名")]
|
||||
public string TableName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 列名
|
||||
/// </summary>
|
||||
[Comment("列名")]
|
||||
public string ColumnName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 新值
|
||||
/// </summary>
|
||||
[Comment("新值")]
|
||||
public string NewValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 旧值
|
||||
/// </summary>
|
||||
[Comment("旧值")]
|
||||
public string OldValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[Comment("操作时间")]
|
||||
public DateTime CreatedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人Id
|
||||
/// </summary>
|
||||
[Comment("操作人Id")]
|
||||
[Column("UserId", TypeName = "varchar(36)")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人名称
|
||||
/// </summary>
|
||||
[Comment("操作人名称")]
|
||||
public string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作方式:新增、更新、删除
|
||||
/// </summary>
|
||||
[Comment("操作方式")]
|
||||
public string Operate { get; set; }
|
||||
}
|
||||
}
|
||||
117
20220330_Vote/Ewide.Core/Entity/SysLogOp.cs
Normal file
117
20220330_Vote/Ewide.Core/Entity/SysLogOp.cs
Normal file
@@ -0,0 +1,117 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作日志表
|
||||
/// </summary>
|
||||
[Table("sys_log_op")]
|
||||
[Comment("操作日志表")]
|
||||
public class SysLogOp : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类型(0其他 1增加 2删除 3编辑)(见LogAnnotionOpTypeEnum)
|
||||
/// </summary>
|
||||
[Comment("操作类型")]
|
||||
public int? OpType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否执行成功(Y-是,N-否)
|
||||
/// </summary>
|
||||
[Comment("是否执行成功")]
|
||||
public bool? Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 具体消息
|
||||
/// </summary>
|
||||
[Comment("具体消息")]
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP
|
||||
/// </summary>
|
||||
[Comment("IP")]
|
||||
public string Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
[Comment("地址")]
|
||||
public string Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器
|
||||
/// </summary>
|
||||
[Comment("浏览器")]
|
||||
public string Browser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
/// </summary>
|
||||
[Comment("操作系统")]
|
||||
public string Os { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求地址
|
||||
/// </summary>
|
||||
[Comment("请求地址")]
|
||||
public string Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类名称
|
||||
/// </summary>
|
||||
[Comment("类名称")]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 方法名称
|
||||
/// </summary>
|
||||
[Comment("方法名称")]
|
||||
public string MethodName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求方式(GET POST PUT DELETE)
|
||||
/// </summary>
|
||||
[Comment("请求方式")]
|
||||
public string ReqMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求参数
|
||||
/// </summary>
|
||||
[Comment("请求参数")]
|
||||
public string Param { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回结果
|
||||
/// </summary>
|
||||
[Comment("返回结果")]
|
||||
public string Result { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 耗时(毫秒)
|
||||
/// </summary>
|
||||
[Comment("耗时")]
|
||||
public long ElapsedTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[Comment("操作时间")]
|
||||
public DateTime OpTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人
|
||||
/// </summary>
|
||||
[Comment("操作人")]
|
||||
public string Account { get; set; }
|
||||
}
|
||||
}
|
||||
75
20220330_Vote/Ewide.Core/Entity/SysLogVis.cs
Normal file
75
20220330_Vote/Ewide.Core/Entity/SysLogVis.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 访问日志表
|
||||
/// </summary>
|
||||
[Table("sys_log_vis")]
|
||||
[Comment("访问日志表")]
|
||||
public class SysLogVis : EntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否执行成功(Y-是,N-否)
|
||||
/// </summary>
|
||||
[Comment("是否执行成功")]
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 具体消息
|
||||
/// </summary>
|
||||
[Comment("具体消息")]
|
||||
public string Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IP
|
||||
/// </summary>
|
||||
[Comment("IP")]
|
||||
public string Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
[Comment("地址")]
|
||||
public string Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器
|
||||
/// </summary>
|
||||
[Comment("浏览器")]
|
||||
public string Browser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
/// </summary>
|
||||
[Comment("操作系统")]
|
||||
public string Os { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访问类型(字典 1登入 2登出)
|
||||
/// </summary>
|
||||
[Comment("访问类型")]
|
||||
public int? VisType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访问时间
|
||||
/// </summary>
|
||||
[Comment("访问时间")]
|
||||
public DateTime VisTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 访问人
|
||||
/// </summary>
|
||||
[Comment("访问人")]
|
||||
public string Account { get; set; }
|
||||
}
|
||||
}
|
||||
142
20220330_Vote/Ewide.Core/Entity/SysMenu.cs
Normal file
142
20220330_Vote/Ewide.Core/Entity/SysMenu.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单表
|
||||
/// </summary>
|
||||
[Table("sys_menu")]
|
||||
[Comment("菜单表")]
|
||||
public class SysMenu : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 父Id
|
||||
/// </summary>
|
||||
[Comment("父Id")]
|
||||
[Column("Pid", TypeName = "varchar(36)")]
|
||||
public string Pid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父Ids
|
||||
/// </summary>
|
||||
[Comment("父Ids")]
|
||||
public string Pids { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单类型(字典 0目录 1菜单 2按钮)
|
||||
/// </summary>
|
||||
[Comment("菜单类型")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
[Comment("图标")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路由地址
|
||||
/// </summary>
|
||||
[Comment("路由地址")]
|
||||
public string Router { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 组件地址
|
||||
/// </summary>
|
||||
[Comment("组件地址")]
|
||||
public string Component { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限标识
|
||||
/// </summary>
|
||||
[Comment("权限标识")]
|
||||
public string Permission { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 应用分类(应用编码)
|
||||
/// </summary>
|
||||
[Comment("应用分类")]
|
||||
public string Application { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 打开方式(字典 0无 1组件 2内链 3外链)
|
||||
/// </summary>
|
||||
[Comment("打开方式")]
|
||||
public int OpenType { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 是否可见(Y-是,N-否)
|
||||
/// </summary>
|
||||
[Comment("是否可见")]
|
||||
[Column("Visible", TypeName = "bit")]
|
||||
public bool Visible { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 内链地址
|
||||
/// </summary>
|
||||
[Comment("内链地址")]
|
||||
public string Link { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 重定向地址
|
||||
/// </summary>
|
||||
[Comment("重定向地址")]
|
||||
public string Redirect { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权重(字典 1系统权重 2业务权重)
|
||||
/// </summary>
|
||||
[Comment("权重")]
|
||||
public int Weight { get; set; } = 2;
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 关联上级菜单显示 0表示不需要关联菜单 1表示关联 仅按钮有效
|
||||
/// </summary>
|
||||
[Comment("关联菜单显示")]
|
||||
[Column("VisibleParent", TypeName = "bit")]
|
||||
public bool VisibleParent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysRole> SysRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(用户角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysRoleMenu> SysRoleMenus { get; set; }
|
||||
}
|
||||
}
|
||||
81
20220330_Vote/Ewide.Core/Entity/SysNotice.cs
Normal file
81
20220330_Vote/Ewide.Core/Entity/SysNotice.cs
Normal file
@@ -0,0 +1,81 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知公告表
|
||||
/// </summary>
|
||||
[Table("sys_notice")]
|
||||
[Comment("通知公告表")]
|
||||
public class SysNotice : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 标题
|
||||
/// </summary>
|
||||
[Comment("标题")]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 内容
|
||||
/// </summary>
|
||||
[Comment("内容")]
|
||||
public string Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型(字典 1通知 2公告)
|
||||
/// </summary>
|
||||
[Comment("类型")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布人Id
|
||||
/// </summary>
|
||||
[Comment("发布人Id")]
|
||||
[Column("PublicUserId", TypeName = "varchar(36)")]
|
||||
public string PublicUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布人姓名
|
||||
/// </summary>
|
||||
[Comment("发布人姓名")]
|
||||
public string PublicUserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布机构Id
|
||||
/// </summary>
|
||||
[Comment("发布机构Id")]
|
||||
[Column("PublicOrgId", TypeName = "varchar(36)")]
|
||||
public string PublicOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布机构名称
|
||||
/// </summary>
|
||||
[Comment("发布机构名称")]
|
||||
public string PublicOrgName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 发布时间
|
||||
/// </summary>
|
||||
[Comment("发布时间")]
|
||||
public DateTime? PublicTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 撤回时间
|
||||
/// </summary>
|
||||
[Comment("撤回时间")]
|
||||
public DateTime? CancelTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0草稿 1发布 2撤回 3删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public int Status { get; set; }
|
||||
/// <summary>
|
||||
/// 上传文件ids
|
||||
/// </summary>
|
||||
[Comment("上传文件id集合")]
|
||||
public string Attachments { set; get; }
|
||||
}
|
||||
}
|
||||
47
20220330_Vote/Ewide.Core/Entity/SysNoticeUser.cs
Normal file
47
20220330_Vote/Ewide.Core/Entity/SysNoticeUser.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知公告用户表
|
||||
/// </summary>
|
||||
[Table("sys_notice_user")]
|
||||
[Comment("通知公告用户表")]
|
||||
public class SysNoticeUser : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知公告Id
|
||||
/// </summary>
|
||||
[Comment("通知公告Id")]
|
||||
[Column("NoticeId", TypeName = "varchar(36)")]
|
||||
public string NoticeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
[Comment("用户Id")]
|
||||
[Column("UserId", TypeName = "varchar(36)")]
|
||||
public string UserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 阅读时间
|
||||
/// </summary>
|
||||
[Comment("阅读时间")]
|
||||
public DateTime? ReadTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0未读 1已读)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public int ReadStatus { get; set; }
|
||||
|
||||
public void Configure(EntityTypeBuilder<SysNoticeUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||
{
|
||||
entityBuilder.HasNoKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
85
20220330_Vote/Ewide.Core/Entity/SysOauthUser.cs
Normal file
85
20220330_Vote/Ewide.Core/Entity/SysOauthUser.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Oauth登录用户表
|
||||
/// </summary>
|
||||
[Table("sys_oauth_user")]
|
||||
[Comment("Oauth登录用户表")]
|
||||
public class SysOauthUser : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 第三方平台的用户唯一Id
|
||||
/// </summary>
|
||||
[Comment("UUID")]
|
||||
public string Uuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户授权的token
|
||||
/// </summary>
|
||||
[Comment("Token")]
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
[Comment("昵称")]
|
||||
public string NickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
[Comment("头像")]
|
||||
public string Avatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
[Comment("性别")]
|
||||
public string Gender { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
[Comment("电话")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
[Comment("邮箱")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 位置
|
||||
/// </summary>
|
||||
[Comment("位置")]
|
||||
public string Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户网址
|
||||
/// </summary>
|
||||
[Comment("用户网址")]
|
||||
public string Blog { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 所在公司
|
||||
/// </summary>
|
||||
[Comment("所在公司")]
|
||||
public string Company { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户来源
|
||||
/// </summary>
|
||||
[Comment("用户来源")]
|
||||
public string Source { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户备注(各平台中的用户个人介绍)
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
112
20220330_Vote/Ewide.Core/Entity/SysOrg.cs
Normal file
112
20220330_Vote/Ewide.Core/Entity/SysOrg.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 组织机构表
|
||||
/// </summary>
|
||||
[Table("sys_org")]
|
||||
[Comment("组织机构表")]
|
||||
public class SysOrg : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 父Id
|
||||
/// </summary>
|
||||
[Comment("父Id")]
|
||||
[Column("Pid", TypeName = "varchar(36)")]
|
||||
public string Pid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父Ids
|
||||
/// </summary>
|
||||
[Comment("Pids")]
|
||||
public string Pids { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
[MaxLength(20)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机构类型
|
||||
/// </summary>
|
||||
[Comment("机构类型")]
|
||||
public int Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联系人
|
||||
/// </summary>
|
||||
[Comment("联系人")]
|
||||
public string Contacts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
[Comment("电话")]
|
||||
public string Tel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
|
||||
public string AreaCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一 一个组织对应一个区域代码
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysAreaCode Area { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(用户)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysUser> SysUsers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(用户数据范围)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysUserDataScope> SysUserDataScopes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysRole> SysRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(角色数据范围)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysRoleDataScope> SysRoleDataScopes { get; set; }
|
||||
}
|
||||
}
|
||||
57
20220330_Vote/Ewide.Core/Entity/SysPos.cs
Normal file
57
20220330_Vote/Ewide.Core/Entity/SysPos.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 职位表
|
||||
/// </summary>
|
||||
[Table("sys_pos")]
|
||||
[Comment("职位表")]
|
||||
public class SysPos : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(员工)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysEmp> SysEmps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(员工职位)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysEmpPos> SysEmpPos { get; set; }
|
||||
}
|
||||
}
|
||||
133
20220330_Vote/Ewide.Core/Entity/SysRole.cs
Normal file
133
20220330_Vote/Ewide.Core/Entity/SysRole.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
[Table("sys_role")]
|
||||
[Comment("角色表")]
|
||||
public class SysRole : DEntityBase, IEntityTypeBuilder<SysRole>
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Comment("编码")]
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
[Comment("排序")]
|
||||
public int Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据范围类型(字典 1全部数据 2本部门及以下数据 3本部门数据 4仅本人数据 5自定义数据)
|
||||
/// </summary>
|
||||
[Comment("数据范围类型")]
|
||||
public int DataScopeType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
[Comment("状态")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(用户)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysUser> SysUsers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(用户角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysUserRole> SysUserRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(机构)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysOrg> SysOrgs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(角色-机构 数据范围)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysRoleDataScope> SysRoleDataScopes { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public ICollection<SysAreaCode> AreaCodes { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public List<SysRoleArea> SysRoleAreas { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(菜单)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysMenu> SysMenus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(角色-菜单)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysRoleMenu> SysRoleMenus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 配置多对多关系
|
||||
/// </summary>
|
||||
/// <param name="entityBuilder"></param>
|
||||
/// <param name="dbContext"></param>
|
||||
/// <param name="dbContextLocator"></param>
|
||||
public void Configure(EntityTypeBuilder<SysRole> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||
{
|
||||
entityBuilder.HasMany(p => p.SysOrgs)
|
||||
.WithMany(p => p.SysRoles)
|
||||
.UsingEntity<SysRoleDataScope>(
|
||||
u => u.HasOne(c => c.SysOrg).WithMany(c => c.SysRoleDataScopes).HasForeignKey(c => c.SysOrgId),
|
||||
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleDataScopes).HasForeignKey(c => c.SysRoleId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysRoleId, c.SysOrgId });
|
||||
});
|
||||
entityBuilder.HasMany(p => p.AreaCodes)
|
||||
.WithMany(p => p.SysRoles)
|
||||
.UsingEntity<SysRoleArea>(
|
||||
u => u.HasOne(c => c.Area).WithMany(c => c.SysRoleAreas).HasForeignKey(c => c.AreaCode),
|
||||
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleAreas).HasForeignKey(c => c.SysRoleId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysRoleId, c.AreaCode });
|
||||
});
|
||||
entityBuilder.HasMany(p => p.SysMenus)
|
||||
.WithMany(p => p.SysRoles)
|
||||
.UsingEntity<SysRoleMenu>(
|
||||
u => u.HasOne(c => c.SysMenu).WithMany(c => c.SysRoleMenus).HasForeignKey(c => c.SysMenuId),
|
||||
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysRoleMenus).HasForeignKey(c => c.SysRoleId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysRoleId, c.SysMenuId });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
31
20220330_Vote/Ewide.Core/Entity/SysRoleArea.cs
Normal file
31
20220330_Vote/Ewide.Core/Entity/SysRoleArea.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
[Table("sys_role_area")]
|
||||
[Comment("角色区域自定义数据")]
|
||||
public class SysRoleArea: IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色Id
|
||||
/// </summary>
|
||||
[Comment("角色Id")]
|
||||
public string SysRoleId { get; set; }
|
||||
[XmlIgnore]
|
||||
public SysRole SysRole { get; set; }
|
||||
[Comment("系统使用的区域代码")]
|
||||
public string AreaCode { get; set; }
|
||||
[XmlIgnore]
|
||||
public SysAreaCode Area { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
40
20220330_Vote/Ewide.Core/Entity/SysRoleDataScope.cs
Normal file
40
20220330_Vote/Ewide.Core/Entity/SysRoleDataScope.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色数据范围表
|
||||
/// </summary>
|
||||
[Table("sys_role_data_scope")]
|
||||
[Comment("角色数据范围表")]
|
||||
public class SysRoleDataScope : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色Id
|
||||
/// </summary>
|
||||
[Comment("角色Id")]
|
||||
[Column("SysRoleId", TypeName = "varchar(36)")]
|
||||
public string SysRoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统角色)
|
||||
/// </summary>
|
||||
public SysRole SysRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机构Id
|
||||
/// </summary>
|
||||
[Comment("机构Id")]
|
||||
[Column("SysOrgId", TypeName = "varchar(36)")]
|
||||
public string SysOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统机构)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysOrg SysOrg { get; set; }
|
||||
}
|
||||
}
|
||||
41
20220330_Vote/Ewide.Core/Entity/SysRoleMenu.cs
Normal file
41
20220330_Vote/Ewide.Core/Entity/SysRoleMenu.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色菜单表
|
||||
/// </summary>
|
||||
[Table("sys_role_menu")]
|
||||
[Comment("角色菜单表")]
|
||||
public class SysRoleMenu : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色Id
|
||||
/// </summary>
|
||||
[Comment("角色Id")]
|
||||
[Column("SysRoleId", TypeName = "varchar(36)")]
|
||||
public string SysRoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统用户)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysRole SysRole { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单Id
|
||||
/// </summary>
|
||||
[Comment("菜单Id")]
|
||||
[Column("SysMenuId", TypeName = "varchar(36)")]
|
||||
public string SysMenuId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统菜单)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysMenu SysMenu { get; set; }
|
||||
}
|
||||
}
|
||||
56
20220330_Vote/Ewide.Core/Entity/SysTenant.cs
Normal file
56
20220330_Vote/Ewide.Core/Entity/SysTenant.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 租户表
|
||||
/// </summary>
|
||||
[Table("sys_tenant")]
|
||||
[Comment("租户表")]
|
||||
public class SysTenant : DEntityBase, IEntity<MultiTenantDbContextLocator>
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Comment("名称")]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 主机
|
||||
/// </summary>
|
||||
[Comment("主机")]
|
||||
public string Host { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电子邮箱
|
||||
/// </summary>
|
||||
[Comment("电子邮箱")]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
[Comment("电话")]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据库连接
|
||||
/// </summary>
|
||||
[Comment("数据库连接")]
|
||||
public string Connection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 架构
|
||||
/// </summary>
|
||||
[Comment("架构")]
|
||||
public string Schema { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
126
20220330_Vote/Ewide.Core/Entity/SysTimer.cs
Normal file
126
20220330_Vote/Ewide.Core/Entity/SysTimer.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using Furion.TaskScheduler;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 定时任务
|
||||
/// </summary>
|
||||
[Table("sys_timer")]
|
||||
[Comment("定时任务表")]
|
||||
public class SysTimer : DEntityBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 任务名称
|
||||
/// </summary>
|
||||
/// <example>ewide</example>
|
||||
[Comment("任务名称")]
|
||||
public string JobName { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 只执行一次
|
||||
/// </summary>
|
||||
[Comment("只执行一次")]
|
||||
public bool DoOnce { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 任务分组
|
||||
/// </summary>
|
||||
/// <example>ewide</example>
|
||||
//[Comment("任务分组")]
|
||||
//public string JobGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 立即执行(默认等待启动)
|
||||
/// </summary>
|
||||
[Comment("立即执行")]
|
||||
public bool StartNow { get; set; } = false;
|
||||
|
||||
// <summary>
|
||||
/// 执行类型(并行、列队)
|
||||
/// </summary>
|
||||
[Comment("执行类型")]
|
||||
public SpareTimeExecuteTypes ExecuteType { get; set; } = SpareTimeExecuteTypes.Parallel;
|
||||
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
/// </summary>
|
||||
[Comment("开始时间")]
|
||||
public DateTime BeginTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 结束时间
|
||||
/// </summary>
|
||||
/// <example>null</example>
|
||||
[Comment("结束时间")]
|
||||
public DateTime? EndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Cron表达式
|
||||
/// </summary>
|
||||
/// <example></example>
|
||||
[Comment("Cron表达式")]
|
||||
public string Cron { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行次数(默认无限循环)
|
||||
/// </summary>
|
||||
/// <example>10</example>
|
||||
[Comment("执行次数")]
|
||||
public int? RunNumber { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行间隔时间,单位秒(如果有Cron,则IntervalSecond失效)
|
||||
/// </summary>
|
||||
/// <example>5</example>
|
||||
[Comment("执行间隔时间")]
|
||||
public int? Interval { get; set; } = 5;
|
||||
|
||||
/// <summary>
|
||||
/// 触发器类型
|
||||
/// </summary>
|
||||
//[Comment("触发器类型")]
|
||||
//public TriggerTypeEnum TriggerType { get; set; } = TriggerTypeEnum.Simple;
|
||||
|
||||
/// <summary>
|
||||
/// 定时器类型
|
||||
/// </summary>
|
||||
[Comment("定时器类型")]
|
||||
public SpareTimeTypes TimerType { get; set; } = SpareTimeTypes.Interval;
|
||||
|
||||
/// <summary>
|
||||
/// 请求url
|
||||
/// </summary>
|
||||
[Comment("请求url")]
|
||||
public string RequestUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求参数(Post,Put请求用)
|
||||
/// </summary>
|
||||
[Comment("请求参数")]
|
||||
public string RequestParameters { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Headers(可以包含如:Authorization授权认证)
|
||||
/// 格式:{"Authorization":"userpassword.."}
|
||||
/// </summary>
|
||||
[Comment("Headers")]
|
||||
public string Headers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求类型
|
||||
/// </summary>
|
||||
/// <example>2</example>
|
||||
[Comment("请求类型")]
|
||||
public RequestTypeEnum RequestType { get; set; } = RequestTypeEnum.Post;
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
[Comment("备注")]
|
||||
public string Remark { get; set; }
|
||||
}
|
||||
}
|
||||
181
20220330_Vote/Ewide.Core/Entity/SysUser.cs
Normal file
181
20220330_Vote/Ewide.Core/Entity/SysUser.cs
Normal file
@@ -0,0 +1,181 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户表
|
||||
/// </summary>
|
||||
[Table("sys_user")]
|
||||
[Comment("用户表")]
|
||||
public class SysUser : DEntityBase, IEntityTypeBuilder<SysUser>
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
[Comment("账号")]
|
||||
[Required, MaxLength(20)]
|
||||
public string Account { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码(采用MD5加密)
|
||||
/// </summary>
|
||||
[Comment("密码")]
|
||||
[Required]
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 密码安全级别,在注册和修改密码时生成
|
||||
/// </summary>
|
||||
[Comment("密码安全级别")]
|
||||
[Required]
|
||||
public int SecurityLevel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
[Comment("昵称")]
|
||||
[MaxLength(20)]
|
||||
public string NickName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
[Comment("姓名")]
|
||||
[MaxLength(20)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
[Comment("头像")]
|
||||
public string Avatar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 生日
|
||||
/// </summary>
|
||||
[Comment("生日")]
|
||||
public DateTime? Birthday { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别-男_1、女_2
|
||||
/// </summary>
|
||||
[Comment("性别-男_1、女_2")]
|
||||
public int Sex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
[Comment("邮箱")]
|
||||
[MaxLength(30)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 手机
|
||||
/// </summary>
|
||||
[Comment("手机")]
|
||||
[MaxLength(30)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
[Comment("电话")]
|
||||
[MaxLength(30)]
|
||||
public string Tel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后登录IP
|
||||
/// </summary>
|
||||
[Comment("最后登录IP")]
|
||||
[MaxLength(30)]
|
||||
public string LastLoginIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后登录时间
|
||||
/// </summary>
|
||||
[Comment("最后登录时间")]
|
||||
public DateTime LastLoginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 管理员类型-超级管理员_1、非管理员_2
|
||||
/// </summary>
|
||||
[Comment("管理员类型-超级管理员_1、非管理员_2")]
|
||||
public AdminType AdminType { get; set; } = AdminType.None;
|
||||
|
||||
/// <summary>
|
||||
/// 状态-正常_0、停用_1、删除_2
|
||||
/// </summary>
|
||||
[Comment("状态-正常_0、停用_1、删除_2")]
|
||||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysRole> SysRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(用户-角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysUserRole> SysUserRoles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多(机构)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public ICollection<SysOrg> SysOrgs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 多对多中间表(用户-机构 数据范围)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysUserDataScope> SysUserDataScopes { get; set; }
|
||||
|
||||
[XmlIgnore]
|
||||
public ICollection<SysAreaCode> AreaCodes { get; set; }
|
||||
/// <summary>
|
||||
/// 多对多中间表(用户-区域 数据范围)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public List<SysUserArea> SysUserAreas { get; set; }
|
||||
/// <summary>
|
||||
/// 配置多对多关系
|
||||
/// </summary>
|
||||
/// <param name="entityBuilder"></param>
|
||||
/// <param name="dbContext"></param>
|
||||
/// <param name="dbContextLocator"></param>
|
||||
public void Configure(EntityTypeBuilder<SysUser> entityBuilder, DbContext dbContext, Type dbContextLocator)
|
||||
{
|
||||
entityBuilder.HasMany(p => p.SysRoles).WithMany(p => p.SysUsers).UsingEntity<SysUserRole>(
|
||||
u => u.HasOne(c => c.SysRole).WithMany(c => c.SysUserRoles).HasForeignKey(c => c.SysRoleId),
|
||||
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserRoles).HasForeignKey(c => c.SysUserId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysUserId, c.SysRoleId });
|
||||
});
|
||||
|
||||
entityBuilder.HasMany(p => p.SysOrgs).WithMany(p => p.SysUsers).UsingEntity<SysUserDataScope>(
|
||||
u => u.HasOne(c => c.SysOrg).WithMany(c => c.SysUserDataScopes).HasForeignKey(c => c.SysOrgId),
|
||||
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserDataScopes).HasForeignKey(c => c.SysUserId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysUserId, c.SysOrgId });
|
||||
});
|
||||
entityBuilder.HasMany(p => p.AreaCodes).WithMany(p => p.SysUsers).UsingEntity<SysUserArea>(
|
||||
u => u.HasOne(c => c.Area).WithMany(c => c.SysUserAreas).HasForeignKey(c => c.AreaCode),
|
||||
u => u.HasOne(c => c.SysUser).WithMany(c => c.SysUserAreas).HasForeignKey(c => c.SysUserId),
|
||||
u =>
|
||||
{
|
||||
u.HasKey(c => new { c.SysUserId, c.AreaCode });
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
27
20220330_Vote/Ewide.Core/Entity/SysUserArea.cs
Normal file
27
20220330_Vote/Ewide.Core/Entity/SysUserArea.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
[Table("sys_user_area")]
|
||||
[Comment("用户授权区域信息")]
|
||||
public class SysUserArea: IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
[Comment("用户Id")]
|
||||
[Column("SysUserId", TypeName = "varchar(36)")]
|
||||
public string SysUserId { get; set; }
|
||||
[XmlIgnore]
|
||||
public SysUser SysUser { get; set; }
|
||||
[Comment("系统使用的区域代码")]
|
||||
[MaxLength(10)]
|
||||
public string AreaCode { get; set; }
|
||||
[XmlIgnore]
|
||||
public SysAreaCode Area { get; set; }
|
||||
}
|
||||
}
|
||||
41
20220330_Vote/Ewide.Core/Entity/SysUserDataScope.cs
Normal file
41
20220330_Vote/Ewide.Core/Entity/SysUserDataScope.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户数据范围表
|
||||
/// </summary>
|
||||
[Table("sys_user_data_scope")]
|
||||
[Comment("用户数据范围表")]
|
||||
public class SysUserDataScope : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
[Comment("用户Id")]
|
||||
[Column("SysUserId", TypeName = "varchar(36)")]
|
||||
public string SysUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统用户)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysUser SysUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 机构Id
|
||||
/// </summary>
|
||||
[Comment("机构Id")]
|
||||
[Column("SysOrgId", TypeName = "varchar(36)")]
|
||||
public string SysOrgId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统机构)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysOrg SysOrg { get; set; }
|
||||
}
|
||||
}
|
||||
41
20220330_Vote/Ewide.Core/Entity/SysUserRole.cs
Normal file
41
20220330_Vote/Ewide.Core/Entity/SysUserRole.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户角色表
|
||||
/// </summary>
|
||||
[Table("sys_user_role")]
|
||||
[Comment("用户角色表")]
|
||||
public class SysUserRole : IEntity
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户Id
|
||||
/// </summary>
|
||||
[Comment("用户Id")]
|
||||
[Column("SysUserId", TypeName = "varchar(36)")]
|
||||
public string SysUserId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统用户)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysUser SysUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 系统角色Id
|
||||
/// </summary>
|
||||
[Comment("角色Id")]
|
||||
[Column("SysRoleId", TypeName = "varchar(36)")]
|
||||
public string SysRoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 一对一引用(系统角色)
|
||||
/// </summary>
|
||||
[XmlIgnore]
|
||||
public SysRole SysRole { get; set; }
|
||||
}
|
||||
}
|
||||
23
20220330_Vote/Ewide.Core/Enum/AdminType.cs
Normal file
23
20220330_Vote/Ewide.Core/Enum/AdminType.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 账号类型
|
||||
/// </summary>
|
||||
[Description("账号类型")]
|
||||
public enum AdminType
|
||||
{
|
||||
/// <summary>
|
||||
/// 超级管理员
|
||||
/// </summary>
|
||||
[Description("超级管理员")]
|
||||
SuperAdmin = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 非管理员
|
||||
/// </summary>
|
||||
[Description("非管理员")]
|
||||
None = 2
|
||||
}
|
||||
}
|
||||
29
20220330_Vote/Ewide.Core/Enum/CommonStatus.cs
Normal file
29
20220330_Vote/Ewide.Core/Enum/CommonStatus.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 公共状态
|
||||
/// </summary>
|
||||
[Description("公共状态")]
|
||||
public enum CommonStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 正常
|
||||
/// </summary>
|
||||
[Description("正常")]
|
||||
ENABLE = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 停用
|
||||
/// </summary>
|
||||
[Description("停用")]
|
||||
DISABLE = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
[Description("删除")]
|
||||
DELETED = 2
|
||||
}
|
||||
}
|
||||
50
20220330_Vote/Ewide.Core/Enum/DataScopeType.cs
Normal file
50
20220330_Vote/Ewide.Core/Enum/DataScopeType.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
[Description("数据范围")]
|
||||
public enum DataScopeType
|
||||
{
|
||||
/// <summary>
|
||||
/// 全部数据
|
||||
/// </summary>
|
||||
[Description("全部数据")]
|
||||
ALL = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 本部门及以下数据
|
||||
/// </summary>
|
||||
[Description("本部门及以下数据")]
|
||||
DEPT_WITH_CHILD = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 本部门数据
|
||||
/// </summary>
|
||||
[Description("本部门数据")]
|
||||
DEPT = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 仅本人数据
|
||||
/// </summary>
|
||||
[Description("仅本人数据")]
|
||||
SELF = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 自定义数据
|
||||
/// </summary>
|
||||
[Description("自定义数据")]
|
||||
DEFINE = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 本部门所在区域及以下区域
|
||||
/// </summary>
|
||||
[Description("本部门所在区域及以下区域")]
|
||||
AREA_WITH_CHILD = 6,
|
||||
|
||||
/// <summary>
|
||||
/// 本部门所在区域数据 不包括下面区域
|
||||
/// </summary>
|
||||
[Description("仅本部门所在区域数据")]
|
||||
AREA = 7,
|
||||
}
|
||||
}
|
||||
417
20220330_Vote/Ewide.Core/Enum/ErrorCode.cs
Normal file
417
20220330_Vote/Ewide.Core/Enum/ErrorCode.cs
Normal file
@@ -0,0 +1,417 @@
|
||||
using Furion.FriendlyException;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统错误码
|
||||
/// </summary>
|
||||
[ErrorCodeType]
|
||||
[Description("系统错误码")]
|
||||
public enum ErrorCode
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户名或密码不正确
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("用户名或密码不正确")]
|
||||
D1000,
|
||||
|
||||
/// <summary>
|
||||
/// 非法操作!禁止删除自己
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("非法操作,禁止删除自己")]
|
||||
D1001,
|
||||
|
||||
/// <summary>
|
||||
/// 记录不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("记录不存在")]
|
||||
D1002,
|
||||
|
||||
/// <summary>
|
||||
/// 账号已存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("账号已存在")]
|
||||
D1003,
|
||||
|
||||
/// <summary>
|
||||
/// 旧密码不匹配
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("旧密码输入错误")]
|
||||
D1004,
|
||||
|
||||
/// <summary>
|
||||
/// 新旧密码不可一致
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("新旧密码不可一致")]
|
||||
D10041,
|
||||
|
||||
/// <summary>
|
||||
/// 测试数据禁止更改admin密码
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("测试数据禁止更改用户【admin】密码")]
|
||||
D1005,
|
||||
|
||||
/// <summary>
|
||||
/// 数据已存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("数据已存在")]
|
||||
D1006,
|
||||
|
||||
/// <summary>
|
||||
/// 数据不存在或含有关联引用,禁止删除
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("数据不存在或含有关联引用,禁止删除")]
|
||||
D1007,
|
||||
|
||||
/// <summary>
|
||||
/// 禁止为管理员分配角色
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("禁止为管理员分配角色")]
|
||||
D1008,
|
||||
|
||||
/// <summary>
|
||||
/// 重复数据或记录含有不存在数据
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("重复数据或记录含有不存在数据")]
|
||||
D1009,
|
||||
|
||||
/// <summary>
|
||||
/// 禁止为超级管理员角色分配权限
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("禁止为超级管理员角色分配权限")]
|
||||
D1010,
|
||||
|
||||
/// <summary>
|
||||
/// 非法数据
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("非法数据")]
|
||||
D1011,
|
||||
|
||||
/// <summary>
|
||||
/// Id不能为空
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("Id不能为空")]
|
||||
D1012,
|
||||
|
||||
/// <summary>
|
||||
/// 所属机构不在自己的数据范围内
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("没有权限操作该数据")]
|
||||
D1013,
|
||||
|
||||
/// <summary>
|
||||
/// 禁止删除超级管理员
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("禁止删除超级管理员")]
|
||||
D1014,
|
||||
|
||||
/// <summary>
|
||||
/// 禁止修改超级管理员状态
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("禁止修改超级管理员状态")]
|
||||
D1015,
|
||||
|
||||
/// <summary>
|
||||
/// 没有权限
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("没有权限")]
|
||||
D1016,
|
||||
|
||||
/// <summary>
|
||||
/// 账号已冻结
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("账号已冻结")]
|
||||
D1017,
|
||||
|
||||
/// <summary>
|
||||
/// 发送验证流程错误
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("发送验证流程错误")]
|
||||
D1018,
|
||||
|
||||
/// <summary>
|
||||
/// 没有可验证方式
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("没有可验证方式")]
|
||||
D1019,
|
||||
|
||||
/// <summary>
|
||||
/// 验证错误
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("验证错误")]
|
||||
D1020,
|
||||
|
||||
/// <summary>
|
||||
/// 绑定失败
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("绑定失败")]
|
||||
D1021,
|
||||
|
||||
/// <summary>
|
||||
/// 验证码失效
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("验证码失效")]
|
||||
D1022,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 请不要频繁发送验证码
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("请不要频繁发送验证码")]
|
||||
D1023,
|
||||
|
||||
/// <summary>
|
||||
/// 请不要频繁发送验证码
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("验证码发送失败")]
|
||||
D1024,
|
||||
|
||||
/// <summary>
|
||||
/// 父机构不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("父机构不存在")]
|
||||
D2000,
|
||||
|
||||
/// <summary>
|
||||
/// 当前机构Id不能与父机构Id相同
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("当前机构Id不能与父机构Id相同")]
|
||||
D2001,
|
||||
|
||||
/// <summary>
|
||||
/// 已有相同组织机构,编码或名称相同
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已有相同组织机构,编码或名称相同")]
|
||||
D2002,
|
||||
|
||||
/// <summary>
|
||||
/// 没有权限操作机构
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("没有权限操作机构")]
|
||||
D2003,
|
||||
|
||||
/// <summary>
|
||||
/// 该机构下有员工禁止删除
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该机构下有员工禁止删除")]
|
||||
D2004,
|
||||
|
||||
/// <summary>
|
||||
/// 附属机构下有员工禁止删除
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("附属机构下有员工禁止删除")]
|
||||
D2005,
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("字典类型不存在")]
|
||||
D3000,
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型已存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("字典类型已存在,名称或编码重复")]
|
||||
D3001,
|
||||
|
||||
/// <summary>
|
||||
/// 字典类型下面有字典值禁止删除
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("字典类型下面有字典值禁止删除")]
|
||||
D3002,
|
||||
|
||||
/// <summary>
|
||||
/// 字典值已存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("字典值已存在,名称或编码重复")]
|
||||
D3003,
|
||||
|
||||
/// <summary>
|
||||
/// 字典值不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("字典值不存在")]
|
||||
D3004,
|
||||
|
||||
/// <summary>
|
||||
/// 字典状态错误
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("字典状态错误")]
|
||||
D3005,
|
||||
|
||||
/// <summary>
|
||||
/// 菜单已存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("菜单已存在")]
|
||||
D4000,
|
||||
|
||||
/// <summary>
|
||||
/// 路由地址为空
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("路由地址为空")]
|
||||
D4001,
|
||||
|
||||
/// <summary>
|
||||
/// 打开方式为空
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("打开方式为空")]
|
||||
D4002,
|
||||
|
||||
/// <summary>
|
||||
/// 权限标识格式为空
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("权限标识格式为空")]
|
||||
D4003,
|
||||
|
||||
/// <summary>
|
||||
/// 权限标识格式错误
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("权限标识格式错误")]
|
||||
D4004,
|
||||
|
||||
/// <summary>
|
||||
/// 权限不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("权限不存在")]
|
||||
D4005,
|
||||
|
||||
/// <summary>
|
||||
/// 父级菜单不能为当前节点,请重新选择父级菜单
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("父级菜单不能为当前节点,请重新选择父级菜单")]
|
||||
D4006,
|
||||
|
||||
/// <summary>
|
||||
/// 不能移动根节点
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("不能移动根节点")]
|
||||
D4007,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名或同编码应用
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名或同编码应用")]
|
||||
D5000,
|
||||
|
||||
/// <summary>
|
||||
/// 默认激活系统只能有一个
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("默认激活系统只能有一个")]
|
||||
D5001,
|
||||
|
||||
/// <summary>
|
||||
/// 该应用下有菜单禁止删除
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该应用下有菜单禁止删除")]
|
||||
D5002,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名或同编码应用
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名或同编码应用")]
|
||||
D5003,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名或同编码职位
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名或同编码职位")]
|
||||
D6000,
|
||||
|
||||
/// <summary>
|
||||
/// 该职位下有员工禁止删除
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该职位下有员工禁止删除")]
|
||||
D6001,
|
||||
|
||||
/// <summary>
|
||||
/// 通知公告状态错误
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("通知公告状态错误")]
|
||||
D7000,
|
||||
|
||||
/// <summary>
|
||||
/// 通知公告删除失败
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("通知公告删除失败")]
|
||||
D7001,
|
||||
|
||||
/// <summary>
|
||||
/// 通知公告编辑失败
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("通知公告编辑失败,类型必须为草稿")]
|
||||
D7002,
|
||||
|
||||
/// <summary>
|
||||
/// 文件不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("文件不存在")]
|
||||
D8000,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名或同编码参数配置
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名或同编码参数配置")]
|
||||
D9000,
|
||||
|
||||
/// <summary>
|
||||
/// 禁止删除系统参数
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("禁止删除系统参数")]
|
||||
D9001,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名任务调度
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名任务调度")]
|
||||
D1100,
|
||||
|
||||
/// <summary>
|
||||
/// 任务调度不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("任务调度不存在")]
|
||||
D1101,
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 演示环境禁止修改数据
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("演示环境禁止修改数据")]
|
||||
D1200,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名或同主机租户
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名或同主机租户")]
|
||||
D1300,
|
||||
|
||||
/// <summary>
|
||||
/// 该表代码模板已经生成过
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("该表代码模板已经生成过")]
|
||||
D1400,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在同名或同编码项目
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在同名或同编码项目")]
|
||||
xg1000,
|
||||
|
||||
/// <summary>
|
||||
/// 已存在相同证件号码人员
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("已存在相同证件号码人员")]
|
||||
xg1001,
|
||||
|
||||
/// <summary>
|
||||
/// 检测数据不存在
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("检测数据不存在")]
|
||||
xg1002,
|
||||
|
||||
/// <summary>
|
||||
/// 网络错误
|
||||
/// </summary>
|
||||
[ErrorCodeItemMetadata("服务器网络错误")]
|
||||
xg1100,
|
||||
}
|
||||
}
|
||||
35
20220330_Vote/Ewide.Core/Enum/FileLocation.cs
Normal file
35
20220330_Vote/Ewide.Core/Enum/FileLocation.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 文件存储位置
|
||||
/// </summary>
|
||||
[Description("文件存储位置")]
|
||||
public enum FileLocation
|
||||
{
|
||||
/// <summary>
|
||||
/// 阿里云
|
||||
/// </summary>
|
||||
[Description("阿里云")]
|
||||
ALIYUN = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 腾讯云
|
||||
/// </summary>
|
||||
[Description("腾讯云")]
|
||||
TENCENT = 2,
|
||||
|
||||
/// <summary>
|
||||
/// minio服务器
|
||||
/// </summary>
|
||||
[Description("minio服务器")]
|
||||
MINIO = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 本地
|
||||
/// </summary>
|
||||
[Description("本地")]
|
||||
LOCAL = 4
|
||||
}
|
||||
}
|
||||
29
20220330_Vote/Ewide.Core/Enum/Gender.cs
Normal file
29
20220330_Vote/Ewide.Core/Enum/Gender.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
[Description("性别")]
|
||||
public enum Gender
|
||||
{
|
||||
/// <summary>
|
||||
/// 男
|
||||
/// </summary>
|
||||
[Description("男")]
|
||||
MALE = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 女
|
||||
/// </summary>
|
||||
[Description("女")]
|
||||
FEMALE = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 未知
|
||||
/// </summary>
|
||||
[Description("未知")]
|
||||
UNKNOWN = 3
|
||||
}
|
||||
}
|
||||
78
20220330_Vote/Ewide.Core/Enum/LogOpType.cs
Normal file
78
20220330_Vote/Ewide.Core/Enum/LogOpType.cs
Normal file
@@ -0,0 +1,78 @@
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志操作类型
|
||||
/// </summary>
|
||||
public enum LogOpType
|
||||
{
|
||||
/// <summary>
|
||||
/// 其它
|
||||
/// </summary>
|
||||
OTHER,
|
||||
|
||||
/// <summary>
|
||||
/// 增加
|
||||
/// </summary>
|
||||
ADD,
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
DELETE,
|
||||
|
||||
/// <summary>
|
||||
/// 编辑
|
||||
/// </summary>
|
||||
EDIT,
|
||||
|
||||
/// <summary>
|
||||
/// 更新
|
||||
/// </summary>
|
||||
UPDATE,
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
QUERY,
|
||||
|
||||
/// <summary>
|
||||
/// 详情
|
||||
/// </summary>
|
||||
DETAIL,
|
||||
|
||||
/// <summary>
|
||||
/// 树
|
||||
/// </summary>
|
||||
TREE,
|
||||
|
||||
/// <summary>
|
||||
/// 导入
|
||||
/// </summary>
|
||||
IMPORT,
|
||||
|
||||
/// <summary>
|
||||
/// 导出
|
||||
/// </summary>
|
||||
EXPORT,
|
||||
|
||||
/// <summary>
|
||||
/// 授权
|
||||
/// </summary>
|
||||
GRANT,
|
||||
|
||||
/// <summary>
|
||||
/// 强退
|
||||
/// </summary>
|
||||
FORCE,
|
||||
|
||||
/// <summary>
|
||||
/// 清空
|
||||
/// </summary>
|
||||
CLEAN,
|
||||
|
||||
/// <summary>
|
||||
/// 修改状态
|
||||
/// </summary>
|
||||
CHANGE_STATUS
|
||||
}
|
||||
}
|
||||
34
20220330_Vote/Ewide.Core/Enum/MenuOpenType.cs
Normal file
34
20220330_Vote/Ewide.Core/Enum/MenuOpenType.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统菜单类型
|
||||
/// </summary>
|
||||
public enum MenuOpenType
|
||||
{
|
||||
/// <summary>
|
||||
/// 无
|
||||
/// </summary>
|
||||
[Description("无")]
|
||||
NONE = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 组件
|
||||
/// </summary>
|
||||
[Description("组件")]
|
||||
COMPONENT = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 内链
|
||||
/// </summary>
|
||||
[Description("内链")]
|
||||
INNER = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 外链
|
||||
/// </summary>
|
||||
[Description("外链")]
|
||||
OUTER = 3
|
||||
}
|
||||
}
|
||||
28
20220330_Vote/Ewide.Core/Enum/MenuType.cs
Normal file
28
20220330_Vote/Ewide.Core/Enum/MenuType.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统菜单类型
|
||||
/// </summary>
|
||||
public enum MenuType
|
||||
{
|
||||
/// <summary>
|
||||
/// 目录
|
||||
/// </summary>
|
||||
[Description("目录")]
|
||||
DIR = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 菜单
|
||||
/// </summary>
|
||||
[Description("菜单")]
|
||||
MENU = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 功能
|
||||
/// </summary>
|
||||
[Description("功能")]
|
||||
FUNCTION = 2
|
||||
}
|
||||
}
|
||||
22
20220330_Vote/Ewide.Core/Enum/MenuWeight.cs
Normal file
22
20220330_Vote/Ewide.Core/Enum/MenuWeight.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单权重
|
||||
/// </summary>
|
||||
public enum MenuWeight
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统权重
|
||||
/// </summary>
|
||||
[Description("系统权重")]
|
||||
SUPER_ADMIN_WEIGHT = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 业务权重
|
||||
/// </summary>
|
||||
[Description("业务权重")]
|
||||
DEFAULT_WEIGHT = 2
|
||||
}
|
||||
}
|
||||
34
20220330_Vote/Ewide.Core/Enum/NoticeStatus.cs
Normal file
34
20220330_Vote/Ewide.Core/Enum/NoticeStatus.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知公告状态
|
||||
/// </summary>
|
||||
public enum NoticeStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 草稿
|
||||
/// </summary>
|
||||
[Description("草稿")]
|
||||
DRAFT = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 发布
|
||||
/// </summary>
|
||||
[Description("发布")]
|
||||
PUBLIC = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 撤回
|
||||
/// </summary>
|
||||
[Description("撤回")]
|
||||
CANCEL = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
[Description("删除")]
|
||||
DELETED = 3
|
||||
}
|
||||
}
|
||||
22
20220330_Vote/Ewide.Core/Enum/NoticeUserStatus.cs
Normal file
22
20220330_Vote/Ewide.Core/Enum/NoticeUserStatus.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知公告用户状态
|
||||
/// </summary>
|
||||
public enum NoticeUserStatus
|
||||
{
|
||||
/// <summary>
|
||||
/// 未读
|
||||
/// </summary>
|
||||
[Description("未读")]
|
||||
UNREAD = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 已读
|
||||
/// </summary>
|
||||
[Description("已读")]
|
||||
READ = 1
|
||||
}
|
||||
}
|
||||
19
20220330_Vote/Ewide.Core/Enum/OrgType.cs
Normal file
19
20220330_Vote/Ewide.Core/Enum/OrgType.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public enum OrgType
|
||||
{
|
||||
市住建部门 = 1,
|
||||
|
||||
区住建部门 = 2,
|
||||
|
||||
乡镇街道办事处 = 3,
|
||||
|
||||
片区 = 4
|
||||
}
|
||||
}
|
||||
70
20220330_Vote/Ewide.Core/Enum/QueryTypeEnum.cs
Normal file
70
20220330_Vote/Ewide.Core/Enum/QueryTypeEnum.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询类型的枚举
|
||||
/// </summary>
|
||||
public enum QueryTypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 等于
|
||||
/// </summary>
|
||||
[Description("等于")]
|
||||
Equal = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 模糊
|
||||
/// </summary>
|
||||
[Description("模糊")]
|
||||
Like = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 大于
|
||||
/// </summary>
|
||||
[Description("大于")]
|
||||
GreaterThan = 2,
|
||||
|
||||
/// <summary>
|
||||
/// 小于
|
||||
/// </summary>
|
||||
[Description("小于")]
|
||||
LessThan = 3,
|
||||
|
||||
/// <summary>
|
||||
/// 不等于
|
||||
/// </summary>
|
||||
[Description("不等于")]
|
||||
NotEqual = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 大于等于
|
||||
/// </summary>
|
||||
[Description("大于等于")]
|
||||
GreaterThanOrEqual = 5,
|
||||
|
||||
/// <summary>
|
||||
/// 小于等于
|
||||
/// </summary>
|
||||
[Description("小于等于")]
|
||||
LessThanOrEqual = 6,
|
||||
|
||||
/// <summary>
|
||||
/// 不为空
|
||||
/// </summary>
|
||||
[Description("不为空")]
|
||||
IsNotNull = 7,
|
||||
|
||||
/// <summary>
|
||||
/// 开始于 LIKE Param%
|
||||
/// </summary>
|
||||
[Description("LIKE Param%")]
|
||||
StartWith =8,
|
||||
|
||||
/// <summary>
|
||||
/// 结合于 LIKE %Param
|
||||
/// </summary>
|
||||
[Description("LIKE %Param")]
|
||||
EndWith = 9
|
||||
}
|
||||
}
|
||||
39
20220330_Vote/Ewide.Core/Enum/RequestTypeEnum.cs
Normal file
39
20220330_Vote/Ewide.Core/Enum/RequestTypeEnum.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// http请求类型
|
||||
/// </summary>
|
||||
public enum RequestTypeEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行内部方法
|
||||
/// </summary>
|
||||
Run = 0,
|
||||
|
||||
/// <summary>
|
||||
/// GET请求
|
||||
/// </summary>
|
||||
Get = 1,
|
||||
|
||||
/// <summary>
|
||||
/// POST请求
|
||||
/// </summary>
|
||||
Post = 2,
|
||||
|
||||
/// <summary>
|
||||
/// PUT请求
|
||||
/// </summary>
|
||||
Put = 3,
|
||||
|
||||
/// <summary>
|
||||
/// DELETE请求
|
||||
/// </summary>
|
||||
Delete = 4
|
||||
}
|
||||
}
|
||||
22
20220330_Vote/Ewide.Core/Enum/YesOrNot.cs
Normal file
22
20220330_Vote/Ewide.Core/Enum/YesOrNot.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单激活类型
|
||||
/// </summary>
|
||||
public enum YesOrNot
|
||||
{
|
||||
/// <summary>
|
||||
/// 是
|
||||
/// </summary>
|
||||
[Description("是")]
|
||||
Y = 0,
|
||||
|
||||
/// <summary>
|
||||
/// 否
|
||||
/// </summary>
|
||||
[Description("否")]
|
||||
N = 1
|
||||
}
|
||||
}
|
||||
54
20220330_Vote/Ewide.Core/EventHandlers/LogEventHandler.cs
Normal file
54
20220330_Vote/Ewide.Core/EventHandlers/LogEventHandler.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
using Furion;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.EventBus;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.EventHandlers
|
||||
{
|
||||
/// <summary>
|
||||
/// 日志订阅处理
|
||||
/// </summary>
|
||||
public class LogEventHandler : IEventSubscriber
|
||||
{
|
||||
private readonly ILogger<LogEventHandler> _logger;
|
||||
//private readonly IRepository<SysLogOp> _sysLogOpRep;
|
||||
////private readonly IRepository<SysLogEx> _sysLogExRep;
|
||||
//private readonly IRepository<SysLogVis> _sysLogVisRep;
|
||||
//public LogEventHandler(IRepository<SysLogVis> sysLogVisRep, IRepository<SysLogOp> sysLogOpRep)
|
||||
public LogEventHandler(ILogger<LogEventHandler> logger)
|
||||
{
|
||||
//_sysLogVisRep = sysLogVisRep;
|
||||
//_sysLogOpRep = sysLogOpRep;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
[EventSubscribe("Log:CreateOpLog")]
|
||||
public async Task CreateOpLog(EventHandlerExecutingContext eventMessage)
|
||||
{
|
||||
SysLogOp log = (SysLogOp)eventMessage.Source.Payload;
|
||||
await App.GetService<IRepository<SysLogOp>>().InsertNowAsync(log);
|
||||
}
|
||||
|
||||
//[EventMessage]
|
||||
//public void CreateExLog(EventMessage eventMessage)
|
||||
//{
|
||||
// SysLogEx log = (SysLogEx)eventMessage.Payload;
|
||||
// _sysLogExRep.InsertNow(log);
|
||||
//}
|
||||
|
||||
[EventSubscribe("Log:CreateVisLog")]
|
||||
public async Task CreateVisLog(EventHandlerExecutingContext eventMessage)
|
||||
{
|
||||
SysLogVis log = (SysLogVis)eventMessage.Source.Payload;
|
||||
await App.GetService<IRepository<SysLogVis>>().InsertNowAsync(log);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
69
20220330_Vote/Ewide.Core/Ewide.Core.csproj
Normal file
69
20220330_Vote/Ewide.Core/Ewide.Core.csproj
Normal file
@@ -0,0 +1,69 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<NoWarn>1701;1702;1591</NoWarn>
|
||||
<DocumentationFile>Ewide.Core.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="OAuth\Wechat1\**" />
|
||||
<EmbeddedResource Remove="OAuth\Wechat1\**" />
|
||||
<None Remove="OAuth\Wechat1\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="OAuth\AuthorizeResult.cs" />
|
||||
<Compile Remove="OAuth\IUserInfoModel.cs" />
|
||||
<Compile Remove="OAuth\OAuthLoginBase.cs" />
|
||||
<Compile Remove="Service\Timer\HttpJob.cs" />
|
||||
<Compile Remove="Service\Timer\SchedulerCenter.cs" />
|
||||
<Compile Remove="Service\Timer\SchedulerDef.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Ewide.Core.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="Ewide.Core.xml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="aliyun-net-sdk-core" Version="1.5.10" />
|
||||
<PackageReference Include="CSRedisCore" Version="3.6.6" />
|
||||
<PackageReference Include="Furion.Extras.DatabaseAccessor.SqlSugar" Version="2.20.7" />
|
||||
<PackageReference Include="Kendo.DynamicLinqCore" Version="3.1.1" />
|
||||
<PackageReference Include="Portable.BouncyCastle" Version="1.8.10" />
|
||||
<PackageReference Include="Quartz" Version="3.3.2" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
|
||||
<PackageReference Include="System.Text.Encoding.CodePages" Version="5.0.0" />
|
||||
<PackageReference Include="UAParser" Version="3.1.46" />
|
||||
<PackageReference Include="Furion" Version="2.20.7" />
|
||||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="2.20.7" />
|
||||
<PackageReference Include="Furion.Extras.DatabaseAccessor.Dapper" Version="2.20.7" />
|
||||
<PackageReference Include="Furion.Extras.Logging.Serilog" Version="2.20.7" />
|
||||
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="2.20.7" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Update="Service\CodeGen\Dto\TableOutput.cs">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="applicationconfig.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Properties\PublishProfiles\" />
|
||||
<Folder Include="DataBaseXML\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
7666
20220330_Vote/Ewide.Core/Ewide.Core.xml
Normal file
7666
20220330_Vote/Ewide.Core/Ewide.Core.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,69 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Extension.DataFilter.Entity
|
||||
{
|
||||
public class FilterInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// 查询信息集合
|
||||
/// </summary>
|
||||
private List<SearchInfo> _SearchInfos;
|
||||
|
||||
/// <summary>
|
||||
/// 高级查询信息集合
|
||||
/// </summary>
|
||||
public List<SearchInfo> SearchInfos
|
||||
{
|
||||
get { return _SearchInfos; }
|
||||
}
|
||||
|
||||
public FilterInfo()
|
||||
{
|
||||
_SearchInfos = new List<SearchInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 设置查询信息
|
||||
/// </summary>
|
||||
/// <param name="filterFields"></param>
|
||||
public void SetSearchInfo(SearchInfo[] searchInfo, IEnumerable<string> filterFields)
|
||||
{
|
||||
if (searchInfo == null) return;
|
||||
try
|
||||
{
|
||||
foreach (var elem in searchInfo)
|
||||
{
|
||||
var fieldName = elem.Field;
|
||||
|
||||
if (filterFields.FirstOrDefault(m => m.Equals(fieldName, StringComparison.OrdinalIgnoreCase)) == null) continue;
|
||||
|
||||
var searchStrs = elem.Value;
|
||||
if (searchStrs == null) continue;
|
||||
if (searchStrs.Count == 0) continue;
|
||||
|
||||
var searchInfoEntity = new SearchInfo();
|
||||
searchInfoEntity.Field = fieldName;
|
||||
searchInfoEntity.Type = elem.Type;
|
||||
var searchStrsNode = elem.Value;
|
||||
if (searchStrsNode != null)
|
||||
{
|
||||
foreach (var node in searchStrsNode)
|
||||
{
|
||||
searchInfoEntity.Value.Add(node);
|
||||
}
|
||||
}
|
||||
_SearchInfos.Add(searchInfoEntity);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public class SearchInfo
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 字段名
|
||||
/// </summary>
|
||||
public string Field { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询多个条件
|
||||
/// </summary>
|
||||
public List<string> Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询运算符
|
||||
/// </summary>
|
||||
public string Type { get; set; }
|
||||
|
||||
public QueryTypeEnum QueryType
|
||||
{
|
||||
get
|
||||
{
|
||||
return Type.ToLower() switch
|
||||
{
|
||||
"=" or "equal" => QueryTypeEnum.Equal,
|
||||
"<" or "lessthan" => QueryTypeEnum.LessThan,
|
||||
"<=" or "lessthanorequal" => QueryTypeEnum.LessThanOrEqual,
|
||||
">" or "greaterthan" => QueryTypeEnum.GreaterThan,
|
||||
">=" or "greaterthanorequal" => QueryTypeEnum.GreaterThanOrEqual,
|
||||
"start" => QueryTypeEnum.StartWith,
|
||||
"end" => QueryTypeEnum.EndWith,
|
||||
_ => QueryTypeEnum.Like,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
public SearchInfo()
|
||||
{
|
||||
Value = new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Ewide.Core.Extension.DataFilter.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Extension.DataFilter
|
||||
{
|
||||
public interface IFitlerInfoGetService
|
||||
{
|
||||
FilterInfo GetFilterInfo();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
using Dapper;
|
||||
using Ewide.Core.Extension.DataFilter.Entity;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Extension.DataFilter.WebPage
|
||||
{
|
||||
public class SearchJsonFitlerInfoGetService : IFitlerInfoGetService
|
||||
{
|
||||
protected PageInputBase Input;
|
||||
protected IEnumerable<string> FilterFields;
|
||||
public DynamicParameters sqlParameters = new DynamicParameters();
|
||||
|
||||
public SearchJsonFitlerInfoGetService(PageInputBase input, IEnumerable<string> filterFields, object param = null)
|
||||
{
|
||||
Input = input;
|
||||
FilterFields = filterFields;
|
||||
sqlParameters = new DynamicParameters(param);
|
||||
}
|
||||
|
||||
|
||||
public FilterInfo GetFilterInfo()
|
||||
{
|
||||
var result = new FilterInfo();
|
||||
result.SetSearchInfo(Input.SearchInfo, FilterFields);
|
||||
return result;
|
||||
}
|
||||
|
||||
public string GetWhereSql(string baseSql)
|
||||
{
|
||||
var filterInfo = GetFilterInfo();
|
||||
baseSql = String.Format("SELECT * FROM ({0}) T ", baseSql);
|
||||
var searchInfoList = filterInfo.SearchInfos;
|
||||
if (searchInfoList.Count == 0)
|
||||
return baseSql;
|
||||
List<string> whereSqls = new List<string>();
|
||||
foreach (var elem in searchInfoList.Where(m => m != null))
|
||||
{
|
||||
var r = GetWhereSqlBuild(elem);
|
||||
if (String.IsNullOrWhiteSpace(r)) continue;
|
||||
whereSqls.Add(r);
|
||||
}
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
||||
if (whereSqls.Count > 0)
|
||||
{
|
||||
result.Append(" WHERE ");
|
||||
result.Append(String.Join(" AND ", whereSqls));
|
||||
}
|
||||
return baseSql + result.ToString();
|
||||
}
|
||||
|
||||
#region 私有方法
|
||||
private string GetWhereSqlBuild(SearchInfo searchInfo)
|
||||
{
|
||||
string sqlT = "`{0}` {1} {2}";
|
||||
List<string> whereList = new List<string>();
|
||||
foreach (var elem in searchInfo.Value)
|
||||
{
|
||||
if (String.IsNullOrWhiteSpace(elem)) continue;
|
||||
|
||||
var parameterName = "@" + searchInfo.Field + Guid.NewGuid().ToString();
|
||||
//AddParameter(parameterName, elem);
|
||||
sqlParameters.Add(parameterName, QueryTypeEnum.Like == searchInfo.QueryType ? "%" + elem + "%" : QueryTypeEnum.StartWith == searchInfo.QueryType ? elem + "%" : QueryTypeEnum.EndWith == searchInfo.QueryType ? "%" + elem : elem);
|
||||
whereList.Add(String.Format(sqlT, searchInfo.Field, GetSearchOperatorStr(searchInfo.QueryType), parameterName));
|
||||
}
|
||||
if (whereList.Count == 0) return String.Empty;
|
||||
var resultT = "({0})";
|
||||
var result = String.Format(resultT, String.Join(" OR ", whereList));
|
||||
return result;
|
||||
}
|
||||
|
||||
private string GetSearchOperatorStr(QueryTypeEnum searchOperator)
|
||||
{
|
||||
switch (searchOperator)
|
||||
{
|
||||
case QueryTypeEnum.GreaterThan:
|
||||
return ">";
|
||||
case QueryTypeEnum.GreaterThanOrEqual:
|
||||
return ">=";
|
||||
case QueryTypeEnum.LessThan:
|
||||
return "<";
|
||||
case QueryTypeEnum.LessThanOrEqual:
|
||||
return "<=";
|
||||
case QueryTypeEnum.Equal:
|
||||
return "=";
|
||||
default:
|
||||
return "LIKE";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void AddParameter(string key, object value)
|
||||
{
|
||||
//var parameter = _SqlParameters.ParameterNames.FirstOrDefault(m => m == key);
|
||||
//if (parameter != null)
|
||||
//{
|
||||
// _SqlParameters.
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// _SqlParameters.Add(key, value);
|
||||
//}
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
49
20220330_Vote/Ewide.Core/Extension/DictionaryExtensions.cs
Normal file
49
20220330_Vote/Ewide.Core/Extension/DictionaryExtensions.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 字典扩展
|
||||
/// </summary>
|
||||
public static class DictionaryExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 将一个字典转化为 QueryString
|
||||
/// </summary>
|
||||
/// <param name="dict"></param>
|
||||
/// <param name="urlEncode"></param>
|
||||
/// <returns></returns>
|
||||
public static string ToQueryString(this Dictionary<string, string> dict, bool urlEncode = true)
|
||||
{
|
||||
return string.Join("&", dict.Select(p => $"{(urlEncode ? p.Key?.UrlEncode() : "")}={(urlEncode ? p.Value?.UrlEncode() : "")}"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将一个字符串 URL 编码
|
||||
/// </summary>
|
||||
/// <param name="str"></param>
|
||||
/// <returns></returns>
|
||||
public static string UrlEncode(this string str)
|
||||
{
|
||||
if (string.IsNullOrEmpty(str))
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return System.Web.HttpUtility.UrlEncode(str, Encoding.UTF8);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除空值项
|
||||
/// </summary>
|
||||
/// <param name="dict"></param>
|
||||
public static void RemoveEmptyValueItems(this Dictionary<string, string> dict)
|
||||
{
|
||||
dict.Where(item => string.IsNullOrEmpty(item.Value)).Select(item => item.Key).ToList().ForEach(key =>
|
||||
{
|
||||
dict.Remove(key);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
86
20220330_Vote/Ewide.Core/Extension/InputBase.cs
Normal file
86
20220330_Vote/Ewide.Core/Extension/InputBase.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 通用输入扩展参数(带权限)
|
||||
/// </summary>
|
||||
public class InputBase : PageInputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 授权菜单
|
||||
/// </summary>
|
||||
public List<string> GrantMenuIdList { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 授权角色
|
||||
/// </summary>
|
||||
public virtual List<string> GrantRoleIdList { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// 授权数据
|
||||
/// </summary>
|
||||
public virtual List<string> GrantOrgIdList { get; set; } = new List<string>();
|
||||
/// <summary>
|
||||
/// 授权区域
|
||||
/// </summary>
|
||||
public virtual List<string> GrantAreaCodeList { get; set; } = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通用分页输入参数
|
||||
/// </summary>
|
||||
public class PageInputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 搜索值
|
||||
/// </summary>
|
||||
public virtual string SearchValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当前页码
|
||||
/// </summary>
|
||||
public virtual int PageIndex { get; set; } = 1;
|
||||
|
||||
/// <summary>
|
||||
/// 页码容量
|
||||
/// </summary>
|
||||
public virtual int PageSize { get; set; } = 20;
|
||||
|
||||
/// <summary>
|
||||
/// 搜索开始时间
|
||||
/// </summary>
|
||||
public virtual string SearchBeginTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 搜索结束时间
|
||||
/// </summary>
|
||||
public virtual string SearchEndTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
/// </summary>
|
||||
public virtual string SortField { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend)
|
||||
/// </summary>
|
||||
public virtual string SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 降序排序(不要问我为什么是descend不是desc,前端约定参数就是这样)
|
||||
/// </summary>
|
||||
public virtual string DescStr => "descend";
|
||||
|
||||
/// <summary>
|
||||
/// 查询条件
|
||||
/// </summary>
|
||||
public virtual SearchInfo[] SearchInfo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 树节点数据范围 (1"只看本级" 2"查看本级及以下")
|
||||
/// </summary>
|
||||
public virtual int? TreeNodeDataScope { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
38
20220330_Vote/Ewide.Core/Extension/PageDataResult.cs
Normal file
38
20220330_Vote/Ewide.Core/Extension/PageDataResult.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 小诺分页列表结果
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
public static class PageDataResult<T> where T : new()
|
||||
{
|
||||
public static dynamic PageResult(PagedList<T> page)
|
||||
{
|
||||
return new
|
||||
{
|
||||
PageIndex = page.PageIndex,
|
||||
PageSize = page.PageSize,
|
||||
TotalPage = page.TotalPages,
|
||||
TotalCount = page.TotalCount,
|
||||
Items = page.Items
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public static class PageDataResult
|
||||
{
|
||||
public static dynamic PageResult(PagedList page)
|
||||
{
|
||||
return new
|
||||
{
|
||||
PageIndex = page.PageIndex,
|
||||
PageSize = page.PageSize,
|
||||
TotalPage = page.TotalPages,
|
||||
TotalCount = page.TotalCount,
|
||||
Items = page.Items
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
227
20220330_Vote/Ewide.Core/Extension/PageExtensions.cs
Normal file
227
20220330_Vote/Ewide.Core/Extension/PageExtensions.cs
Normal file
@@ -0,0 +1,227 @@
|
||||
using Dapper;
|
||||
using Ewide.Core.Extension.DataFilter.WebPage;
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.LinqBuilder;
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Linq.Dynamic.Core;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.Extension
|
||||
{
|
||||
public static class PageExtensions
|
||||
{
|
||||
private static string OrderBuilder(PageInputBase pageInput)
|
||||
{
|
||||
var orderStr = string.Empty;
|
||||
if (!string.IsNullOrEmpty(pageInput.SortField))
|
||||
{
|
||||
orderStr = $"{pageInput.SortField} {(pageInput.SortOrder == pageInput.DescStr ? "Desc" : "Asc")}";
|
||||
}
|
||||
return orderStr;
|
||||
}
|
||||
|
||||
private static string OrderBuilder<T>(PageInputBase pageInput, bool descSort = false)
|
||||
{
|
||||
var type = typeof(T);
|
||||
var hasId = type.GetProperty("Id") != null;
|
||||
var hasSort = type.GetProperty("Sort") != null;
|
||||
var hasCreatedTime = type.GetProperty("CreatedTime") != null;
|
||||
|
||||
var defaultField = hasSort ? "Sort" : hasCreatedTime ? "CreatedTime" : hasId ? "Id" : "";
|
||||
|
||||
// 排序优先级 创建时间->序号->ID
|
||||
var orderStr = string.IsNullOrEmpty(defaultField) ? "" : defaultField + (descSort ? " Desc" : " Asc");
|
||||
|
||||
// 排序是否可用-排序字段和排序顺序都为非空才启用排序
|
||||
if (!string.IsNullOrEmpty(pageInput.SortField))
|
||||
{
|
||||
orderStr = OrderBuilder(pageInput);
|
||||
}
|
||||
return orderStr;
|
||||
}
|
||||
|
||||
//public static IQueryable<T> GetFilterInfo<T>(this IQueryable<T> source, PageInputBase input, IEnumerable<string> equalsFields = null, IEnumerable<string> likeFields = null, IEnumerable<string> dateTimeRangeFields = null, IEnumerable<string> otherRangeFields = null) where T : new()
|
||||
//{
|
||||
// var _searchStr = input._Search;
|
||||
// var searchInfoObj = Newtonsoft.Json.JsonConvert.DeserializeObject<DataFilter.Entity.SearchInfo[]>(_searchStr);
|
||||
// foreach(var elem in searchInfoObj)
|
||||
// {
|
||||
// ParameterExpression param = Expression.Parameter(typeof(T), "p");
|
||||
// var field = typeof(T).GetProperty(elem.Field, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
|
||||
// Expression left = Expression.Property(param, field);
|
||||
// Expression<Func<T, bool>> finalExpression = null;
|
||||
// foreach(var value in elem.Value)
|
||||
// {
|
||||
// Expression right = Expression.Constant(Convert.ChangeType(value, Nullable.GetUnderlyingType(left.Type) ?? left.Type));
|
||||
// right = Expression.Convert(right, left.Type);
|
||||
|
||||
// Expression filter = null;
|
||||
// filter = filter.Filter(left, right, elem.QueryType);
|
||||
|
||||
// if (finalExpression == null)
|
||||
// {
|
||||
// finalExpression = Expression.Lambda<Func<T, bool>>(filter, param);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// finalExpression = finalExpression.Or(Expression.Lambda<Func<T, bool>>(filter, param));
|
||||
// }
|
||||
// }
|
||||
// source.Where(finalExpression);
|
||||
// }
|
||||
// return source;
|
||||
//}
|
||||
|
||||
private static Expression Filter(this Expression filter, Expression left, Expression right, Ewide.Core.QueryTypeEnum queryType)
|
||||
{
|
||||
switch (queryType)
|
||||
{
|
||||
//case "=":
|
||||
// filter = Expression.Equal(left, right);
|
||||
// break;
|
||||
//case "<>":
|
||||
//case "!=":
|
||||
// filter = Expression.NotEqual(left, right);
|
||||
// break;
|
||||
case QueryTypeEnum.GreaterThan:
|
||||
filter = Expression.GreaterThan(left, right);
|
||||
break;
|
||||
case QueryTypeEnum.GreaterThanOrEqual:
|
||||
filter = Expression.GreaterThanOrEqual(left, right);
|
||||
break;
|
||||
case QueryTypeEnum.LessThan:
|
||||
filter = Expression.LessThan(left, right);
|
||||
break;
|
||||
case QueryTypeEnum.LessThanOrEqual:
|
||||
filter = Expression.LessThanOrEqual(left, right);
|
||||
break;
|
||||
case QueryTypeEnum.Like:
|
||||
filter = Expression.Call(left, typeof(string).GetMethod("Contains"), right);
|
||||
break;
|
||||
//case "NOT LIKE":
|
||||
// filter = Expression.Not(Expression.Call(left, typeof(string).GetMethod("Contains"), right));
|
||||
// break;
|
||||
default:
|
||||
filter = Expression.Equal(left, right);
|
||||
break;
|
||||
}
|
||||
|
||||
return filter;
|
||||
}
|
||||
|
||||
public static Task<PagedList<T>> ToPageData<T>(this IQueryable<T> source, PageInputBase input) where T : new()
|
||||
{
|
||||
return source.OrderBy(OrderBuilder<T>(input)).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public static Task<PagedList<O>> ToPageData<T, O>(this IQueryable<T> source, PageInputBase input) where O : new()
|
||||
{
|
||||
return source.OrderBy(OrderBuilder<T>(input)).Select(u => u.Adapt<O>()).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
public static Task<PagedList<O>> ToPageData<T, O>(this IQueryable<T> source, PageInputBase input, TypeAdapterConfig config) where O : new()
|
||||
{
|
||||
return source.OrderBy(OrderBuilder<T>(input)).Select(u => u.Adapt<O>(config)).ToPagedListAsync(input.PageIndex, input.PageSize);
|
||||
}
|
||||
|
||||
#region DAPPER
|
||||
public async static Task<PagedList> QueryPageDataDynamic(this IDapperRepository source, string baseSql, PageInputBase input, object param = null, IEnumerable<string> filterFields = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
{
|
||||
SearchJsonFitlerInfoGetService searchJsonFitlerInfoGetService = new SearchJsonFitlerInfoGetService(input, filterFields, param);
|
||||
var sql = searchJsonFitlerInfoGetService.GetWhereSql(baseSql);
|
||||
var sqlParam = searchJsonFitlerInfoGetService.sqlParameters;
|
||||
return await QueryPageData(source, sql, input, sqlParam, transaction, commandTimeout, commandType);
|
||||
}
|
||||
|
||||
public async static Task<PagedList> QueryPageData(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
{
|
||||
var count = await source.PageTotalCount(
|
||||
sql,
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType
|
||||
);
|
||||
|
||||
var data = await source.QueryAsync(
|
||||
PageSqlBuilder(sql, input),
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType
|
||||
);
|
||||
|
||||
var page = new PagedList
|
||||
{
|
||||
PageIndex = input.PageIndex,
|
||||
PageSize = input.PageSize,
|
||||
Items = data,
|
||||
TotalCount = count,
|
||||
TotalPages = input.PageSize.Equals(0) ? 1 : (int)Math.Ceiling((decimal)count / (decimal)input.PageSize)
|
||||
};
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
public async static Task<PagedList<T>> QueryPageData<T>(this IDapperRepository source, string sql, PageInputBase input, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null) where T : new()
|
||||
{
|
||||
var count = await source.PageTotalCount(
|
||||
sql,
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType
|
||||
);
|
||||
|
||||
var data = await source.QueryAsync<T>(
|
||||
PageSqlBuilder(sql, input),
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType
|
||||
);
|
||||
|
||||
var page = new PagedList<T>
|
||||
{
|
||||
PageIndex = input.PageIndex,
|
||||
PageSize = input.PageSize,
|
||||
Items = data,
|
||||
TotalCount = count,
|
||||
TotalPages = input.PageSize.Equals(0) ? 1 : (int)Math.Ceiling((decimal)count / (decimal)input.PageSize)
|
||||
};
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
private async static Task<int> PageTotalCount(this IDapperRepository source, string sql, object param = null, IDbTransaction transaction = null, int? commandTimeout = null, CommandType? commandType = null)
|
||||
{
|
||||
var countSql = String.Format("SELECT COUNT(0) FROM ({0}) T", sql);
|
||||
var countAsync = await source.QueryAsync<int>(
|
||||
countSql,
|
||||
param: param,
|
||||
transaction: transaction,
|
||||
commandTimeout: commandTimeout,
|
||||
commandType: commandType);
|
||||
var count = countAsync.SingleOrDefault();
|
||||
return count;
|
||||
}
|
||||
|
||||
private static string PageSqlBuilder(string sql , PageInputBase input)
|
||||
{
|
||||
var sqlStrList = new List<string>();
|
||||
var orderStr = OrderBuilder(input);
|
||||
if (!string.IsNullOrEmpty(orderStr)) sqlStrList.Add(" ORDER BY " + orderStr);
|
||||
// input.PageSize = 0表示不分页
|
||||
if (input.PageSize != 0) sqlStrList.Add(" LIMIT " + ((input.PageIndex - 1) * input.PageSize).ToString() + "," + input.PageSize.ToString());
|
||||
sql += String.Join("", sqlStrList);
|
||||
return sql;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
197
20220330_Vote/Ewide.Core/Extension/RestfulResultProvider.cs
Normal file
197
20220330_Vote/Ewide.Core/Extension/RestfulResultProvider.cs
Normal file
@@ -0,0 +1,197 @@
|
||||
using Furion.DataValidation;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.UnifyResult;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Furion.UnifyResult.Internal;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 规范化RESTful风格返回值
|
||||
/// </summary>
|
||||
[SuppressSniffer, UnifyModel(typeof(RestfulResult<>))]
|
||||
public class RestfulResultProvider : IUnifyResultProvider
|
||||
{
|
||||
private IActionResult DisplayJson(object data)
|
||||
{
|
||||
return new ContentResult
|
||||
{
|
||||
Content = JsonConvert.SerializeObject(data, Formatting.Indented, new JsonSerializerSettings
|
||||
{
|
||||
ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver(),
|
||||
DateFormatString = "yyyy-MM-dd HH:mm:ss"
|
||||
}),
|
||||
ContentType = "application/json"
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 异常返回值
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="metadata"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnException(ExceptionContext context, ExceptionMetadata metadata)
|
||||
{
|
||||
// 解析异常信息
|
||||
//var (StatusCode, ErrorCode, Errors) = UnifyContext.GetExceptionMetadata(context);
|
||||
// 如果是代码自行抛出的异常,视为接口调用成功,返回结果失败
|
||||
if (context.Exception.GetType() == typeof(Furion.FriendlyException.AppFriendlyException))
|
||||
{
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
BizCode = metadata.ErrorCode,
|
||||
Code = StatusCodes.Status200OK,
|
||||
Success = false,
|
||||
Data = null,
|
||||
Message = metadata.Errors,
|
||||
Extras = UnifyContext.Take(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
});
|
||||
}
|
||||
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
Code = metadata.StatusCode,
|
||||
BizCode = metadata.ErrorCode,
|
||||
Success = false,
|
||||
Data = null,
|
||||
Message = metadata.Errors,
|
||||
Extras = UnifyContext.Take(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 处理输出状态码
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="statusCode"></param>
|
||||
/// <param name="options"></param>
|
||||
/// <returns></returns>
|
||||
public async Task OnResponseStatusCodes(HttpContext context, int statusCode, UnifyResultSettingsOptions unifyResultSettings = default)
|
||||
{
|
||||
switch (statusCode)
|
||||
{
|
||||
// 处理 401 状态码
|
||||
case StatusCodes.Status401Unauthorized:
|
||||
await context.Response.WriteAsJsonAsync(new RestfulResult<object>
|
||||
{
|
||||
Code = StatusCodes.Status401Unauthorized,
|
||||
Success = false,
|
||||
Data = null,
|
||||
Message = "401 未经授权",
|
||||
Extras = UnifyContext.Take(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
});
|
||||
break;
|
||||
// 处理 403 状态码
|
||||
case StatusCodes.Status403Forbidden:
|
||||
await context.Response.WriteAsJsonAsync(new RestfulResult<object>
|
||||
{
|
||||
Code = StatusCodes.Status403Forbidden,
|
||||
Success = false,
|
||||
Data = null,
|
||||
Message = "403 禁止访问",
|
||||
Extras = UnifyContext.Take(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
});
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 成功返回值
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnSucceeded(ActionExecutedContext context, object data)
|
||||
{
|
||||
//object data;
|
||||
// 处理内容结果
|
||||
if (context.Result is ContentResult contentResult) data = contentResult.Content;
|
||||
// 处理对象结果
|
||||
else if (context.Result is ObjectResult objectResult) data = objectResult.Value;
|
||||
else if (context.Result is EmptyResult) data = null;
|
||||
else return null;
|
||||
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
Code = context.Result is EmptyResult ? StatusCodes.Status204NoContent : StatusCodes.Status200OK, // 处理没有返回值情况 204
|
||||
Success = true,
|
||||
Data = data,
|
||||
Message = "请求成功",
|
||||
Extras = UnifyContext.Take(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证失败返回值
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <param name="metadata"></param>
|
||||
/// <returns></returns>
|
||||
public IActionResult OnValidateFailed(ActionExecutingContext context, ValidationMetadata metadata)
|
||||
{
|
||||
return DisplayJson(new RestfulResult<object>
|
||||
{
|
||||
Code = StatusCodes.Status400BadRequest,
|
||||
Success = false,
|
||||
Data = null,
|
||||
Message = metadata.ValidationResult,// validationResults,
|
||||
Extras = UnifyContext.Take(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// RESTful风格---XIAONUO返回格式
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
[SuppressSniffer]
|
||||
public class RestfulResult<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// 执行成功
|
||||
/// </summary>
|
||||
public bool Success { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态码
|
||||
/// </summary>
|
||||
public int? Code { get; set; }
|
||||
//业务码
|
||||
public object BizCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误信息
|
||||
/// </summary>
|
||||
public object Message { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 数据
|
||||
/// </summary>
|
||||
public T Data { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 附加数据
|
||||
/// </summary>
|
||||
public object Extras { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 时间戳
|
||||
/// </summary>
|
||||
public long Timestamp { get; set; }
|
||||
}
|
||||
}
|
||||
24
20220330_Vote/Ewide.Core/Filter/LogExceptionHandler.cs
Normal file
24
20220330_Vote/Ewide.Core/Filter/LogExceptionHandler.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.FriendlyException;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using Serilog;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 全局异常处理
|
||||
/// </summary>
|
||||
public class LogExceptionHandler : IGlobalExceptionHandler, ISingleton
|
||||
{
|
||||
public Task OnExceptionAsync(ExceptionContext context)
|
||||
{
|
||||
//context.Exception.ToString().LogError("错误");
|
||||
|
||||
// 写日志
|
||||
Log.Error(context.Exception.ToString());
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
114
20220330_Vote/Ewide.Core/Filter/RequestActionFilter.cs
Normal file
114
20220330_Vote/Ewide.Core/Filter/RequestActionFilter.cs
Normal file
@@ -0,0 +1,114 @@
|
||||
using Furion.DatabaseAccessor.Extensions;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc.Controllers;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Security.Claims;
|
||||
using System.Threading.Tasks;
|
||||
using UAParser;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Reflection;
|
||||
using Ewide.Core.Attributes;
|
||||
using System.Linq;
|
||||
using Furion;
|
||||
using Furion.EventBus;
|
||||
//using Furion.EventBridge;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 请求日志拦截
|
||||
/// </summary>
|
||||
public class RequestActionFilter : IAsyncActionFilter
|
||||
{
|
||||
public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
|
||||
{
|
||||
var httpContext = context.HttpContext;
|
||||
var httpRequest = httpContext.Request;
|
||||
|
||||
var sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
var actionContext = await next();
|
||||
sw.Stop();
|
||||
|
||||
// 判断是否请求成功(没有异常就是请求成功)
|
||||
var isRequestSucceed = actionContext.Exception == null;
|
||||
|
||||
var clent = Parser.GetDefault().Parse(httpContext.Request.Headers["User-Agent"]);
|
||||
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;
|
||||
var descAtt = Attribute.GetCustomAttribute(actionDescriptor.MethodInfo, typeof(DescriptionAttribute)) as DescriptionAttribute;
|
||||
|
||||
//获取操作类型
|
||||
var method = actionDescriptor.MethodInfo;
|
||||
var opAttr = method.GetCustomAttribute<OpAttribute>();
|
||||
var opType = opAttr?.OpType ?? InferOpType(httpRequest);
|
||||
|
||||
var message = "请求成功";
|
||||
if (isRequestSucceed)
|
||||
{
|
||||
var result = actionContext.Result;
|
||||
var resultType = result.GetType();
|
||||
if (resultType.Name == "ContentResult")
|
||||
{
|
||||
var resultContent = ((Microsoft.AspNetCore.Mvc.ContentResult)actionContext.Result)?.Content;
|
||||
var resultJson = JsonConvert.DeserializeObject<JObject>(resultContent);
|
||||
message = resultJson["message"]?.ToString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
message = actionContext.Exception.Message;
|
||||
}
|
||||
|
||||
var sysOpLog = new SysLogOp
|
||||
{
|
||||
Name = descAtt != null ? descAtt.Description : actionDescriptor.ActionName,
|
||||
OpType = opType,
|
||||
Success = isRequestSucceed,
|
||||
Message = message,
|
||||
Ip = httpContext.GetRemoteIpAddressToIPv4(),
|
||||
Location = httpRequest.GetRequestUrlAddress(),
|
||||
Browser = clent.UA.Family + clent.UA.Major,
|
||||
Os = clent.OS.Family + clent.OS.Major,
|
||||
Url = httpRequest.Path,
|
||||
ClassName = context.Controller.ToString(),
|
||||
MethodName = actionDescriptor.ActionName,
|
||||
ReqMethod = httpRequest.Method,
|
||||
Param = JsonConvert.SerializeObject(context.ActionArguments),
|
||||
// Result = resultContent,
|
||||
ElapsedTime = sw.ElapsedMilliseconds,
|
||||
OpTime = DateTime.Now,
|
||||
Account = httpContext.User?.FindFirstValue(ClaimConst.CLAINM_ACCOUNT)
|
||||
};
|
||||
//await Event.EmitAsync("Log:CreateOpLog", sysOpLog);
|
||||
await App.GetService<IEventPublisher>().PublishAsync(new ChannelEventSource("Log:CreateOpLog", sysOpLog));
|
||||
}
|
||||
/// <summary>
|
||||
/// 使用路由推断
|
||||
/// </summary>
|
||||
/// <param name="request"></param>
|
||||
/// <returns></returns>
|
||||
int InferOpType(HttpRequest request)
|
||||
{
|
||||
var lastRoute = request.Path.Value.Split("/").Last();
|
||||
var opNames = Enum.GetNames(typeof(LogOpType));
|
||||
foreach (var op in opNames)
|
||||
{
|
||||
if (lastRoute.Contains(op, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return (int)Enum.Parse(typeof(LogOpType), op);
|
||||
}
|
||||
}
|
||||
if (lastRoute.Contains("page", StringComparison.OrdinalIgnoreCase) ||
|
||||
lastRoute.Contains("list", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return (int)LogOpType.QUERY;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
44
20220330_Vote/Ewide.Core/Manager/IUserManager.cs
Normal file
44
20220330_Vote/Ewide.Core/Manager/IUserManager.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
public interface IUserManager
|
||||
{
|
||||
string Account { get; }
|
||||
string Name { get; }
|
||||
bool SuperAdmin { get; }
|
||||
SysUser User { get; }
|
||||
string UserId { get; }
|
||||
|
||||
Task<SysUser> CheckUserAsync(string userId);
|
||||
Task<SysUser> CheckUserAsync();
|
||||
Task<SysEmp> GetUserEmpInfo(string userId);
|
||||
Task<SysEmp> GetUserEmpInfo();
|
||||
Task<SysOrg> GetUserOrgInfo(string userId);
|
||||
Task<SysOrg> GetUserOrgInfo();
|
||||
Task<List<string>> GetUserRoleIdList(string userId);
|
||||
Task<List<string>> GetUserRoleIdList();
|
||||
Task<List<SysRole>> GetUserRoleList(string userId);
|
||||
Task<List<SysRole>> GetUserRoleList();
|
||||
Task<List<string>> GetLoginPermissionList();
|
||||
//获取用户额外授权的组织信息
|
||||
Task<List<string>> GetUserExtraDataScopeList();
|
||||
Task<List<string>> GetUserExtraDataScopeList(string userId);
|
||||
//获取用户额外授权的区域信息
|
||||
Task<List<string>> GetUserExtraAreaScopeList();
|
||||
Task<List<string>> GetUserExtraAreaScopeList(string userId);
|
||||
//获取角色额外授权的组织信息
|
||||
Task<List<string>> GetRoleExtraDataScopeList(string roleId);
|
||||
//获取角色额外授权的区域信息
|
||||
Task<List<string>> GetRoleExtraAreaScopeList(string roleId);
|
||||
Task<List<string>> GetUserAllAreaList();
|
||||
Task<List<string>> GetUserAllAreaList(string userId);
|
||||
|
||||
//获取用户的授权范围
|
||||
Task<List<string>> GetUserAllDataScopeList();
|
||||
Task<List<string>> GetUserAllDataScopeList(string userId);
|
||||
|
||||
}
|
||||
}
|
||||
386
20220330_Vote/Ewide.Core/Manager/UserManager.cs
Normal file
386
20220330_Vote/Ewide.Core/Manager/UserManager.cs
Normal file
@@ -0,0 +1,386 @@
|
||||
using Furion.DatabaseAccessor;
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.FriendlyException;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using Ewide.Core.Service;
|
||||
using System;
|
||||
using System.Data;
|
||||
|
||||
namespace Ewide.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户管理
|
||||
/// </summary>
|
||||
public class UserManager : IUserManager, IScoped
|
||||
{
|
||||
private readonly IRepository<SysUser> _sysUserRep; // 用户表仓储
|
||||
private readonly IRepository<SysRole> _sysRoleRep;
|
||||
private readonly IRepository<SysUserRole> _sysUserRoleRep;
|
||||
private readonly IRepository<SysEmp> _sysEmpRep; // 员工表
|
||||
private readonly IRepository<SysOrg> _sysOrgRep;
|
||||
private readonly IRepository<SysRoleMenu> _sysRoleMenuRep;
|
||||
private readonly IRepository<SysMenu> _sysMenuRep;
|
||||
private readonly IRepository<SysUserDataScope> _sysUserDataScopeRep;
|
||||
private readonly IRepository<SysUserArea> _sysUserAreaRep;
|
||||
private readonly IRepository<SysRoleDataScope> _sysRoleDataRep;
|
||||
private readonly IRepository<SysRoleArea> _sysRoleAreaRep;
|
||||
private readonly IRepository<SysAreaCode> _sysAreaCodeRep;
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly ISysCacheService _sysCacheService;
|
||||
|
||||
public string UserId
|
||||
{
|
||||
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_USERID)?.Value;
|
||||
}
|
||||
|
||||
public string Account
|
||||
{
|
||||
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_NAME)?.Value;
|
||||
}
|
||||
|
||||
public bool SuperAdmin
|
||||
{
|
||||
get => _httpContextAccessor.HttpContext.User.FindFirst(ClaimConst.CLAINM_SUPERADMIN)?.Value == ((int)AdminType.SuperAdmin).ToString();
|
||||
}
|
||||
|
||||
public SysUser User
|
||||
{
|
||||
get => _sysUserRep.Find(UserId);
|
||||
}
|
||||
|
||||
public UserManager(
|
||||
IHttpContextAccessor httpContextAccessor,
|
||||
ISysCacheService sysCacheService,
|
||||
IRepository<SysUser> sysUserRep,
|
||||
IRepository<SysRole> sysRoleRep,
|
||||
IRepository<SysUserRole> sysUserRoleRep,
|
||||
IRepository<SysEmp> sysEmpRep,
|
||||
IRepository<SysOrg> sysOrgRep,
|
||||
IRepository<SysRoleMenu> sysRoleMenuRep,
|
||||
IRepository<SysMenu> sysMenuRep,
|
||||
IRepository<SysUserDataScope> sysUserDataScopeRep, IRepository<SysUserArea> sysUserAreaRep, IRepository<SysRoleDataScope> sysRoleDataRep, IRepository<SysRoleArea> sysRoleAreaRep, IRepository<SysAreaCode> sysAreaCodeRep)
|
||||
{
|
||||
_sysUserRep = sysUserRep;
|
||||
_sysRoleRep = sysRoleRep;
|
||||
_sysUserRoleRep = sysUserRoleRep;
|
||||
_sysEmpRep = sysEmpRep;
|
||||
_sysOrgRep = sysOrgRep;
|
||||
_httpContextAccessor = httpContextAccessor;
|
||||
_sysCacheService = sysCacheService;
|
||||
_sysRoleMenuRep = sysRoleMenuRep;
|
||||
_sysMenuRep = sysMenuRep;
|
||||
_sysUserDataScopeRep = sysUserDataScopeRep;
|
||||
_sysUserAreaRep = sysUserAreaRep;
|
||||
_sysRoleDataRep = sysRoleDataRep;
|
||||
_sysRoleAreaRep = sysRoleAreaRep;
|
||||
_sysAreaCodeRep = sysAreaCodeRep;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<SysUser> CheckUserAsync(string userId)
|
||||
{
|
||||
var user = await _sysUserRep.FirstOrDefaultAsync(u => u.Id == userId, false);
|
||||
return user ?? throw Oops.Oh(ErrorCode.D1002);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<SysUser> CheckUserAsync()
|
||||
{
|
||||
return await CheckUserAsync(UserId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户员工信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<SysEmp> GetUserEmpInfo(string userId)
|
||||
{
|
||||
var emp = await _sysEmpRep.FirstOrDefaultAsync(u => u.Id == userId, false);
|
||||
return emp ?? throw Oops.Oh(ErrorCode.D1002);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户员工信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<SysEmp> GetUserEmpInfo()
|
||||
{
|
||||
return await GetUserEmpInfo(UserId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户部门信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<SysOrg> GetUserOrgInfo(string userId)
|
||||
{
|
||||
var emp = await GetUserEmpInfo(userId);
|
||||
var org = await _sysOrgRep.FirstOrDefaultAsync(u => u.Id == emp.OrgId, false);
|
||||
return org ?? throw Oops.Oh(ErrorCode.D1002);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户部门信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<SysOrg> GetUserOrgInfo()
|
||||
{
|
||||
return await GetUserOrgInfo(UserId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色Id列表
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<string>> GetUserRoleIdList(string userId)
|
||||
{
|
||||
var roleIds = await _sysUserRoleRep.DetachedEntities.Where(u => u.SysUserId == userId).Select(u => u.SysRoleId).ToListAsync();
|
||||
return roleIds;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色Id列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<string>> GetUserRoleIdList()
|
||||
{
|
||||
return await GetUserRoleIdList(UserId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色列表
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SysRole>> GetUserRoleList(string userId)
|
||||
{
|
||||
var roleIds = await GetUserRoleIdList(userId);
|
||||
var roles = await _sysRoleRep.DetachedEntities.Where(u => roleIds.Contains(u.Id)).ToListAsync();
|
||||
return roles;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取用户角色列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<SysRole>> GetUserRoleList()
|
||||
{
|
||||
return await GetUserRoleList(UserId);
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetLoginPermissionList()
|
||||
{
|
||||
var permissions = await _sysCacheService.GetPermission(UserId); // 先从缓存里面读取
|
||||
if (permissions == null || permissions.Count < 1)
|
||||
{
|
||||
var roleIdList = await GetUserRoleIdList();
|
||||
var menuIdList = await _sysRoleMenuRep.DetachedEntities
|
||||
.Where(u => roleIdList.Contains(u.SysRoleId))
|
||||
.Select(u => u.SysMenuId).ToListAsync();
|
||||
permissions = await _sysMenuRep.DetachedEntities.Where(u => menuIdList.Contains(u.Id))
|
||||
.Where(u => u.Type == (int)MenuType.FUNCTION)
|
||||
.Where(u => u.Status == (int)CommonStatus.ENABLE)
|
||||
.Select(u => u.Permission).ToListAsync();
|
||||
#if DEBUG
|
||||
#else
|
||||
await _sysCacheService.SetPermission(UserId, permissions); // 缓存结果
|
||||
#endif
|
||||
}
|
||||
return permissions;
|
||||
}
|
||||
|
||||
public Task<List<string>> GetUserExtraDataScopeList()
|
||||
{
|
||||
return GetUserExtraDataScopeList(UserId);
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetUserExtraDataScopeList(string userId)
|
||||
{
|
||||
return await _sysUserDataScopeRep.DetachedEntities
|
||||
.Where(u => u.SysUserId == userId)
|
||||
.Select(u => u.SysOrgId).ToListAsync();
|
||||
}
|
||||
|
||||
public Task<List<string>> GetUserExtraAreaScopeList()
|
||||
{
|
||||
return GetUserExtraAreaScopeList(UserId);
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetUserExtraAreaScopeList(string userId)
|
||||
{
|
||||
return await _sysUserAreaRep.DetachedEntities.Where(u => u.SysUserId == userId).Select(u => u.AreaCode).ToListAsync();
|
||||
}
|
||||
|
||||
public Task<List<string>> GetRoleExtraDataScopeList(string roleId)
|
||||
{
|
||||
return _sysRoleDataRep.DetachedEntities.Where(u => u.SysRoleId == roleId).Select(u => u.SysOrgId).ToListAsync();
|
||||
}
|
||||
|
||||
public Task<List<string>> GetRoleExtraAreaScopeList(string roleId)
|
||||
{
|
||||
return _sysRoleAreaRep.DetachedEntities.Where(u => u.SysRoleId == roleId).Select(u => u.AreaCode).ToListAsync();
|
||||
}
|
||||
public Task<List<string>> GetUserAllDataScopeList()
|
||||
{
|
||||
return GetUserAllDataScopeList(UserId);
|
||||
}
|
||||
public async Task<List<string>> GetDataScopeListByDataScopeType(int dataScopeType, string orgId)
|
||||
{
|
||||
var orgIdList = new List<string>();
|
||||
if (string.IsNullOrEmpty(orgId))
|
||||
return orgIdList;
|
||||
|
||||
// 如果是范围类型是全部数据,则获取当前所有的组织架构Id
|
||||
if (dataScopeType == (int)DataScopeType.ALL)
|
||||
{
|
||||
orgIdList = await _sysOrgRep.DetachedEntities.Where(u => u.Status == (int)CommonStatus.ENABLE).Select(u => u.Id).ToListAsync();
|
||||
}
|
||||
// 如果范围类型是本部门及以下部门,则查询本节点和子节点集合,包含本节点
|
||||
else if (dataScopeType == (int)DataScopeType.DEPT_WITH_CHILD)
|
||||
{
|
||||
orgIdList = await _sysOrgRep.DetachedEntities
|
||||
.Where(u => u.Pids.Contains(orgId))
|
||||
.Select(u => u.Id).ToListAsync();
|
||||
orgIdList.Add(orgId);
|
||||
}
|
||||
// 如果数据范围是本部门,不含子节点,则直接返回本部门
|
||||
else if (dataScopeType == (int)DataScopeType.DEPT)
|
||||
{
|
||||
orgIdList.Add(orgId);
|
||||
}
|
||||
return orgIdList;
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetUserAllDataScopeList(string userId)
|
||||
{
|
||||
var dataScopes = await _sysCacheService.GetDataScope(userId); // 先从缓存里面读取
|
||||
if (dataScopes != null && dataScopes.Count > 0)
|
||||
{
|
||||
return dataScopes;
|
||||
}
|
||||
var orgId = await _sysEmpRep.DetachedEntities.Where(e => e.Id == userId).Select(u => u.OrgId).SingleAsync();
|
||||
var orgAreaCode = await _sysOrgRep.Where(o => o.Id == orgId).Select(o => o.AreaCode).SingleAsync();
|
||||
//获取用户额外授权数据
|
||||
var userExtraDataScope = await (from org in _sysOrgRep.DetachedEntities
|
||||
join ua in _sysUserAreaRep.DetachedEntities on org.AreaCode equals ua.AreaCode
|
||||
where ua.SysUserId == userId
|
||||
select org.Id).Concat(from ud in _sysUserDataScopeRep.DetachedEntities
|
||||
where ud.SysUserId == userId
|
||||
select ud.SysOrgId).ToListAsync();
|
||||
//获取用户所有角色
|
||||
//获取其他类型中最大的角色
|
||||
var areaScopeTypes = new[] { DataScopeType.AREA, DataScopeType.AREA_WITH_CHILD }.Cast<int>();
|
||||
var strongerDataScopeType = (int)DataScopeType.SELF;
|
||||
var strongerAreaType = (int)DataScopeType.SELF;
|
||||
|
||||
//获取区域相关的角色类型中最大的区域角色
|
||||
var customDataScopeRoleIdList = new List<string>();
|
||||
var roleList = from role in _sysRoleRep.DetachedEntities
|
||||
join ur in _sysUserRoleRep.DetachedEntities on role.Id equals ur.SysRoleId
|
||||
where ur.SysUserId == userId
|
||||
select role;
|
||||
foreach (var role in await roleList.ToListAsync())
|
||||
{
|
||||
if (role.DataScopeType == (int)DataScopeType.DEFINE)
|
||||
customDataScopeRoleIdList.Add(role.Id);
|
||||
if ((role.DataScopeType == (int)DataScopeType.AREA || role.DataScopeType == (int)DataScopeType.AREA_WITH_CHILD) && strongerAreaType < role.DataScopeType)
|
||||
{
|
||||
strongerAreaType = role.DataScopeType;
|
||||
}
|
||||
else if (role.DataScopeType <= strongerDataScopeType)
|
||||
strongerDataScopeType = role.DataScopeType;
|
||||
}
|
||||
// 自定义数据范围的角色对应的数据范围
|
||||
var roleDataScopeIdList = await _sysRoleDataRep.DetachedEntities.Where(rd => customDataScopeRoleIdList.Contains(rd.SysRoleId)).Select(rd => orgId).ToListAsync();
|
||||
|
||||
// 角色中拥有最大数据范围类型的数据范围
|
||||
var dataScopeIdList = await GetDataScopeListByDataScopeType(strongerDataScopeType, orgId);
|
||||
//角色区域数据范围
|
||||
var areaOrgIdList = new List<string>();
|
||||
if (strongerAreaType == (int)DataScopeType.AREA_WITH_CHILD)
|
||||
areaOrgIdList = await _sysOrgRep.DetachedEntities.Where(p => p.AreaCode.StartsWith(orgAreaCode)).Select(p => p.Id).ToListAsync();
|
||||
if (strongerAreaType == (int)DataScopeType.AREA)
|
||||
areaOrgIdList = await _sysOrgRep.DetachedEntities.Where(p => p.AreaCode == orgAreaCode).Select(p => p.Id).ToListAsync();
|
||||
//获取
|
||||
var scope = userExtraDataScope.Concat(roleDataScopeIdList).Concat(dataScopeIdList).Concat(areaOrgIdList).Distinct().ToList();
|
||||
#if DEBUG
|
||||
#else
|
||||
await _sysCacheService.SetDataScope(userId, scope);
|
||||
#endif
|
||||
return scope;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取用户可以访问的区域权限
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<List<string>> GetUserAllAreaList()
|
||||
{
|
||||
return GetUserAllAreaList(UserId);
|
||||
}
|
||||
|
||||
public async Task<List<string>> GetUserAllAreaList(string userId)
|
||||
{
|
||||
var orgId = await _sysEmpRep.DetachedEntities.Where(e => e.Id == userId).Select(u => u.OrgId).SingleAsync();
|
||||
var orgAreaCode = await _sysOrgRep.Where(o => o.Id == orgId).Select(o => o.AreaCode).SingleAsync();
|
||||
//本部门 或者 本部门区域 树结构只显示本级区域
|
||||
//本部门及以下 或者 本部门区域及以下 树结构显示本级和以下所有区域
|
||||
var extraUserArea = await GetUserExtraAreaScopeList(userId);
|
||||
var roles = await _sysUserRoleRep.DetachedEntities.Include(ur => ur.SysRole).Where(ur => ur.SysUserId == userId).Select(ur => ur.SysRole).ToListAsync();
|
||||
var customAreaRole = roles.Where(r => r.DataScopeType == (int)DataScopeType.DEFINE).Select(r => r.Id);
|
||||
var extraRoleArea = await _sysRoleAreaRep.DetachedEntities.Where(ra => customAreaRole.Contains(ra.SysRoleId)).Select(ra => ra.AreaCode).ToListAsync();
|
||||
var roleTypeArea = await GetUserDataScopeTypeAreaList(orgAreaCode, roles.Select(r => r.DataScopeType).ToList());
|
||||
var extraArea = await GetUserExtraAreaList(extraRoleArea.Concat(extraUserArea).Distinct().ToList());
|
||||
return extraArea.Concat(roleTypeArea).Distinct().ToList();
|
||||
}
|
||||
private async Task<List<string>> GetUserExtraAreaList(List<string> extraAreaCode)
|
||||
{
|
||||
var cachedAreaCode = await GetCachedAreaCode();
|
||||
return cachedAreaCode.Select(a => a.Code).Where(a => extraAreaCode.Any(e => a.StartsWith(e))).ToList();
|
||||
}
|
||||
private async Task<List<string>> GetUserDataScopeTypeAreaList(string orgAreaCode, List<int> roleDataTypeList)
|
||||
{
|
||||
var areaCode = await GetCachedAreaCode();
|
||||
if (roleDataTypeList.Any(r => r == (int)DataScopeType.ALL))
|
||||
{
|
||||
return areaCode.Select(a => a.Code).ToList();
|
||||
}
|
||||
if (roleDataTypeList.Any(r => new[] { DataScopeType.DEPT_WITH_CHILD, DataScopeType.AREA_WITH_CHILD }.Cast<int>().Contains(r)))
|
||||
{
|
||||
return areaCode.Where(a => a.Code.StartsWith(orgAreaCode)).Select(a => a.Code).ToList();
|
||||
}
|
||||
if (roleDataTypeList.Any(r => new[] { DataScopeType.DEPT, DataScopeType.AREA }.Cast<int>().Contains(r)))
|
||||
{
|
||||
return areaCode.Where(a => a.Code == orgAreaCode).Select(a => a.Code).ToList();
|
||||
}
|
||||
return new List<string>();
|
||||
}
|
||||
private async Task<List<SysAreaCode>> GetCachedAreaCode()
|
||||
{
|
||||
var areaCodeList = await _sysCacheService.GetAreaCode();
|
||||
if (areaCodeList == null || areaCodeList.Count < 1)
|
||||
{
|
||||
areaCodeList = await _sysAreaCodeRep.DetachedEntities.ToListAsync();
|
||||
}
|
||||
return areaCodeList;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
20220330_Vote/Ewide.Core/OAuth/IWechatOAuth.cs
Normal file
12
20220330_Vote/Ewide.Core/OAuth/IWechatOAuth.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.OAuth
|
||||
{
|
||||
public interface IWechatOAuth
|
||||
{
|
||||
Task<TokenModel> GetAccessTokenAsync(string code, string state = "");
|
||||
string GetAuthorizeUrl(string state = "");
|
||||
Task<UserInfoModel> GetUserInfoAsync(string accessToken, string openId);
|
||||
Task<TokenModel> GetRefreshTokenAsync(string refreshToken);
|
||||
}
|
||||
}
|
||||
49
20220330_Vote/Ewide.Core/OAuth/OAuthConfig.cs
Normal file
49
20220330_Vote/Ewide.Core/OAuth/OAuthConfig.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Ewide.Core.OAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// OAuth配置---此结构方便拓展
|
||||
/// </summary>
|
||||
public class OAuthConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// AppId
|
||||
/// </summary>
|
||||
public string AppId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Secret Key
|
||||
/// </summary>
|
||||
public string AppKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 回调地址
|
||||
/// </summary>
|
||||
public string RedirectUri { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限范围
|
||||
/// </summary>
|
||||
public string Scope { get; set; }
|
||||
|
||||
public static OAuthConfig LoadFrom(IConfiguration configuration, string prefix)
|
||||
{
|
||||
return With(appId: configuration[prefix + ":app_id"],
|
||||
appKey: configuration[prefix + ":app_key"],
|
||||
redirectUri: configuration[prefix + ":redirect_uri"],
|
||||
scope: configuration[prefix + ":scope"]);
|
||||
}
|
||||
|
||||
private static OAuthConfig With(string appId, string appKey, string redirectUri, string scope)
|
||||
{
|
||||
return new OAuthConfig()
|
||||
{
|
||||
AppId = appId,
|
||||
AppKey = appKey,
|
||||
RedirectUri = redirectUri,
|
||||
Scope = scope
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
67
20220330_Vote/Ewide.Core/OAuth/TokenModel.cs
Normal file
67
20220330_Vote/Ewide.Core/OAuth/TokenModel.cs
Normal file
@@ -0,0 +1,67 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ewide.Core.OAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// AccessToken参数
|
||||
/// </summary>
|
||||
public class TokenModel
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户标识
|
||||
/// </summary>
|
||||
[JsonPropertyName("openid")]
|
||||
public string OpenId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Token 类型
|
||||
/// </summary>
|
||||
[JsonPropertyName("token_type")]
|
||||
public string TokenType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AccessToken
|
||||
/// </summary>
|
||||
[JsonPropertyName("access_token")]
|
||||
public string AccessToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用于刷新 AccessToken 的 Token
|
||||
/// </summary>
|
||||
[JsonPropertyName("refresh_token")]
|
||||
public string RefreshToken { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 此 AccessToken 对应的权限
|
||||
/// </summary>
|
||||
[JsonPropertyName("scope")]
|
||||
public string Scope { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// AccessToken 过期时间
|
||||
/// </summary>
|
||||
[JsonPropertyName("expires_in")]
|
||||
public dynamic ExpiresIn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误的详细描述
|
||||
/// </summary>
|
||||
[JsonPropertyName("error_description")]
|
||||
public string ErrorDescription { get; set; }
|
||||
}
|
||||
|
||||
public static class AccessTokenModelModelExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取的Token是否包含错误
|
||||
/// </summary>
|
||||
/// <param name="accessTokenModel"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasError(this TokenModel accessTokenModel)
|
||||
{
|
||||
return accessTokenModel == null ||
|
||||
string.IsNullOrEmpty(accessTokenModel.AccessToken) ||
|
||||
!string.IsNullOrEmpty(accessTokenModel.ErrorDescription);
|
||||
}
|
||||
}
|
||||
}
|
||||
62
20220330_Vote/Ewide.Core/OAuth/UserInfoModel.cs
Normal file
62
20220330_Vote/Ewide.Core/OAuth/UserInfoModel.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ewide.Core.OAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// 微信用户参数
|
||||
/// </summary>
|
||||
public class UserInfoModel
|
||||
{
|
||||
[JsonPropertyName("nickname")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("headimgurl")]
|
||||
public string Avatar { get; set; }
|
||||
|
||||
[JsonPropertyName("language")]
|
||||
public string Language { get; set; }
|
||||
|
||||
[JsonPropertyName("openid")]
|
||||
public string Openid { get; set; }
|
||||
|
||||
[JsonPropertyName("sex")]
|
||||
public int Sex { get; set; }
|
||||
|
||||
[JsonPropertyName("province")]
|
||||
public string Province { get; set; }
|
||||
|
||||
[JsonPropertyName("city")]
|
||||
public string City { get; set; }
|
||||
|
||||
[JsonPropertyName("country")]
|
||||
public string Country { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户特权信息,json 数组,如微信沃卡用户为(chinaunicom)
|
||||
/// </summary>
|
||||
[JsonPropertyName("privilege")]
|
||||
public List<string> Privilege { get; set; }
|
||||
|
||||
[JsonPropertyName("unionid")]
|
||||
public string UnionId { get; set; }
|
||||
|
||||
[JsonPropertyName("errmsg")]
|
||||
public string ErrorMessage { get; set; }
|
||||
}
|
||||
|
||||
public static class UserInfoModelExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取的用户是否包含错误
|
||||
/// </summary>
|
||||
/// <param name="userInfoModel"></param>
|
||||
/// <returns></returns>
|
||||
public static bool HasError(this UserInfoModel userInfoModel)
|
||||
{
|
||||
return userInfoModel == null ||
|
||||
string.IsNullOrEmpty(userInfoModel.Name) ||
|
||||
!string.IsNullOrEmpty(userInfoModel.ErrorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
102
20220330_Vote/Ewide.Core/OAuth/WechatOAuth.cs
Normal file
102
20220330_Vote/Ewide.Core/OAuth/WechatOAuth.cs
Normal file
@@ -0,0 +1,102 @@
|
||||
using Furion.DependencyInjection;
|
||||
using Furion.FriendlyException;
|
||||
using Furion.RemoteRequest.Extensions;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Ewide.Core.OAuth
|
||||
{
|
||||
public class WechatOAuth : IWechatOAuth, ISingleton
|
||||
{
|
||||
private readonly string _authorizeUrl = "https://open.weixin.qq.com/connect/oauth2/authorize";
|
||||
private readonly string _accessTokenUrl = "https://api.weixin.qq.com/sns/oauth2/access_token";
|
||||
private readonly string _refreshTokenUrl = "https://api.weixin.qq.com/sns/oauth2/refresh_token";
|
||||
private readonly string _userInfoUrl = "https://api.weixin.qq.com/sns/userinfo";
|
||||
|
||||
private readonly OAuthConfig _oauthConfig;
|
||||
|
||||
public WechatOAuth(IConfiguration configuration)
|
||||
{
|
||||
_oauthConfig = OAuthConfig.LoadFrom(configuration, "oauth:wechat");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发起授权
|
||||
/// </summary>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public string GetAuthorizeUrl(string state = "")
|
||||
{
|
||||
var param = new Dictionary<string, string>()
|
||||
{
|
||||
["appid"] = _oauthConfig.AppId,
|
||||
["redirect_uri"] = _oauthConfig.RedirectUri,
|
||||
["response_type"] = "code",
|
||||
["scope"] = _oauthConfig.Scope,
|
||||
["state"] = state
|
||||
};
|
||||
return $"{_authorizeUrl}?{param.ToQueryString()}#wechat_redirect";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信Token
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TokenModel> GetAccessTokenAsync(string code, string state = "")
|
||||
{
|
||||
var param = new Dictionary<string, string>()
|
||||
{
|
||||
["appid"] = _oauthConfig.AppId,
|
||||
["secret"] = _oauthConfig.AppKey,
|
||||
["code"] = code,
|
||||
["grant_type"] = "authorization_code"
|
||||
};
|
||||
var accessTokenModel = await $"{_accessTokenUrl}?{param.ToQueryString()}".GetAsAsync<TokenModel>();
|
||||
if (accessTokenModel.HasError())
|
||||
throw Oops.Oh($"{ accessTokenModel.ErrorDescription}");
|
||||
return accessTokenModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取微信用户基本信息
|
||||
/// </summary>
|
||||
/// <param name="accessToken"></param>
|
||||
/// <param name="openId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<UserInfoModel> GetUserInfoAsync(string accessToken, string openId)
|
||||
{
|
||||
var param = new Dictionary<string, string>()
|
||||
{
|
||||
["access_token"] = accessToken,
|
||||
["openid"] = openId,
|
||||
["lang"] = "zh_CN",
|
||||
};
|
||||
var userInfoModel = await $"{_userInfoUrl}?{param.ToQueryString()}".GetAsAsync<UserInfoModel>();
|
||||
if (userInfoModel.HasError())
|
||||
throw Oops.Oh($"{ userInfoModel.ErrorMessage}");
|
||||
return userInfoModel;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 刷新微信Token
|
||||
/// </summary>
|
||||
/// <param name="refreshToken"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<TokenModel> GetRefreshTokenAsync(string refreshToken)
|
||||
{
|
||||
var param = new Dictionary<string, string>()
|
||||
{
|
||||
["appid"] = _oauthConfig.AppId,
|
||||
["grant_type"] = "refresh_token",
|
||||
["refresh_token"] = refreshToken
|
||||
};
|
||||
var refreshTokenModel = await $"{_refreshTokenUrl}?{param.ToQueryString()}".GetAsAsync<TokenModel>();
|
||||
if (refreshTokenModel.HasError())
|
||||
throw Oops.Oh($"{ refreshTokenModel.ErrorDescription}");
|
||||
return refreshTokenModel;
|
||||
}
|
||||
}
|
||||
}
|
||||
47
20220330_Vote/Ewide.Core/SeedDataXml/SysApp.xml
Normal file
47
20220330_Vote/Ewide.Core/SeedDataXml/SysApp.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ArrayOfSysApp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysApp>
|
||||
<Id>8b2aeb5e-09a6-4afd-bcae-8ee8e5a1e6ec</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>业务应用</Name>
|
||||
<Code>busapp</Code>
|
||||
<Active>false</Active>
|
||||
<Status>ENABLE</Status>
|
||||
<Sort>100</Sort>
|
||||
</SysApp>
|
||||
<SysApp>
|
||||
<Id>d781b8f1-0d08-48c8-b7a5-ed75ddfa676c</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>系统管理</Name>
|
||||
<Code>system</Code>
|
||||
<Active>true</Active>
|
||||
<Status>ENABLE</Status>
|
||||
<Sort>100</Sort>
|
||||
</SysApp>
|
||||
<SysApp>
|
||||
<Id>850ab86f-cd6a-4d49-b920-77dfa5d78813</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>系统工具</Name>
|
||||
<Code>system_tool</Code>
|
||||
<Active>false</Active>
|
||||
<Status>ENABLE</Status>
|
||||
<Sort>100</Sort>
|
||||
</SysApp>
|
||||
<SysApp>
|
||||
<Id>05a32be5-82e8-423f-affa-e17232a63ee1</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>高级功能</Name>
|
||||
<Code>advanced</Code>
|
||||
<Active>false</Active>
|
||||
<Status>ENABLE</Status>
|
||||
<Sort>100</Sort>
|
||||
</SysApp>
|
||||
</ArrayOfSysApp>
|
||||
27
20220330_Vote/Ewide.Core/SeedDataXml/SysAreaCode.xml
Normal file
27
20220330_Vote/Ewide.Core/SeedDataXml/SysAreaCode.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysAreaCode xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysAreaCode>
|
||||
<Code>3302</Code>
|
||||
<AdCode>3302</AdCode>
|
||||
<Name>XX市</Name>
|
||||
<Note>XX市</Note>
|
||||
<LevelType>1</LevelType>
|
||||
<Sort>0</Sort>
|
||||
</SysAreaCode>
|
||||
<SysAreaCode>
|
||||
<Code>330266</Code>
|
||||
<AdCode>330266</AdCode>
|
||||
<Name>测试区</Name>
|
||||
<Note>测试区</Note>
|
||||
<LevelType>2</LevelType>
|
||||
<Sort>100</Sort>
|
||||
</SysAreaCode>
|
||||
<SysAreaCode>
|
||||
<Code>330266001</Code>
|
||||
<AdCode>330266001</AdCode>
|
||||
<Name>测试街道</Name>
|
||||
<Note>测试街道</Note>
|
||||
<LevelType>3</LevelType>
|
||||
<Sort>0</Sort>
|
||||
</SysAreaCode>
|
||||
</ArrayOfSysAreaCode>
|
||||
432
20220330_Vote/Ewide.Core/SeedDataXml/SysConfig.xml
Normal file
432
20220330_Vote/Ewide.Core/SeedDataXml/SysConfig.xml
Normal file
@@ -0,0 +1,432 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ArrayOfSysConfig xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysConfig>
|
||||
<Id>7c2765cd-d39b-4772-8d6c-0dbcdcfa1ff8</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>jwt密钥</Name>
|
||||
<Code>DILON_JWT_SECRET</Code>
|
||||
<Value>xiaonuo</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>(重要)jwt密钥,默认为空,自行设置</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>e3553657-14cf-4c26-ba7b-dbb4bfd4bc55</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>默认密码</Name>
|
||||
<Code>DILON_DEFAULT_PASSWORD</Code>
|
||||
<Value>123456</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>默认密码</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>2c677cd2-2a54-46c6-971d-f9fe20f101f3</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>token过期时间</Name>
|
||||
<Code>DILON_TOKEN_EXPIRE</Code>
|
||||
<Value>86400</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>token过期时间(单位:秒)</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>8938506d-2e00-44e0-8592-48453d43f9f5</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>session会话过期时间</Name>
|
||||
<Code>DILON_SESSION_EXPIRE</Code>
|
||||
<Value>7200</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>session会话过期时间(单位:秒)</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>beb2e9e7-f4d9-43b1-bfab-3557ea232f8d</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云短信keyId</Name>
|
||||
<Code>DILON_ALIYUN_SMS_ACCESSKEY_ID</Code>
|
||||
<Value>你的keyId</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云短信keyId</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>ALIYUN_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>ead14cd0-9fd4-4fd6-b75c-239d8b2ebed8</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云短信secret</Name>
|
||||
<Code>DILON_ALIYUN_SMS_ACCESSKEY_SECRET</Code>
|
||||
<Value>你的secret</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云短信secret</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>ALIYUN_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>beaaafc2-3fdf-42af-9b06-ead3a6dd6306</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云短信签名</Name>
|
||||
<Code>DILON_ALIYUN_SMS_SIGN_NAME</Code>
|
||||
<Value>你的签名</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云短信签名</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>ALIYUN_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>e26a10cf-911a-4fe0-a113-76965be749a0</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云短信-登录模板号</Name>
|
||||
<Code>DILON_ALIYUN_SMS_LOGIN_TEMPLATE_CODE</Code>
|
||||
<Value>SMS_1877123456</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云短信-登录模板号</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>ALIYUN_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>24d3f286-efca-49af-91b4-e3ce42cce36e</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云短信默认失效时间</Name>
|
||||
<Code>DILON_ALIYUN_SMS_INVALIDATE_MINUTES</Code>
|
||||
<Value>5</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云短信默认失效时间(单位:分钟)</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>ALIYUN_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>c6540a07-ce32-47b4-ab83-b647bdb14491</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>腾讯云短信secretId</Name>
|
||||
<Code>DILON_TENCENT_SMS_SECRET_ID</Code>
|
||||
<Value>你的secretId</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>腾讯云短信secretId</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>TENCENT_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>a0412212-d50b-42aa-9484-3cef8fe3cc59</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>腾讯云短信secretKey</Name>
|
||||
<Code>DILON_TENCENT_SMS_SECRET_KEY</Code>
|
||||
<Value>你的secretkey</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>腾讯云短信secretKey</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>TENCENT_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>c928ca11-5137-4b71-bf1c-f3bc95bcd34d</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>腾讯云短信sdkAppId</Name>
|
||||
<Code>DILON_TENCENT_SMS_SDK_APP_ID</Code>
|
||||
<Value>1400375123</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>腾讯云短信sdkAppId</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>TENCENT_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>16ce1b6e-c8ad-4299-9293-6caff0e5cb49</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>腾讯云短信签名</Name>
|
||||
<Code>DILON_TENCENT_SMS_SIGN</Code>
|
||||
<Value>你的签名</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>腾讯云短信签名</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>TENCENT_SMS</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>66e63d64-b7eb-4e6a-b5b6-c87811c2e700</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>邮箱host</Name>
|
||||
<Code>DILON_EMAIL_HOST</Code>
|
||||
<Value>smtp.126.com</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>邮箱host</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>EMAIL</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>997a9bc6-22ed-4fe6-a20c-c3c2a0b682a0</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>邮箱用户名</Name>
|
||||
<Code>DILON_EMAIL_USERNAME</Code>
|
||||
<Value>test@126.com</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>邮箱用户名</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>EMAIL</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>633d1851-41d9-4ebd-b83b-3aa4501cd1a7</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>邮箱密码</Name>
|
||||
<Code>DILON_EMAIL_PASSWORD</Code>
|
||||
<Value>你的邮箱密码</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>邮箱密码</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>EMAIL</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>67e468f7-e791-4e91-a896-62e9f7411635</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>邮箱端口</Name>
|
||||
<Code>DILON_EMAIL_PORT</Code>
|
||||
<Value>465</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>邮箱端口</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>EMAIL</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>dc462c05-de23-4f90-bcdc-88de4abcdf22</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>邮箱是否开启ssl</Name>
|
||||
<Code>DILON_EMAIL_SSL</Code>
|
||||
<Value>true</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>邮箱是否开启ssl</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>EMAIL</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>8beac2a0-4c67-4499-a7ce-27e989546ce9</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>邮箱发件人</Name>
|
||||
<Code>DILON_EMAIL_FROM</Code>
|
||||
<Value>test@126.com</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>邮箱发件人</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>EMAIL</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>55756524-ecb8-444e-9cdd-a0fc767c4b96</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Win本地上传文件路径</Name>
|
||||
<Code>DILON_FILE_UPLOAD_PATH_FOR_WINDOWS</Code>
|
||||
<Value>D:/tmp</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Win本地上传文件路径</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>FILE_PATH</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>d2db41ee-ce1f-46de-ac00-5860634afed9</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Linux/Mac本地上传文件路径</Name>
|
||||
<Code>DILON_FILE_UPLOAD_PATH_FOR_LINUX</Code>
|
||||
<Value>/tmp</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Linux/Mac本地上传文件路径</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>FILE_PATH</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>ff8debdd-eca0-4f91-8213-e2080f76b35d</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>放开XSS过滤的接口</Name>
|
||||
<Code>DILON_UN_XSS_FILTER_URL</Code>
|
||||
<Value>/demo/xssfilter,/demo/unxss</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>多个url可以用英文逗号隔开</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>5584fb84-f580-463f-b06d-bbb80a4dfb72</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>单用户登陆的开关</Name>
|
||||
<Code>DILON_ENABLE_SINGLE_LOGIN</Code>
|
||||
<Value>false</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>true-打开,false-关闭,如果一个人登录两次,就会将上一次登陆挤下去</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>53b0afb2-4917-4b85-bcca-fe7c7723ae22</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>登录验证码的开关</Name>
|
||||
<Code>DILON_CAPTCHA_OPEN</Code>
|
||||
<Value>true</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>true-打开,false-关闭</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>974740d8-8647-4cf8-8102-542eea53e97f</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Druid监控登录账号</Name>
|
||||
<Code>DILON_DRUID_USERNAME</Code>
|
||||
<Value>superAdmin</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Druid监控登录账号</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>8cee44ea-ba4c-42db-a57d-69b8b5316ca5</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Druid监控界面登录密码</Name>
|
||||
<Code>DILON_DRUID_PASSWORD</Code>
|
||||
<Value>123456</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Druid监控界面登录密码</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>efc235ab-9b05-4820-afe4-32a1eb59e4de</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云定位api接口地址</Name>
|
||||
<Code>DILON_IP_GEO_API</Code>
|
||||
<Value>http://api01.aliyun.venuscn.com/ip?ip=%s</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云定位api接口地址</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>d3597d8a-562a-4b24-93c7-8655c5445d74</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>阿里云定位appCode</Name>
|
||||
<Code>DILON_IP_GEO_APP_CODE</Code>
|
||||
<Value>461535aabeae4f34861884d392f5d452</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>阿里云定位appCode</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>59c8a6f2-9e3c-4e9e-b9cf-8ecad5f0cb45</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Oauth用户登录的开关</Name>
|
||||
<Code>DILON_ENABLE_OAUTH_LOGIN</Code>
|
||||
<Value>true</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Oauth用户登录的开关</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>OAUTH</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>ff502ee7-8129-4828-8d16-fb04562ef52c</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Oauth码云登录ClientId</Name>
|
||||
<Code>DILON_OAUTH_GITEE_CLIENT_ID</Code>
|
||||
<Value>你的clientId</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Oauth码云登录ClientId</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>OAUTH</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>a1d957ef-2b70-456f-8eda-b70a4cf01535</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Oauth码云登录ClientSecret</Name>
|
||||
<Code>DILON_OAUTH_GITEE_CLIENT_SECRET</Code>
|
||||
<Value>你的clientSecret</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Oauth码云登录ClientSecret</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>OAUTH</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>b32ee22b-671d-40bf-8070-32e1054fef96</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>Oauth码云登录回调地址</Name>
|
||||
<Code>DILON_OAUTH_GITEE_REDIRECT_URI</Code>
|
||||
<Value>http://127.0.0.1:5566/oauth/callback/gitee</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>Oauth码云登录回调地址</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>OAUTH</GroupCode>
|
||||
</SysConfig>
|
||||
<SysConfig>
|
||||
<Id>38dda85c-2a98-4768-aebd-a60ab286052c</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>演示环境</Name>
|
||||
<Code>DILON_DEMO_ENV_FLAG</Code>
|
||||
<Value>false</Value>
|
||||
<SysFlag>Y</SysFlag>
|
||||
<Remark>演示环境的开关,true-打开,false-关闭,如果演示环境开启,则只能读数据不能写数据</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
<GroupCode>DEFAULT</GroupCode>
|
||||
</SysConfig>
|
||||
</ArrayOfSysConfig>
|
||||
1167
20220330_Vote/Ewide.Core/SeedDataXml/SysDictData.xml
Normal file
1167
20220330_Vote/Ewide.Core/SeedDataXml/SysDictData.xml
Normal file
File diff suppressed because it is too large
Load Diff
245
20220330_Vote/Ewide.Core/SeedDataXml/SysDictType.xml
Normal file
245
20220330_Vote/Ewide.Core/SeedDataXml/SysDictType.xml
Normal file
@@ -0,0 +1,245 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysDictType xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysDictType>
|
||||
<Id>b0cfa91c-1189-4f39-bc5a-f035885d0604</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>通用状态</Name>
|
||||
<Code>common_status</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>通用状态</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>301ed120-dfc5-4d7c-af59-b56a519581c9</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>性别</Name>
|
||||
<Code>sex</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>性别字典</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>64afb5e7-9f00-4c4f-9ba6-6b41221bd862</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>常量的分类</Name>
|
||||
<Code>consts_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>常量的分类,用于区别一组配置</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>f2f0e8bf-04da-4a2f-9fb8-1d6549227302</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>是否</Name>
|
||||
<Code>yes_or_no</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>是否</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>2cecf329-cf95-44eb-a8d7-3fb77b13e093</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>访问类型</Name>
|
||||
<Code>vis_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>访问类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>e973d383-c28e-42e0-9e23-5f2bd592fef5</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>菜单类型</Name>
|
||||
<Code>menu_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>菜单类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>058db370-3718-42c3-8ba7-095341b1fe13</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>发送类型</Name>
|
||||
<Code>send_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>发送类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>ff6202cb-25ce-4ab9-9c39-910c418b1d2d</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>打开方式</Name>
|
||||
<Code>open_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>打开方式</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>b3235678-f7fe-442b-8fba-e792a89b78f2</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>菜单权重</Name>
|
||||
<Code>menu_weight</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>菜单权重</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>a2068ed1-62a6-463c-b720-06111d994079</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>数据范围类型</Name>
|
||||
<Code>data_scope_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>数据范围类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>688f9a69-ec95-46f4-87bb-e19e3cc5c7fc</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>短信发送来源</Name>
|
||||
<Code>sms_send_source</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>短信发送来源</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>8461bd1d-311b-487e-b579-d6049c6fb191</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>操作类型</Name>
|
||||
<Code>op_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>操作类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>b924e0c1-3f23-4e37-9f27-90e945381304</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>文件存储位置</Name>
|
||||
<Code>file_storage_location</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>文件存储位置</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>0f1b8660-d932-4a53-a681-a38bebae91e0</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>运行状态</Name>
|
||||
<Code>run_status</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>定时任务运行状态</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>d5b311fd-4b60-4b51-9156-b0e6d6cfa4d1</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>通知公告类型</Name>
|
||||
<Code>notice_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>通知公告类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>b30937e6-03cd-4d98-a413-10b06d605e5a</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>通知公告状态</Name>
|
||||
<Code>notice_status</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>通知公告状态</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>80aea9e7-ad1b-4f57-b4db-9d15813707bd</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>是否boolean</Name>
|
||||
<Code>yes_true_false</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>是否boolean</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>430d0538-054a-4b37-a459-1095d0ccf4ae</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>代码生成方式</Name>
|
||||
<Code>code_gen_create_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>代码生成方式</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>bc0dc25b-b85e-4dd1-8368-e014fe1bf30b</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>请求方式</Name>
|
||||
<Code>request_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>请求方式</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>5bdf9b7a-a483-4b61-8e22-e2b25b255b91</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>代码生成作用类型</Name>
|
||||
<Code>code_gen_effect_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>代码生成作用类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>41bc31f6-cef5-400d-b03a-bf51d27b2432</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>代码生成查询类型</Name>
|
||||
<Code>code_gen_query_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>代码生成查询类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
<SysDictType>
|
||||
<Id>28f653d4-e573-4f54-8e5c-4e308780145a</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>代码生成.NET类型</Name>
|
||||
<Code>code_gen_net_type</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>代码生成.NET类型</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysDictType>
|
||||
</ArrayOfSysDictType>
|
||||
21
20220330_Vote/Ewide.Core/SeedDataXml/SysEmp.xml
Normal file
21
20220330_Vote/Ewide.Core/SeedDataXml/SysEmp.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysEmp xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysEmp>
|
||||
<Id>d0ead3dc-5096-4e15-bc6d-f640be5301ec</Id>
|
||||
<JobNum>D1001</JobNum>
|
||||
<OrgId>12d888de-f55d-4c88-b0a0-7c3510664d97</OrgId>
|
||||
<OrgName>华夏集团</OrgName>
|
||||
</SysEmp>
|
||||
<SysEmp>
|
||||
<Id>5398fb9a-2209-4ce7-a2c1-b6a983e502b5</Id>
|
||||
<JobNum>D1002</JobNum>
|
||||
<OrgId>12d888de-f55d-4c88-b0a0-7c3510664d97</OrgId>
|
||||
<OrgName>华夏集团</OrgName>
|
||||
</SysEmp>
|
||||
<SysEmp>
|
||||
<Id>16a74726-e156-499f-9942-0e0e24ad0c3f</Id>
|
||||
<JobNum>D1003</JobNum>
|
||||
<OrgId>12d888de-f55d-4c88-b0a0-7c3510664d97</OrgId>
|
||||
<OrgName>华夏集团</OrgName>
|
||||
</SysEmp>
|
||||
</ArrayOfSysEmp>
|
||||
28
20220330_Vote/Ewide.Core/SeedDataXml/SysEmpExtOrgPos.xml
Normal file
28
20220330_Vote/Ewide.Core/SeedDataXml/SysEmpExtOrgPos.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysEmpExtOrgPos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysEmpExtOrgPos>
|
||||
<SysEmpId>d0ead3dc-5096-4e15-bc6d-f640be5301ec</SysEmpId>
|
||||
<SysOrgId>12d888de-f55d-4c88-b0a0-7c3510664d97</SysOrgId>
|
||||
<SysPosId>269236c4-d74e-4e54-9d50-f6f61580a197</SysPosId>
|
||||
</SysEmpExtOrgPos>
|
||||
<SysEmpExtOrgPos>
|
||||
<SysEmpId>d0ead3dc-5096-4e15-bc6d-f640be5301ec</SysEmpId>
|
||||
<SysOrgId>8a2271d6-5bda-4544-bdd3-27e53a8b418e</SysOrgId>
|
||||
<SysPosId>46c68a62-f119-4ff7-b621-0bbd77504538</SysPosId>
|
||||
</SysEmpExtOrgPos>
|
||||
<SysEmpExtOrgPos>
|
||||
<SysEmpId>d0ead3dc-5096-4e15-bc6d-f640be5301ec</SysEmpId>
|
||||
<SysOrgId>127c0a5d-43ac-4370-b313-082361885aca</SysOrgId>
|
||||
<SysPosId>5bd8c466-2bca-4386-a551-daac78e3cee8</SysPosId>
|
||||
</SysEmpExtOrgPos>
|
||||
<SysEmpExtOrgPos>
|
||||
<SysEmpId>d0ead3dc-5096-4e15-bc6d-f640be5301ec</SysEmpId>
|
||||
<SysOrgId>f236ab2d-e1b5-4e9d-844f-a59ec32c20e4</SysOrgId>
|
||||
<SysPosId>d89a3afe-e6ba-4018-bdae-3c98bb47ad66</SysPosId>
|
||||
</SysEmpExtOrgPos>
|
||||
<SysEmpExtOrgPos>
|
||||
<SysEmpId>16a74726-e156-499f-9942-0e0e24ad0c3f</SysEmpId>
|
||||
<SysOrgId>f236ab2d-e1b5-4e9d-844f-a59ec32c20e4</SysOrgId>
|
||||
<SysPosId>269236c4-d74e-4e54-9d50-f6f61580a197</SysPosId>
|
||||
</SysEmpExtOrgPos>
|
||||
</ArrayOfSysEmpExtOrgPos>
|
||||
19
20220330_Vote/Ewide.Core/SeedDataXml/SysEmpPos.xml
Normal file
19
20220330_Vote/Ewide.Core/SeedDataXml/SysEmpPos.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysEmpPos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysEmpPos>
|
||||
<SysEmpId>d0ead3dc-5096-4e15-bc6d-f640be5301ec</SysEmpId>
|
||||
<SysPosId>269236c4-d74e-4e54-9d50-f6f61580a197</SysPosId>
|
||||
</SysEmpPos>
|
||||
<SysEmpPos>
|
||||
<SysEmpId>d0ead3dc-5096-4e15-bc6d-f640be5301ec</SysEmpId>
|
||||
<SysPosId>46c68a62-f119-4ff7-b621-0bbd77504538</SysPosId>
|
||||
</SysEmpPos>
|
||||
<SysEmpPos>
|
||||
<SysEmpId>5398fb9a-2209-4ce7-a2c1-b6a983e502b5</SysEmpId>
|
||||
<SysPosId>5bd8c466-2bca-4386-a551-daac78e3cee8</SysPosId>
|
||||
</SysEmpPos>
|
||||
<SysEmpPos>
|
||||
<SysEmpId>16a74726-e156-499f-9942-0e0e24ad0c3f</SysEmpId>
|
||||
<SysPosId>269236c4-d74e-4e54-9d50-f6f61580a197</SysPosId>
|
||||
</SysEmpPos>
|
||||
</ArrayOfSysEmpPos>
|
||||
2941
20220330_Vote/Ewide.Core/SeedDataXml/SysMenu.xml
Normal file
2941
20220330_Vote/Ewide.Core/SeedDataXml/SysMenu.xml
Normal file
File diff suppressed because it is too large
Load Diff
107
20220330_Vote/Ewide.Core/SeedDataXml/SysOrg.xml
Normal file
107
20220330_Vote/Ewide.Core/SeedDataXml/SysOrg.xml
Normal file
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysOrg xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysOrg>
|
||||
<Id>12d888de-f55d-4c88-b0a0-7c3510664d97</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>00000000-0000-0000-0000-000000000000</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],</Pids>
|
||||
<Name>华夏集团</Name>
|
||||
<Code>hxjt</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>8a2271d6-5bda-4544-bdd3-27e53a8b418e</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>12d888de-f55d-4c88-b0a0-7c3510664d97</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],</Pids>
|
||||
<Name>华夏集团北京分公司</Name>
|
||||
<Code>hxjt_bj</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团北京分公司</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>127c0a5d-43ac-4370-b313-082361885aca</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>12d888de-f55d-4c88-b0a0-7c3510664d97</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],</Pids>
|
||||
<Name>华夏集团成都分公司</Name>
|
||||
<Code>hxjt_cd</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团成都分公司</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>f236ab2d-e1b5-4e9d-844f-a59ec32c20e4</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>8a2271d6-5bda-4544-bdd3-27e53a8b418e</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],[8a2271d6-5bda-4544-bdd3-27e53a8b418e],</Pids>
|
||||
<Name>研发部</Name>
|
||||
<Code>hxjt_bj_yfb</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团北京分公司研发部</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>07322be0-2015-41f2-859e-132b5e142fca</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>8a2271d6-5bda-4544-bdd3-27e53a8b418e</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],[8a2271d6-5bda-4544-bdd3-27e53a8b418e],</Pids>
|
||||
<Name>企划部</Name>
|
||||
<Code>hxjt_bj_qhb</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团北京分公司企划部</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>49dc3f25-873d-4998-9767-46978d79d8e6</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>127c0a5d-43ac-4370-b313-082361885aca</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],[127c0a5d-43ac-4370-b313-082361885aca],</Pids>
|
||||
<Name>市场部</Name>
|
||||
<Code>hxjt_cd_scb</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团成都分公司市场部</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>56b7a823-cc62-492b-a91b-0b053ef2683b</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>127c0a5d-43ac-4370-b313-082361885aca</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],[127c0a5d-43ac-4370-b313-082361885aca],</Pids>
|
||||
<Name>财务部</Name>
|
||||
<Code>hxjt_cd_cwb</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团成都分公司财务部</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
<SysOrg>
|
||||
<Id>e9f97d63-a585-40ff-bf0c-7406e785f660</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Pid>49dc3f25-873d-4998-9767-46978d79d8e6</Pid>
|
||||
<Pids>[00000000-0000-0000-0000-000000000000],[12d888de-f55d-4c88-b0a0-7c3510664d97],[127c0a5d-43ac-4370-b313-082361885aca],[49dc3f25-873d-4998-9767-46978d79d8e6],</Pids>
|
||||
<Name>市场部二部</Name>
|
||||
<Code>hxjt_cd_scb_2b</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>华夏集团成都分公司市场部二部</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysOrg>
|
||||
</ArrayOfSysOrg>
|
||||
47
20220330_Vote/Ewide.Core/SeedDataXml/SysPos.xml
Normal file
47
20220330_Vote/Ewide.Core/SeedDataXml/SysPos.xml
Normal file
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysPos xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysPos>
|
||||
<Id>269236c4-d74e-4e54-9d50-f6f61580a197</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>总经理</Name>
|
||||
<Code>zjl</Code>
|
||||
<Sort>100</Sort>
|
||||
<Remark>总经理</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysPos>
|
||||
<SysPos>
|
||||
<Id>46c68a62-f119-4ff7-b621-0bbd77504538</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>副总经理</Name>
|
||||
<Code>fzjl</Code>
|
||||
<Sort>101</Sort>
|
||||
<Remark>副总经理</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysPos>
|
||||
<SysPos>
|
||||
<Id>5bd8c466-2bca-4386-a551-daac78e3cee8</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>部门经理</Name>
|
||||
<Code>bmjl</Code>
|
||||
<Sort>102</Sort>
|
||||
<Remark>部门经理</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysPos>
|
||||
<SysPos>
|
||||
<Id>d89a3afe-e6ba-4018-bdae-3c98bb47ad66</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>工作人员</Name>
|
||||
<Code>gzry</Code>
|
||||
<Sort>103</Sort>
|
||||
<Remark>工作人员</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysPos>
|
||||
</ArrayOfSysPos>
|
||||
27
20220330_Vote/Ewide.Core/SeedDataXml/SysRole.xml
Normal file
27
20220330_Vote/Ewide.Core/SeedDataXml/SysRole.xml
Normal file
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysRole xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysRole>
|
||||
<Id>6dfe9189-ce10-434e-a7a7-5cdc46e85047</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>系统管理员</Name>
|
||||
<Code>sys_manager_role</Code>
|
||||
<Sort>100</Sort>
|
||||
<DataScopeType>1</DataScopeType>
|
||||
<Remark>系统管理员</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysRole>
|
||||
<SysRole>
|
||||
<Id>cd187ebd-ab3d-4768-9669-85e2219c2910</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>普通用户</Name>
|
||||
<Code>common_role</Code>
|
||||
<Sort>101</Sort>
|
||||
<DataScopeType>5</DataScopeType>
|
||||
<Remark>普通用户</Remark>
|
||||
<Status>ENABLE</Status>
|
||||
</SysRole>
|
||||
</ArrayOfSysRole>
|
||||
23
20220330_Vote/Ewide.Core/SeedDataXml/SysTenant.xml
Normal file
23
20220330_Vote/Ewide.Core/SeedDataXml/SysTenant.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysTenant xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysTenant>
|
||||
<Id>506a14b7-882d-4548-96fa-a55dbe79bfa1</Id>
|
||||
<CreatedTime>2021-04-03T00:00:00</CreatedTime>
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>默认租户</Name>
|
||||
<Host>localhost:5566</Host>
|
||||
<Email>zuohuaijun@163.com</Email>
|
||||
<Phone>18020030720</Phone>
|
||||
<Connection>Data Source=./Ewide.db</Connection>
|
||||
</SysTenant>
|
||||
<SysTenant>
|
||||
<Id>eed8c4a6-70d8-49fd-9566-21a6966bb702</Id>
|
||||
<CreatedTime>2021-04-03T00:00:00</CreatedTime>
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Name>其他租户</Name>
|
||||
<Host>localhost:5588</Host>
|
||||
<Connection>Data Source=./Dilon_1.db</Connection>
|
||||
</SysTenant>
|
||||
</ArrayOfSysTenant>
|
||||
18
20220330_Vote/Ewide.Core/SeedDataXml/SysTimer.xml
Normal file
18
20220330_Vote/Ewide.Core/SeedDataXml/SysTimer.xml
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysTimer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysTimer>
|
||||
<Id>971bc338-0c03-46d4-8113-c7738d54ea18</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<JobName>百度api</JobName>
|
||||
<JobGroup>默认分组</JobGroup>
|
||||
<BeginTime>2021-03-21T00:00:00+08:00</BeginTime>
|
||||
<EndTime xsi:nil="true" />
|
||||
<RunNumber xsi:nil="true" />
|
||||
<Interval>30</Interval>
|
||||
<TriggerType>Simple</TriggerType>
|
||||
<RequestUrl>https://www.baidu.com</RequestUrl>
|
||||
<RequestType>Post</RequestType>
|
||||
</SysTimer>
|
||||
</ArrayOfSysTimer>
|
||||
51
20220330_Vote/Ewide.Core/SeedDataXml/SysUser.xml
Normal file
51
20220330_Vote/Ewide.Core/SeedDataXml/SysUser.xml
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0"?>
|
||||
<ArrayOfSysUser xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<SysUser>
|
||||
<Id>d0ead3dc-5096-4e15-bc6d-f640be5301ec</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Account>superAdmin</Account>
|
||||
<Password>e10adc3949ba59abbe56e057f20f883e</Password>
|
||||
<SecurityLevel>1</SecurityLevel>
|
||||
<Name>superAdmin</Name>
|
||||
<Birthday>1986-07-26T00:00:00</Birthday>
|
||||
<Sex>1</Sex>
|
||||
<Phone>18020030720</Phone>
|
||||
<LastLoginTime>0001-01-01T00:00:00</LastLoginTime>
|
||||
<AdminType>SuperAdmin</AdminType>
|
||||
<Status>ENABLE</Status>
|
||||
</SysUser>
|
||||
<SysUser>
|
||||
<Id>5398fb9a-2209-4ce7-a2c1-b6a983e502b5</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Account>admin</Account>
|
||||
<Password>e10adc3949ba59abbe56e057f20f883e</Password>
|
||||
<SecurityLevel>1</SecurityLevel>
|
||||
<Name>admin</Name>
|
||||
<Birthday>1986-07-26T00:00:00</Birthday>
|
||||
<Sex>2</Sex>
|
||||
<Phone>18020030720</Phone>
|
||||
<LastLoginTime>0001-01-01T00:00:00</LastLoginTime>
|
||||
<AdminType>SuperAdmin</AdminType>
|
||||
<Status>ENABLE</Status>
|
||||
</SysUser>
|
||||
<SysUser>
|
||||
<Id>16a74726-e156-499f-9942-0e0e24ad0c3f</Id>
|
||||
<CreatedTime xsi:nil="true" />
|
||||
<UpdatedTime xsi:nil="true" />
|
||||
<IsDeleted>false</IsDeleted>
|
||||
<Account>zuohuaijun</Account>
|
||||
<Password>e10adc3949ba59abbe56e057f20f883e</Password>
|
||||
<SecurityLevel>1</SecurityLevel>
|
||||
<Name>zuohuaijun</Name>
|
||||
<Birthday>1986-07-26T00:00:00</Birthday>
|
||||
<Sex>1</Sex>
|
||||
<Phone>18020030720</Phone>
|
||||
<LastLoginTime>0001-01-01T00:00:00</LastLoginTime>
|
||||
<AdminType>None</AdminType>
|
||||
<Status>ENABLE</Status>
|
||||
</SysUser>
|
||||
</ArrayOfSysUser>
|
||||
100
20220330_Vote/Ewide.Core/Service/App/Dto/AppInput.cs
Normal file
100
20220330_Vote/Ewide.Core/Service/App/Dto/AppInput.cs
Normal file
@@ -0,0 +1,100 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Ewide.Core.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统应用参数
|
||||
/// </summary>
|
||||
public class AppInput : PageInputBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public virtual string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public virtual string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public virtual string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标颜色
|
||||
/// </summary>
|
||||
public virtual string Color { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认激活(Y-是,N-否),只能有一个系统默认激活
|
||||
/// 用户登录后默认展示此系统菜单
|
||||
/// </summary>
|
||||
public bool Active { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 状态(字典 0正常 1停用 2删除)
|
||||
/// </summary>
|
||||
public CommonStatus Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
}
|
||||
|
||||
public class AddAppInput : AppInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "应用名称不能为空")]
|
||||
public override string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "应用编码不能为空")]
|
||||
public override string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标
|
||||
/// </summary>
|
||||
public override string Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 图标颜色
|
||||
/// </summary>
|
||||
[RegularExpression("^#[0-9a-fA-F]{6}|#[0-9a-fA-F]{3}$", ErrorMessage = "颜色格式不正确")]
|
||||
public override string Color { get; set; }
|
||||
}
|
||||
|
||||
public class DeleteAppInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "应用Id不能为空")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class UpdateAppInput : AppInput
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用Id
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "应用Id不能为空")]
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class QueryAppInput : DeleteAppInput
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class SetDefaultAppInput : DeleteAppInput
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
33
20220330_Vote/Ewide.Core/Service/App/Dto/AppOutput.cs
Normal file
33
20220330_Vote/Ewide.Core/Service/App/Dto/AppOutput.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
namespace Ewide.Core.Service
|
||||
{
|
||||
/// <summary>
|
||||
/// 系统应用参数
|
||||
/// </summary>
|
||||
public class AppOutput
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用Id
|
||||
/// </summary>
|
||||
public string Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 编码
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否默认
|
||||
/// </summary>
|
||||
public bool Active { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int Sort { get; set; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user