✨ codeFirst实体建表
This commit is contained in:
parent
628df80df7
commit
b96edfdac7
375
Infrastructure/Helper/XmlCommentHelper.cs
Normal file
375
Infrastructure/Helper/XmlCommentHelper.cs
Normal file
@ -0,0 +1,375 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.XPath;
|
||||
|
||||
namespace Infrastructure.Helper
|
||||
{
|
||||
public class XmlCommentHelper
|
||||
{
|
||||
private static Regex RefTagPattern = new Regex(@"<(see|paramref) (name|cref)=""([TPF]{1}:)?(?<display>.+?)"" ?/>");
|
||||
private static Regex CodeTagPattern = new Regex(@"<c>(?<display>.+?)</c>");
|
||||
private static Regex ParaTagPattern = new Regex(@"<para>(?<display>.+?)</para>", RegexOptions.Singleline);
|
||||
|
||||
List<XPathNavigator> navigators = new List<XPathNavigator>();
|
||||
|
||||
/// <summary>
|
||||
/// 从当前dll文件中加载所有的xml文件
|
||||
/// </summary>
|
||||
public void LoadAll()
|
||||
{
|
||||
var files = Directory.GetFiles(Directory.GetCurrentDirectory());
|
||||
foreach (var file in files)
|
||||
{
|
||||
if (string.Equals(Path.GetExtension(file), ".xml", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
Load(file);
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 从xml中加载
|
||||
/// </summary>
|
||||
/// <param name="xmls"></param>
|
||||
public void LoadXml(params string[] xmls)
|
||||
{
|
||||
foreach (var xml in xmls)
|
||||
{
|
||||
Load(new MemoryStream(Encoding.UTF8.GetBytes(xml)));
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 从文件中加载
|
||||
/// </summary>
|
||||
/// <param name="xmlFiles"></param>
|
||||
public void Load(params string[] xmlFiles)
|
||||
{
|
||||
foreach (var xmlFile in xmlFiles)
|
||||
{
|
||||
var doc = new XPathDocument(xmlFile);
|
||||
navigators.Add(doc.CreateNavigator());
|
||||
|
||||
//Console.WriteLine("加载xml文件=" + xmlFile);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 从流中加载
|
||||
/// </summary>
|
||||
/// <param name="streams"></param>
|
||||
public void Load(params Stream[] streams)
|
||||
{
|
||||
foreach (var stream in streams)
|
||||
{
|
||||
var doc = new XPathDocument(stream);
|
||||
navigators.Add(doc.CreateNavigator());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取类型中的注释
|
||||
/// </summary>
|
||||
/// <param name="type">类型</param>
|
||||
/// <param name="xPath">注释路径</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetTypeComment(Type type, string xPath = "summary", bool humanize = true)
|
||||
{
|
||||
var typeMemberName = GetMemberNameForType(type);
|
||||
return GetComment(typeMemberName, xPath, humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取字段或者属性的注释
|
||||
/// </summary>
|
||||
/// <param name="fieldOrPropertyInfo">字段或者属性</param>
|
||||
/// <param name="xPath">注释路径</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetFieldOrPropertyComment(MemberInfo fieldOrPropertyInfo, string xPath = "summary", bool humanize = true)
|
||||
{
|
||||
var fieldOrPropertyMemberName = GetMemberNameForFieldOrProperty(fieldOrPropertyInfo);
|
||||
return GetComment(fieldOrPropertyMemberName, xPath, humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取方法中的注释
|
||||
/// </summary>
|
||||
/// <param name="methodInfo">方法</param>
|
||||
/// <param name="xPath">注释路径</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetMethodComment(MethodInfo methodInfo, string xPath = "summary", bool humanize = true)
|
||||
{
|
||||
var methodMemberName = GetMemberNameForMethod(methodInfo);
|
||||
return GetComment(methodMemberName, xPath, humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取方法中的返回值注释
|
||||
/// </summary>
|
||||
/// <param name="methodInfo">方法</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetMethodReturnComment(MethodInfo methodInfo, bool humanize = true)
|
||||
{
|
||||
return GetMethodComment(methodInfo, "returns", humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取参数的注释
|
||||
/// </summary>
|
||||
/// <param name="parameterInfo">参数</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetParameterComment(ParameterInfo parameterInfo, bool humanize = true)
|
||||
{
|
||||
if (!(parameterInfo.Member is MethodInfo methodInfo)) return string.Empty;
|
||||
|
||||
var methodMemberName = GetMemberNameForMethod(methodInfo);
|
||||
return GetComment(methodMemberName, $"param[@name='{parameterInfo.Name}']", humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取方法的所有参数的注释
|
||||
/// </summary>
|
||||
/// <param name="methodInfo">方法</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<string, string> GetParameterComments(MethodInfo methodInfo, bool humanize = true)
|
||||
{
|
||||
var parameterInfos = methodInfo.GetParameters();
|
||||
Dictionary<string, string> dict = new Dictionary<string, string>();
|
||||
foreach (var parameterInfo in parameterInfos)
|
||||
{
|
||||
dict[parameterInfo.Name] = GetParameterComment(parameterInfo, humanize);
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取指定名称节点的注释
|
||||
/// </summary>
|
||||
/// <param name="name">节点名称</param>
|
||||
/// <param name="xPath">注释路径</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetComment(string name, string xPath, bool humanize = true)
|
||||
{
|
||||
foreach (var _xmlNavigator in navigators)
|
||||
{
|
||||
var typeSummaryNode = _xmlNavigator.SelectSingleNode($"/doc/members/member[@name='{name}']/{xPath.Trim('/', '\\')}");
|
||||
|
||||
if (typeSummaryNode != null)
|
||||
{
|
||||
return humanize ? Humanize(typeSummaryNode.InnerXml) : typeSummaryNode.InnerXml;
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取指定节点的summary注释
|
||||
/// </summary>
|
||||
/// <param name="name">节点名称</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetSummary(string name, bool humanize = true)
|
||||
{
|
||||
return GetComment(name, "summary", humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 读取指定节点的example注释
|
||||
/// </summary>
|
||||
/// <param name="name">节点名称</param>
|
||||
/// <param name="humanize">可读性优化(比如:去掉xml标记)</param>
|
||||
/// <returns></returns>
|
||||
public string GetExample(string name, bool humanize = true)
|
||||
{
|
||||
return GetComment(name, "example", humanize);
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取方法的节点名称
|
||||
/// </summary>
|
||||
/// <param name="method"></param>
|
||||
/// <returns></returns>
|
||||
public string GetMemberNameForMethod(MethodInfo method)
|
||||
{
|
||||
var builder = new StringBuilder("M:");
|
||||
|
||||
builder.Append(QualifiedNameFor(method.DeclaringType));
|
||||
builder.Append($".{method.Name}");
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
if (parameters.Any())
|
||||
{
|
||||
var parametersNames = parameters.Select(p =>
|
||||
{
|
||||
return p.ParameterType.IsGenericParameter
|
||||
? $"`{p.ParameterType.GenericParameterPosition}"
|
||||
: QualifiedNameFor(p.ParameterType, expandGenericArgs: true);
|
||||
});
|
||||
builder.Append($"({string.Join(",", parametersNames)})");
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取类型的节点名称
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <returns></returns>
|
||||
public string GetMemberNameForType(Type type)
|
||||
{
|
||||
var builder = new StringBuilder("T:");
|
||||
builder.Append(QualifiedNameFor(type));
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取字段或者属性的节点名称
|
||||
/// </summary>
|
||||
/// <param name="fieldOrPropertyInfo"></param>
|
||||
/// <returns></returns>
|
||||
public string GetMemberNameForFieldOrProperty(MemberInfo fieldOrPropertyInfo)
|
||||
{
|
||||
var builder = new StringBuilder(((fieldOrPropertyInfo.MemberType & MemberTypes.Field) != 0) ? "F:" : "P:");
|
||||
builder.Append(QualifiedNameFor(fieldOrPropertyInfo.DeclaringType));
|
||||
builder.Append($".{fieldOrPropertyInfo.Name}");
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
|
||||
private string QualifiedNameFor(Type type, bool expandGenericArgs = false)
|
||||
{
|
||||
if (type.IsArray)
|
||||
return $"{QualifiedNameFor(type.GetElementType(), expandGenericArgs)}[]";
|
||||
|
||||
var builder = new StringBuilder();
|
||||
|
||||
if (!string.IsNullOrEmpty(type.Namespace))
|
||||
builder.Append($"{type.Namespace}.");
|
||||
|
||||
if (type.IsNested)
|
||||
{
|
||||
builder.Append($"{string.Join(".", GetNestedTypeNames(type))}.");
|
||||
}
|
||||
|
||||
if (type.IsConstructedGenericType && expandGenericArgs)
|
||||
{
|
||||
var nameSansGenericArgs = type.Name.Split('`').First();
|
||||
builder.Append(nameSansGenericArgs);
|
||||
|
||||
var genericArgsNames = type.GetGenericArguments().Select(t =>
|
||||
{
|
||||
return t.IsGenericParameter
|
||||
? $"`{t.GenericParameterPosition}"
|
||||
: QualifiedNameFor(t, true);
|
||||
});
|
||||
|
||||
builder.Append($"{{{string.Join(",", genericArgsNames)}}}");
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Append(type.Name);
|
||||
}
|
||||
|
||||
return builder.ToString();
|
||||
}
|
||||
private IEnumerable<string> GetNestedTypeNames(Type type)
|
||||
{
|
||||
if (!type.IsNested || type.DeclaringType == null) yield break;
|
||||
|
||||
foreach (var nestedTypeName in GetNestedTypeNames(type.DeclaringType))
|
||||
{
|
||||
yield return nestedTypeName;
|
||||
}
|
||||
|
||||
yield return type.DeclaringType.Name;
|
||||
}
|
||||
private string Humanize(string text)
|
||||
{
|
||||
if (text == null)
|
||||
throw new ArgumentNullException("text");
|
||||
|
||||
//Call DecodeXml at last to avoid entities like < and > to break valid xml
|
||||
text = NormalizeIndentation(text);
|
||||
text = HumanizeRefTags(text);
|
||||
text = HumanizeCodeTags(text);
|
||||
text = HumanizeParaTags(text);
|
||||
text = DecodeXml(text);
|
||||
return text;
|
||||
}
|
||||
private string NormalizeIndentation(string text)
|
||||
{
|
||||
string[] lines = text.Split('\n');
|
||||
string padding = GetCommonLeadingWhitespace(lines);
|
||||
|
||||
int padLen = padding == null ? 0 : padding.Length;
|
||||
|
||||
// remove leading padding from each line
|
||||
for (int i = 0, l = lines.Length; i < l; ++i)
|
||||
{
|
||||
string line = lines[i].TrimEnd('\r'); // remove trailing '\r'
|
||||
|
||||
if (padLen != 0 && line.Length >= padLen && line.Substring(0, padLen) == padding)
|
||||
line = line.Substring(padLen);
|
||||
|
||||
lines[i] = line;
|
||||
}
|
||||
|
||||
// remove leading empty lines, but not all leading padding
|
||||
// remove all trailing whitespace, regardless
|
||||
return string.Join("\r\n", lines.SkipWhile(x => string.IsNullOrWhiteSpace(x))).TrimEnd();
|
||||
}
|
||||
private string GetCommonLeadingWhitespace(string[] lines)
|
||||
{
|
||||
if (null == lines)
|
||||
throw new ArgumentException("lines");
|
||||
|
||||
if (lines.Length == 0)
|
||||
return null;
|
||||
|
||||
string[] nonEmptyLines = lines
|
||||
.Where(x => !string.IsNullOrWhiteSpace(x))
|
||||
.ToArray();
|
||||
|
||||
if (nonEmptyLines.Length < 1)
|
||||
return null;
|
||||
|
||||
int padLen = 0;
|
||||
|
||||
// use the first line as a seed, and see what is shared over all nonEmptyLines
|
||||
string seed = nonEmptyLines[0];
|
||||
for (int i = 0, l = seed.Length; i < l; ++i)
|
||||
{
|
||||
if (!char.IsWhiteSpace(seed, i))
|
||||
break;
|
||||
|
||||
if (nonEmptyLines.Any(line => line[i] != seed[i]))
|
||||
break;
|
||||
|
||||
++padLen;
|
||||
}
|
||||
|
||||
if (padLen > 0)
|
||||
return seed.Substring(0, padLen);
|
||||
|
||||
return null;
|
||||
}
|
||||
private string HumanizeRefTags(string text)
|
||||
{
|
||||
return RefTagPattern.Replace(text, (match) => match.Groups["display"].Value);
|
||||
}
|
||||
private string HumanizeCodeTags(string text)
|
||||
{
|
||||
return CodeTagPattern.Replace(text, (match) => "{" + match.Groups["display"].Value + "}");
|
||||
}
|
||||
private string HumanizeParaTags(string text)
|
||||
{
|
||||
return ParaTagPattern.Replace(text, (match) => "<br>" + match.Groups["display"].Value);
|
||||
}
|
||||
private string DecodeXml(string text)
|
||||
{
|
||||
return System.Net.WebUtility.HtmlDecode(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,16 +58,16 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
/// <summary>
|
||||
/// 添加角色
|
||||
/// </summary>
|
||||
/// <param name="sysRoleDto"></param>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[ActionPermissionFilter(Permission = "system:role:add")]
|
||||
[Log(Title = "角色管理", BusinessType = BusinessType.INSERT)]
|
||||
[Route("edit")]
|
||||
public IActionResult RoleAdd([FromBody] SysRole sysRoleDto)
|
||||
public IActionResult RoleAdd([FromBody] SysRoleDto dto)
|
||||
{
|
||||
if (sysRoleDto == null) return ToResponse(ApiResult.Error(101, "请求参数错误"));
|
||||
|
||||
if (dto == null) return ToResponse(ApiResult.Error(101, "请求参数错误"));
|
||||
SysRole sysRoleDto = dto.Adapt<SysRole>();
|
||||
if (UserConstants.NOT_UNIQUE.Equals(sysRoleService.CheckRoleKeyUnique(sysRoleDto)))
|
||||
{
|
||||
return ToResponse(ApiResult.Error((int)ResultCode.CUSTOM_ERROR, $"新增角色'{sysRoleDto.RoleName}'失败,角色权限已存在"));
|
||||
@ -82,18 +82,19 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
/// <summary>
|
||||
/// 修改角色
|
||||
/// </summary>
|
||||
/// <param name="sysRoleDto"></param>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
[ActionPermissionFilter(Permission = "system:role:edit")]
|
||||
[Log(Title = "角色管理", BusinessType = BusinessType.UPDATE)]
|
||||
[Route("edit")]
|
||||
public IActionResult RoleEdit([FromBody] SysRole sysRoleDto)
|
||||
public IActionResult RoleEdit([FromBody] SysRoleDto dto)
|
||||
{
|
||||
if (sysRoleDto == null || sysRoleDto.RoleId <= 0 || string.IsNullOrEmpty(sysRoleDto.RoleKey))
|
||||
if (dto == null || dto.RoleId <= 0 || string.IsNullOrEmpty(dto.RoleKey))
|
||||
{
|
||||
return ToResponse(ApiResult.Error(101, "请求参数错误"));
|
||||
}
|
||||
SysRole sysRoleDto = dto.Adapt<SysRole>();
|
||||
sysRoleService.CheckRoleAllowed(sysRoleDto);
|
||||
var info = sysRoleService.SelectRoleById(sysRoleDto.RoleId);
|
||||
if (info != null && info.RoleKey != sysRoleDto.RoleKey)
|
||||
|
||||
@ -9,6 +9,7 @@ using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Filters;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
using ZR.Service.System.IService;
|
||||
|
||||
namespace ZR.Admin.WebApi.Controllers.System
|
||||
@ -44,7 +45,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
/// <returns></returns>
|
||||
[ActionPermissionFilter(Permission = "system:user:list")]
|
||||
[HttpGet("list")]
|
||||
public IActionResult List([FromQuery] SysUser user, PagerInfo pager)
|
||||
public IActionResult List([FromQuery] SysUserQueryDto user, PagerInfo pager)
|
||||
{
|
||||
var list = UserService.SelectUserList(user, pager);
|
||||
|
||||
@ -208,7 +209,7 @@ namespace ZR.Admin.WebApi.Controllers.System
|
||||
[HttpGet("export")]
|
||||
[Log(Title = "用户导出", BusinessType = BusinessType.EXPORT)]
|
||||
[ActionPermissionFilter(Permission = "system:user:export")]
|
||||
public IActionResult UserExport([FromQuery] SysUser user)
|
||||
public IActionResult UserExport([FromQuery] SysUserQueryDto user)
|
||||
{
|
||||
var list = UserService.SelectUserList(user, new PagerInfo(1, 10000));
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using Infrastructure.Helper;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
using System.Reflection;
|
||||
using ZR.Admin.WebApi.Framework;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
|
||||
namespace ZR.Admin.WebApi.Extensions
|
||||
@ -22,12 +24,16 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
//仅本人数据权限
|
||||
public static long DATA_SCOPE_SELF = 5;
|
||||
|
||||
private static XmlCommentHelper commentHelper = new XmlCommentHelper();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化db
|
||||
/// </summary>
|
||||
/// <param name="services"></param>
|
||||
/// <param name="Configuration"></param>
|
||||
public static void AddDb(this IServiceCollection services, IConfiguration Configuration)
|
||||
{
|
||||
commentHelper.LoadAll();
|
||||
List<DbConfigs> dbConfigs = Configuration.GetSection("DbConfigs").Get<List<DbConfigs>>();
|
||||
|
||||
var iocList = new List<IocConfig>();
|
||||
@ -110,11 +116,43 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
DataInfoCacheService = cache,
|
||||
EntityService = (c, p) =>
|
||||
{
|
||||
if (db.GetConnectionScope(configId).CurrentConnectionConfig.DbType == DbType.PostgreSQL && p.DataType != null && p.DataType.Contains("nvarchar"))
|
||||
p.DbTableName = p.DbTableName.FirstLowerCase();
|
||||
p.DbColumnName = p.DbColumnName.FirstLowerCase();
|
||||
var des = commentHelper.GetFieldOrPropertyComment(c);
|
||||
if (des.IsNotEmpty())
|
||||
{
|
||||
p.ColumnDescription = des;
|
||||
}
|
||||
|
||||
if (db.GetConnectionScope(configId).CurrentConnectionConfig.DbType == DbType.PostgreSQL)
|
||||
{
|
||||
if (p.DataType != null && p.DataType.Contains("nvarchar"))
|
||||
{
|
||||
p.DataType = "text";
|
||||
}
|
||||
if (c.Name == nameof(SysMenu.IsCache) || c.Name == nameof(SysMenu.IsFrame))
|
||||
{
|
||||
p.DataType = "char(1)";
|
||||
}
|
||||
}
|
||||
if (p.IsPrimarykey == true)//主键不能为null
|
||||
{
|
||||
p.IsNullable = false;
|
||||
}
|
||||
else if (p.ExtendedAttribute?.ToString() == ProteryConstant.NOTNULL.ToString())
|
||||
{
|
||||
p.IsNullable = false;
|
||||
}
|
||||
else//则否默认为null
|
||||
{
|
||||
p.IsNullable = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
db.GetConnectionScope(configId).Aop.DataExecuting = (oldValue, entiyInfo) =>
|
||||
{
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@ -130,7 +168,9 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
|
||||
var baseType = typeof(SysBase);
|
||||
var entityes = AssemblyUtils.GetAllTypes().Where(p => !p.IsAbstract && p != baseType && /*p.IsAssignableTo(baseType) && */p.GetCustomAttribute<SugarTable>() != null).ToArray();
|
||||
db.CodeFirst.SetStringDefaultLength(200).InitTables(entityes);
|
||||
|
||||
//23个表
|
||||
db.CodeFirst.InitTables(entityes);
|
||||
}
|
||||
|
||||
private static object GetParsValue(SugarParameter x)
|
||||
|
||||
@ -38,7 +38,7 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
public static void AddSwaggerConfig(this IServiceCollection services)
|
||||
{
|
||||
if (services == null) throw new ArgumentNullException(nameof(services));
|
||||
//IWebHostEnvironment hostEnvironment = App.GetRequiredService<IWebHostEnvironment>();
|
||||
//IWebHostEnvironment hostEnvironment = services.BuildServiceProvider().GetRequiredService<IWebHostEnvironment>();
|
||||
|
||||
services.AddSwaggerGen(c =>
|
||||
{
|
||||
@ -50,10 +50,10 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
});
|
||||
try
|
||||
{
|
||||
var tempPath = "";// hostEnvironment.ContentRootPath;
|
||||
//var tempPath = hostEnvironment.ContentRootPath;
|
||||
//添加文档注释
|
||||
c.IncludeXmlComments(Path.Combine(tempPath, "ZRAdmin.xml"), true);
|
||||
c.IncludeXmlComments(Path.Combine(tempPath, "ZRModel.xml"), true);
|
||||
c.IncludeXmlComments(Path.Combine("ZRAdmin.xml"), true);
|
||||
c.IncludeXmlComments(Path.Combine("ZRModel.xml"), true);
|
||||
//c.IncludeXmlComments(Path.Combine(Directory.GetParent(tempPath).FullName, "ZR.Model", "ZRModel.xml"), true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
using Infrastructure.Model;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Filters;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
|
||||
namespace ZR.Admin.WebApi.Filters
|
||||
{
|
||||
|
||||
@ -9,7 +9,7 @@ using System;
|
||||
using System.Linq;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Admin.WebApi.Framework;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
|
||||
namespace ZR.Admin.WebApi.Filters
|
||||
{
|
||||
|
||||
@ -6,7 +6,7 @@ using System.IdentityModel.Tokens.Jwt;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using ZR.Admin.WebApi.Extensions;
|
||||
using ZR.Model.System;
|
||||
using ZR.Model.System.Dto;
|
||||
using ZR.Service.System;
|
||||
|
||||
namespace ZR.Admin.WebApi.Framework
|
||||
|
||||
@ -12,6 +12,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="JinianNet.JNTemplate" Version="2.3.3" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.73" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.84-preview01" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
9
ZR.Model/ProteryConstant.cs
Normal file
9
ZR.Model/ProteryConstant.cs
Normal file
@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace ZR.Model
|
||||
{
|
||||
public enum ProteryConstant
|
||||
{
|
||||
NOTNULL = 0
|
||||
}
|
||||
}
|
||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 文章表
|
||||
/// </summary>
|
||||
[SugarTable("article")]
|
||||
[SugarTable("article", "文章管理")]
|
||||
[Tenant("0")]
|
||||
public class Article
|
||||
{
|
||||
@ -18,54 +18,64 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 文章标题
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "文章标题", Length = 254, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string Title { get; set; }
|
||||
/// <summary>
|
||||
/// 发布时间
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "发布时间")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
/// </summary>
|
||||
[SugarColumn(IsOnlyIgnoreInsert = true)]
|
||||
[SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "更新时间")]
|
||||
public DateTime? UpdateTime { get; set; }
|
||||
/// <summary>
|
||||
/// 文章内容
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "文章内容", ColumnDataType = "text")]
|
||||
public string Content { get; set; }
|
||||
/// <summary>
|
||||
/// 作者名
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "作者名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string AuthorName { get; set; }
|
||||
/// <summary>
|
||||
/// 发布者用户id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "发布者用户id", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public long UserId { get; set; }
|
||||
/// <summary>
|
||||
/// 文章状态 1、发布 2、草稿
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "文章状态 1、发布 2、草稿", Length = 20)]
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 编辑器类型 markdown,html
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "fmt_type")]
|
||||
[SugarColumn(ColumnDescription = "编辑器类型markdown,html", ColumnName = "fmt_type", Length = 20, IsNullable = true)]
|
||||
public string FmtType { get; set; }
|
||||
/// <summary>
|
||||
/// 文章标签eg:Net5,java
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "文章标签", Length = 20)]
|
||||
public string Tags { get; set; }
|
||||
/// <summary>
|
||||
/// 点击量
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "点击量", DefaultValue = "0")]
|
||||
public int Hits { get; set; }
|
||||
[SugarColumn(ColumnName = "category_Id")]
|
||||
[SugarColumn(ColumnDescription = "目录id", ColumnName = "category_Id")]
|
||||
public int CategoryId { get; set; }
|
||||
/// <summary>
|
||||
/// 封面地址
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "封面地址", Length = 255)]
|
||||
public string CoverUrl { get; set; }
|
||||
/// <summary>
|
||||
/// 是否公开 1、公开 0、不公开
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnDescription = "是否公开 1、公开 0、不公开", DefaultValue = "0")]
|
||||
public int IsPublic { get; set; }
|
||||
|
||||
[Navigate(NavigateType.OneToOne, nameof(CategoryId), nameof(ArticleCategory.CategoryId))] //自定义关系映射
|
||||
|
||||
@ -8,18 +8,20 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 文章目录
|
||||
/// </summary>
|
||||
[SugarTable("articleCategory")]
|
||||
[SugarTable("articleCategory", "文章目录")]
|
||||
[Tenant("0")]
|
||||
public class ArticleCategory
|
||||
{
|
||||
/// <summary>
|
||||
/// 目录id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, ColumnName = "Category_id")]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "category_id")]
|
||||
public int CategoryId { get; set; }
|
||||
|
||||
[SugarColumn(ColumnDescription = "目录名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string Name { get; set; }
|
||||
public int ParentId { get; set; }
|
||||
[SugarColumn(ColumnName = "create_time", IsNullable = true)]
|
||||
public int? ParentId { get; set; }
|
||||
[SugarColumn(ColumnDescription = "创建时间", ColumnName = "create_time")]
|
||||
public DateTime? CreateTime { get; set; }
|
||||
|
||||
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
||||
|
||||
@ -9,7 +9,7 @@ namespace ZR.Model.Models
|
||||
/// 多语言配置,数据实体对象
|
||||
/// </summary>
|
||||
[Tenant("0")]
|
||||
[SugarTable("sys_common_lang")]
|
||||
[SugarTable("sys_common_lang", "多语言配置表")]
|
||||
public class CommonLang
|
||||
{
|
||||
/// <summary>
|
||||
@ -23,21 +23,21 @@ namespace ZR.Model.Models
|
||||
/// 语言code
|
||||
/// </summary>
|
||||
[DisplayName("语言code")]
|
||||
[SugarColumn(ColumnName = "lang_code", IsNullable = false)]
|
||||
[SugarColumn(ColumnName = "lang_code", Length = 10, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string LangCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 语言key
|
||||
/// </summary>
|
||||
[DisplayName("语言key")]
|
||||
[SugarColumn(ColumnName = "lang_key")]
|
||||
[SugarColumn(ColumnName = "lang_key", Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string LangKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 名称
|
||||
/// </summary>
|
||||
[DisplayName("名称")]
|
||||
[SugarColumn(ColumnName = "lang_name", IsNullable = false)]
|
||||
[SugarColumn(ColumnName = "lang_name", Length = 2000, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string LangName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace ZR.Model.System
|
||||
namespace ZR.Model.System.Dto
|
||||
{
|
||||
/// <summary>
|
||||
/// 登录用户信息存储
|
||||
@ -33,11 +33,11 @@ namespace ZR.Model.System.Dto
|
||||
/// 是否缓存(1缓存 0不缓存)
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "是否缓存不能为空")]
|
||||
public string IsCache { get; set; }
|
||||
public int IsCache { get; set; }
|
||||
/// <summary>
|
||||
/// 是否外链 1、是 0、否
|
||||
/// </summary>
|
||||
public string IsFrame { get; set; }
|
||||
public int IsFrame { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 类型(M目录 C菜单 F按钮 L链接)
|
||||
|
||||
@ -12,10 +12,15 @@ namespace ZR.Model.System.Dto
|
||||
public string RoleName { get; set; }
|
||||
public string RoleKey { get; set; }
|
||||
public int RoleSort { get; set; }
|
||||
public string Status { get; set; }
|
||||
public int Status { get; set; }
|
||||
public int DataScope { get; set; }
|
||||
public int[] DeptIds { get; set; }
|
||||
/// <summary>
|
||||
/// 减少菜单集合
|
||||
/// </summary>
|
||||
public List<long> DelMenuIds { get; set; } = new List<long>();
|
||||
public bool MenuCheckStrictly { get; set; }
|
||||
public bool DeptCheckStrictly { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
namespace ZR.Model.System.Dto
|
||||
using System;
|
||||
|
||||
namespace ZR.Model.System.Dto
|
||||
{
|
||||
public class SysUserDto
|
||||
{
|
||||
@ -13,4 +15,22 @@
|
||||
/// </summary>
|
||||
public int Sex { get; set; }
|
||||
}
|
||||
|
||||
public class SysUserQueryDto
|
||||
{
|
||||
public long UserId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
public string NickName { get; set; }
|
||||
public string Email { get; set; }
|
||||
public string Remark { get; set; }
|
||||
public string Phonenumber { get; set; }
|
||||
/// <summary>
|
||||
/// 用户性别(0男 1女 2未知)
|
||||
/// </summary>
|
||||
public int Sex { get; set; }
|
||||
public DateTime? BeginTime { get; set; }
|
||||
public DateTime? EndTime { get; set; }
|
||||
public int Status { get; set; }
|
||||
public long DeptId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,38 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using SqlSugar;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace ZR.Model.System.Generate
|
||||
{
|
||||
/// <summary>
|
||||
/// 代码生成表
|
||||
/// </summary>
|
||||
[SqlSugar.SugarTable("gen_table")]
|
||||
[SqlSugar.Tenant("0")]
|
||||
[SugarTable("gen_table", "代码生成表")]
|
||||
[Tenant("0")]
|
||||
public class GenTable : SysBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 表id
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public int TableId { get; set; }
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public long TableId { get; set; }
|
||||
/// <summary>
|
||||
/// 数据库名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50)]
|
||||
public string DbName { get; set; }
|
||||
/// <summary>
|
||||
/// 表名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 150)]
|
||||
public string TableName { get; set; }
|
||||
/// <summary>
|
||||
/// 表描述
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 150)]
|
||||
public string TableComment { get; set; }
|
||||
/// <summary>
|
||||
/// 关联父表的表名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 150)]
|
||||
public string SubTableName { get; set; }
|
||||
/// <summary>
|
||||
/// 本表关联父表的外键名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 150)]
|
||||
public string SubTableFkName { get; set; }
|
||||
/// <summary>
|
||||
/// csharp类名
|
||||
@ -41,18 +47,22 @@ namespace ZR.Model.System.Generate
|
||||
/// <summary>
|
||||
/// 使用的模板(crud单表操作 tree树表操作 sub主子表操作)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, DefaultValue = "crud")]
|
||||
public string TplCategory { get; set; }
|
||||
/// <summary>
|
||||
/// 基本命名空间前缀
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string BaseNameSpace { get; set; }
|
||||
/// <summary>
|
||||
/// 生成模块名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50)]
|
||||
public string ModuleName { get; set; }
|
||||
/// <summary>
|
||||
/// 生成业务名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50)]
|
||||
public string BusinessName { get; set; }
|
||||
/// <summary>
|
||||
/// 生成功能名
|
||||
@ -65,23 +75,30 @@ namespace ZR.Model.System.Generate
|
||||
/// <summary>
|
||||
/// 生成代码方式(0zip压缩包 1自定义路径)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1, DefaultValue = "0")]
|
||||
public string GenType { get; set; }
|
||||
/// <summary>
|
||||
/// 代码生成保存路径
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 200, DefaultValue = "/")]
|
||||
public string GenPath { get; set; }
|
||||
/// <summary>
|
||||
/// 其他生成选项
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(IsJson = true, ColumnDataType = "nvarchar(4000)")]
|
||||
[SugarColumn(IsJson = true)]
|
||||
public Options Options { get; set; }
|
||||
|
||||
#region 表额外字段
|
||||
/** 表列信息 */
|
||||
[SqlSugar.SugarColumn(IsIgnore = true)]
|
||||
/// <summary>
|
||||
/// 表列信息
|
||||
/// </summary>
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<GenTableColumn> Columns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 字表信息
|
||||
/// </summary>
|
||||
[SqlSugar.SugarColumn(IsIgnore = true)]
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public GenTable SubTable { get; set; }
|
||||
#endregion
|
||||
}
|
||||
|
||||
@ -7,18 +7,21 @@ namespace ZR.Model.System.Generate
|
||||
/// <summary>
|
||||
/// 代码生成表字段
|
||||
/// </summary>
|
||||
[SugarTable("gen_table_column")]
|
||||
[SugarTable("gen_table_column", "代码生成表字段")]
|
||||
[Tenant("0")]
|
||||
public class GenTableColumn : SysBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 列id
|
||||
/// </summary>
|
||||
[SugarColumn(IsIdentity = true, IsPrimaryKey = true)]
|
||||
public int ColumnId { get; set; }
|
||||
public long ColumnId { get; set; }
|
||||
/// <summary>
|
||||
/// 导入代码生成表列名 首字母转了小写
|
||||
/// </summary>
|
||||
public string ColumnName { get; set; }
|
||||
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
||||
public int TableId { get; set; }
|
||||
public long TableId { get; set; }
|
||||
|
||||
[SugarColumn(IsOnlyIgnoreUpdate = true)]
|
||||
public string TableName { get; set; }
|
||||
@ -96,6 +99,7 @@ namespace ZR.Model.System.Generate
|
||||
/// <summary>
|
||||
/// 查询类型(等于、不等于、大于、小于、范围)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "EQ")]
|
||||
public string QueryType { get; set; } = "EQ";
|
||||
public int Sort { get; set; }
|
||||
/// <summary>
|
||||
|
||||
@ -8,6 +8,9 @@ namespace ZR.Model.System
|
||||
//[EpplusTable(PrintHeaders = true, AutofitColumns = true, AutoCalculate = true, ShowTotal = true)]
|
||||
public class SysBase
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建人
|
||||
/// </summary>
|
||||
[SugarColumn(IsOnlyIgnoreUpdate = true, Length = 64, IsNullable = true)]
|
||||
[JsonProperty(propertyName: "CreateBy")]
|
||||
[ExcelIgnore]
|
||||
@ -31,13 +34,5 @@ namespace ZR.Model.System
|
||||
public DateTime? Update_time { get; set; }
|
||||
[SugarColumn(Length = 500)]
|
||||
public string Remark { get; set; }
|
||||
[SugarColumn(IsIgnore = true, IsNullable = true)]
|
||||
[JsonIgnore]
|
||||
[ExcelIgnore]
|
||||
public DateTime? BeginTime { get; set; }
|
||||
[SugarColumn(IsIgnore = true, IsNullable = true)]
|
||||
[JsonIgnore]
|
||||
[ExcelIgnore]
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@ namespace ZR.Model.System
|
||||
/// @author mr.zhao
|
||||
/// @date 2021-09-29
|
||||
/// </summary>
|
||||
[SugarTable("sys_config")]
|
||||
[SugarTable("sys_config", "配置表")]
|
||||
[Tenant("0")]
|
||||
public class SysConfig : SysBase
|
||||
{
|
||||
@ -20,18 +20,22 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 参数名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string ConfigName { get; set; }
|
||||
/// <summary>
|
||||
/// 参数键名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string ConfigKey { get; set; }
|
||||
/// <summary>
|
||||
/// 参数键值
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 500)]
|
||||
public string ConfigValue { get; set; }
|
||||
/// <summary>
|
||||
/// 系统内置(Y是 N否)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1)]
|
||||
public string ConfigType { get; set; }
|
||||
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 部门表
|
||||
/// </summary>
|
||||
[SugarTable("sys_dept")]
|
||||
[SugarTable("sys_dept", "部门配置表")]
|
||||
[Tenant("0")]
|
||||
public class SysDept : SysBase
|
||||
{
|
||||
@ -29,6 +29,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string DeptName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -39,32 +40,36 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 负责人
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30)]
|
||||
public string Leader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 联系电话
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 11)]
|
||||
public string Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50)]
|
||||
public string Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门状态:0正常,1停用
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1, DefaultValue = "0")]
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标志(0代表存在 2代表删除)
|
||||
/// </summary>
|
||||
[SugarColumn(IsOnlyIgnoreInsert = true)]
|
||||
[SugarColumn(Length = 1, DefaultValue = "0")]
|
||||
public string DelFlag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 子菜单
|
||||
/// </summary>
|
||||
public List<SysDept> children = new List<SysDept>();
|
||||
public List<SysDept> children = new();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
||||
/// 字典数据表
|
||||
/// </summary>
|
||||
[Tenant("0")]
|
||||
[SugarTable("sys_dict_data")]
|
||||
[SugarTable("sys_dict_data", "字典数据表")]
|
||||
public class SysDictData : SysBase
|
||||
{
|
||||
/// <summary>
|
||||
@ -21,30 +21,37 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 字典标签
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string DictLabel { get; set; }
|
||||
/// <summary>
|
||||
/// 字典键值
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string DictValue { get; set; }
|
||||
/// <summary>
|
||||
/// 字典类型
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string DictType { get; set; }
|
||||
/// <summary>
|
||||
/// 样式属性(其他样式扩展)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string CssClass { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 表格回显样式
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string ListClass { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 是否默认(Y是 N否)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1, DefaultValue = "N")]
|
||||
public string IsDefault { get; set; }
|
||||
/// <summary>
|
||||
/// 状态(0正常 1停用)
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1)]
|
||||
public string Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,8 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 字典类型表
|
||||
/// </summary>
|
||||
[SugarTable("sys_dict_type")]
|
||||
[SugarTable("sys_dict_type", "字典类型表")]
|
||||
[SugarIndex("index_dict_type", nameof(DictType), OrderByType.Asc, true)]
|
||||
[Tenant("0")]
|
||||
public class SysDictType : SysBase
|
||||
{
|
||||
@ -17,18 +18,22 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 字典名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string DictName { get; set; }
|
||||
/// <summary>
|
||||
/// 字典类型
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string DictType { get; set; }
|
||||
/// <summary>
|
||||
/// 状态 0、正常 1、停用
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1, DefaultValue = "0")]
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 系统内置 Y是 N否
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1, DefaultValue = "N")]
|
||||
public string Type { get; set; }
|
||||
/// <summary>
|
||||
/// 自定义sql
|
||||
|
||||
@ -5,7 +5,7 @@ using System;
|
||||
namespace ZR.Model.System
|
||||
{
|
||||
[Tenant("0")]
|
||||
[SugarTable("sys_file")]
|
||||
[SugarTable("sys_file", "文件存储表")]
|
||||
public class SysFile
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// sys_logininfor 表
|
||||
/// </summary>
|
||||
[SugarTable("sys_logininfor")]
|
||||
[SugarTable("sys_logininfor", "登录日志表")]
|
||||
[Tenant("0")]
|
||||
public class SysLogininfor
|
||||
{
|
||||
@ -21,32 +21,33 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 登录状态 0成功 1失败
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 1, DefaultValue = "0")]
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录IP地址
|
||||
/// </summary>
|
||||
public string Ipaddr { get; set; }
|
||||
public string Ipaddr { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 登录地点
|
||||
/// </summary>
|
||||
public string LoginLocation { get; set; }
|
||||
public string LoginLocation { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 浏览器类型
|
||||
/// </summary>
|
||||
public string Browser { get; set; }
|
||||
public string Browser { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
/// </summary>
|
||||
public string Os { get; set; }
|
||||
public string Os { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 提示消息
|
||||
/// </summary>
|
||||
public string Msg { get; set; }
|
||||
public string Msg { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 访问时间
|
||||
|
||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// Sys_menu表
|
||||
/// </summary>
|
||||
[SugarTable("sys_menu")]
|
||||
[SugarTable("sys_menu", "系统菜单表")]
|
||||
[Tenant("0")]
|
||||
public class SysMenu : SysBase
|
||||
{
|
||||
@ -18,22 +18,25 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 菜单名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 50, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string MenuName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 父菜单ID
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public long ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 显示顺序
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 路由地址
|
||||
/// </summary>
|
||||
public string Path { get; set; } = "#";
|
||||
public string Path { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// 组件路径
|
||||
@ -43,35 +46,42 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 是否缓存(1缓存 0不缓存)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0", ColumnDataType = "int")]
|
||||
public string IsCache { get; set; }
|
||||
/// <summary>
|
||||
/// 是否外链 1、是 0、否
|
||||
/// </summary>
|
||||
public string IsFrame { get; set; }
|
||||
[SugarColumn(DefaultValue = "0", ColumnDataType = "int")]
|
||||
public string IsFrame { get; set; } = "0";
|
||||
|
||||
/// <summary>
|
||||
/// 类型(M目录 C菜单 F按钮 L链接)
|
||||
/// </summary>
|
||||
public string MenuType { get; set; }
|
||||
[SugarColumn(Length = 1)]
|
||||
public string MenuType { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 显示状态(0显示 1隐藏)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0", Length = 1)]
|
||||
public string Visible { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单状态(0正常 1停用)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0", Length = 1)]
|
||||
public string Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 权限字符串
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100)]
|
||||
public string Perms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单图标
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "#")]
|
||||
public string Icon { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 菜单名key
|
||||
|
||||
@ -3,12 +3,12 @@ using SqlSugar;
|
||||
namespace ZR.Model.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 通知公告表,数据实体对象
|
||||
/// 通知公告表
|
||||
///
|
||||
/// @author zr
|
||||
/// @date 2021-12-15
|
||||
/// </summary>
|
||||
[SugarTable("sys_notice")]
|
||||
[SugarTable("sys_notice", "通知公告表")]
|
||||
[Tenant(0)]
|
||||
public class SysNotice : SysBase
|
||||
{
|
||||
@ -20,21 +20,22 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 公告标题
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "notice_title")]
|
||||
[SugarColumn(ColumnName = "notice_title", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string NoticeTitle { get; set; }
|
||||
/// <summary>
|
||||
/// 公告类型 (1通知 2公告)
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "notice_type")]
|
||||
[SugarColumn(ColumnName = "notice_type", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int NoticeType { get; set; }
|
||||
/// <summary>
|
||||
/// 公告内容
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "notice_content")]
|
||||
[SugarColumn(ColumnName = "notice_content", ColumnDataType = "text")]
|
||||
public string NoticeContent { get; set; }
|
||||
/// <summary>
|
||||
/// 公告状态 (0正常 1关闭)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int Status { get; set; }
|
||||
}
|
||||
}
|
||||
@ -5,22 +5,24 @@ using System.ComponentModel;
|
||||
|
||||
namespace ZR.Model.System
|
||||
{
|
||||
[SugarTable("sys_oper_log")]
|
||||
[SugarTable("sys_oper_log", "操作日志表")]
|
||||
[Tenant("0")]
|
||||
public class SysOperLog
|
||||
{
|
||||
/// <summary>
|
||||
/// 操作id
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public long OperId { get; set; }
|
||||
/// <summary>
|
||||
/// 操作模块
|
||||
/// </summary>
|
||||
[DisplayName("操作模块")]
|
||||
public string Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 业务类型(0其它 1新增 2修改 3删除 4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据)
|
||||
/// </summary>
|
||||
[DisplayName("业务类型")]
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public int BusinessType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -33,79 +35,71 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 请求方法
|
||||
/// </summary>
|
||||
[DisplayName("请求方法")]
|
||||
public string Method { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求方式
|
||||
/// </summary>
|
||||
[DisplayName("请求方式")]
|
||||
public string RequestMethod { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作类别(0其它 1后台用户 2手机端用户)
|
||||
/// </summary>
|
||||
//@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
|
||||
[DisplayName("操作类别")]
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public int OperatorType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作人员
|
||||
/// </summary>
|
||||
[DisplayName("操作人员")]
|
||||
public string OperName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求url
|
||||
/// </summary>
|
||||
[DisplayName("请求地址")]
|
||||
public string OperUrl { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作地址
|
||||
/// </summary>
|
||||
[DisplayName("操作地址")]
|
||||
public string OperIp { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作地点
|
||||
/// </summary>
|
||||
[DisplayName("操作地点")]
|
||||
public string OperLocation { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 请求参数
|
||||
/// </summary>
|
||||
[DisplayName("请求参数")]
|
||||
[SugarColumn(Length = 2000)]
|
||||
public string OperParam { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 返回参数
|
||||
/// </summary>
|
||||
[DisplayName("返回结果")]
|
||||
[SugarColumn(ColumnDataType = "text")]
|
||||
public string JsonResult { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作状态(0正常 1异常)
|
||||
/// </summary>
|
||||
[DisplayName("状态")]
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 错误消息
|
||||
/// </summary>
|
||||
[DisplayName("错误消息")]
|
||||
public string ErrorMsg { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 操作时间
|
||||
/// </summary>
|
||||
[DisplayName("操作时间")]
|
||||
public DateTime? OperTime { get; set; }
|
||||
/// <summary>
|
||||
/// 操作用时
|
||||
/// </summary>
|
||||
[DisplayName("操作用时")]
|
||||
public long Elapsed { get; set; }
|
||||
public string DeptName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
namespace ZR.Model.System
|
||||
{
|
||||
[SugarTable("sys_post")]
|
||||
[SugarTable("sys_post", "岗位表")]
|
||||
[Tenant("0")]
|
||||
public class SysPost : SysBase
|
||||
{
|
||||
@ -11,9 +11,13 @@ namespace ZR.Model.System
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
|
||||
public long PostId { get; set; }
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string PostCode { get; set; }
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string PostName { get; set; }
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int PostSort { get; set; }
|
||||
[SugarColumn(Length = 1)]
|
||||
public string Status { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 角色表 sys_role
|
||||
/// </summary>
|
||||
[SugarTable("sys_role")]
|
||||
[SugarTable("sys_role", "角色表")]
|
||||
[Tenant("0")]
|
||||
public class SysRole : SysBase
|
||||
{
|
||||
@ -18,41 +18,47 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 角色名称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string RoleName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色权限
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string RoleKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色排序
|
||||
/// </summary>
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int RoleSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 帐号状态(0正常 1停用)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public int Status { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 删除标志(0代表存在 2代表删除)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public int DelFlag { get; set; }
|
||||
/// <summary>
|
||||
/// 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限))
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "1")]
|
||||
public int DataScope { get; set; }
|
||||
/// <summary>
|
||||
/// 菜单树选择项是否关联显示
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "menu_check_strictly")]
|
||||
public bool MenuCheckStrictly { get; set; }
|
||||
public bool MenuCheckStrictly { get; set; } = true;
|
||||
/// <summary>
|
||||
/// 部门树选择项是否关联显示
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "dept_check_strictly")]
|
||||
public bool DeptCheckStrictly { get; set; }
|
||||
public bool DeptCheckStrictly { get; set; } = true;
|
||||
/// <summary>
|
||||
/// 菜单组
|
||||
/// </summary>
|
||||
|
||||
@ -1,10 +1,15 @@
|
||||
namespace ZR.Model.System
|
||||
using SqlSugar;
|
||||
|
||||
namespace ZR.Model.System
|
||||
{
|
||||
[SqlSugar.SugarTable("sys_role_dept")]
|
||||
[SqlSugar.Tenant(0)]
|
||||
[SugarTable("sys_role_dept", "角色部门")]
|
||||
[Tenant(0)]
|
||||
public class SysRoleDept
|
||||
{
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL, IsPrimaryKey = true)]
|
||||
public long RoleId { get; set; }
|
||||
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL, IsPrimaryKey = true)]
|
||||
public long DeptId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,17 +7,15 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 角色菜单
|
||||
/// </summary>
|
||||
[SugarTable("sys_role_menu")]
|
||||
[SugarTable("sys_role_menu", "角色菜单")]
|
||||
[Tenant("0")]
|
||||
public class SysRoleMenu
|
||||
public class SysRoleMenu : SysBase
|
||||
{
|
||||
[JsonProperty("roleId")]
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
[SugarColumn(IsPrimaryKey = true, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public long Role_id { get; set; }
|
||||
[JsonProperty("menuId")]
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
[SugarColumn(IsPrimaryKey = true, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public long Menu_id { get; set; }
|
||||
public DateTime Create_time { get; set; }
|
||||
public string Create_by { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,15 +0,0 @@
|
||||
using SqlSugar;
|
||||
|
||||
namespace ZR.Model.System
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色部门
|
||||
/// </summary>
|
||||
[SugarTable("sys_role_post")]
|
||||
[Tenant("0")]
|
||||
public class SysRolePost
|
||||
{
|
||||
public long RoleId { get; set; }
|
||||
public long DeptId { get; set; }
|
||||
}
|
||||
}
|
||||
@ -1,5 +1,4 @@
|
||||
using Newtonsoft.Json;
|
||||
using SqlSugar;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
@ -8,9 +7,9 @@ namespace ZR.Model.System
|
||||
///<summary>
|
||||
///计划任务
|
||||
///</summary>
|
||||
[SugarTable("sys_tasks")]
|
||||
[SugarTable("sys_tasks", "计划任务表")]
|
||||
[Tenant("0")]
|
||||
public class SysTasks
|
||||
public class SysTasks : SysBase
|
||||
{
|
||||
public SysTasks()
|
||||
{
|
||||
@ -28,42 +27,42 @@ namespace ZR.Model.System
|
||||
/// 任务名称
|
||||
/// </summary>
|
||||
[Display(Name = "任务名称")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务分组
|
||||
/// </summary>
|
||||
[Display(Name = "任务分组")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string JobGroup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 运行时间表达式
|
||||
/// </summary>
|
||||
[Display(Name = "运行时间表达式")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string Cron { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 程序集名称
|
||||
/// </summary>
|
||||
[Display(Name = "程序集名称")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string AssemblyName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务所在类
|
||||
/// </summary>
|
||||
[Display(Name = "任务所在类")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string ClassName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 任务描述
|
||||
/// </summary>
|
||||
[Display(Name = "任务描述")]
|
||||
public string Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 执行次数
|
||||
/// </summary>
|
||||
[Display(Name = "执行次数")]
|
||||
[SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int RunTimes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -83,6 +82,7 @@ namespace ZR.Model.System
|
||||
/// 默认 : 1
|
||||
/// </summary>
|
||||
[Display(Name = "触发器类型(0、simple 1、cron)")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int TriggerType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -90,42 +90,22 @@ namespace ZR.Model.System
|
||||
/// 默认 : 0
|
||||
/// </summary>
|
||||
[Display(Name = "执行间隔时间(单位:秒)")]
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int IntervalSecond { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 是否启动
|
||||
/// 默认 : 0
|
||||
/// </summary>
|
||||
[Display(Name = "是否启动")]
|
||||
[SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public int IsStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 传入参数
|
||||
/// 默认 :
|
||||
/// </summary>
|
||||
[Display(Name = "传入参数")]
|
||||
public string JobParams { get; set; }
|
||||
|
||||
[SugarColumn(IsOnlyIgnoreUpdate = true)]//设置后修改不会有此字段
|
||||
[JsonProperty(propertyName: "CreateBy")]
|
||||
public string Create_by { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
//[Display(Name = "创建时间")]
|
||||
[SugarColumn(IsOnlyIgnoreUpdate = true)]//设置后修改不会有此字段
|
||||
[JsonProperty(propertyName: "CreateTime")]
|
||||
public DateTime Create_time { get; set; } = DateTime.Now;
|
||||
|
||||
[JsonIgnore]
|
||||
[JsonProperty(propertyName: "UpdateBy")]
|
||||
[SugarColumn(IsOnlyIgnoreInsert = true)]
|
||||
public string Update_by { get; set; }
|
||||
|
||||
[SugarColumn(IsOnlyIgnoreInsert = true)]//设置后插入数据不会有此字段
|
||||
[JsonProperty(propertyName: "UpdateTime")]
|
||||
public DateTime Update_time { get; set; } = DateTime.Now;
|
||||
/// <summary>
|
||||
/// 最后运行时间
|
||||
/// </summary>
|
||||
@ -137,6 +117,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 任务类型 1、程序集 2、网络请求 3、SQL语句
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "1")]
|
||||
public int TaskType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
@ -146,6 +127,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 网络请求方式
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 20)]
|
||||
public string RequestMethod { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -6,7 +6,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 任务日志
|
||||
/// </summary>
|
||||
[SugarTable("sys_tasks_log")]
|
||||
[SugarTable("sys_tasks_log", "任务日志表")]
|
||||
[Tenant("0")]
|
||||
public class SysTasksLog
|
||||
{
|
||||
@ -18,12 +18,22 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 任务Id
|
||||
/// </summary>
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string JobId { get; set; }
|
||||
/// <summary>
|
||||
/// 任务名
|
||||
/// </summary>
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string JobName { get; set; }
|
||||
/// <summary>
|
||||
/// 任务分组
|
||||
/// </summary>
|
||||
[SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string JobGroup { get; set; }
|
||||
/// <summary>
|
||||
/// 执行状态(0正常 1失败)
|
||||
/// </summary>
|
||||
[SugarColumn(DefaultValue = "0")]
|
||||
public string Status { get; set; }
|
||||
/// <summary>
|
||||
/// 异常
|
||||
|
||||
@ -9,7 +9,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 用户表
|
||||
/// </summary>
|
||||
[SugarTable("sys_user")]
|
||||
[SugarTable("sys_user", "用户表")]
|
||||
[Tenant("0")]
|
||||
public class SysUser : SysBase
|
||||
{
|
||||
@ -21,12 +21,12 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 登录用户名
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30, ColumnDescription = "用户账号", IsNullable = false)]
|
||||
[SugarColumn(Length = 30, ColumnDescription = "用户账号", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string UserName { get; set; }
|
||||
/// <summary>
|
||||
/// 用户昵称
|
||||
/// </summary>
|
||||
[SugarColumn(Length = 30, ColumnDescription = "用户昵称", IsNullable = false)]
|
||||
[SugarColumn(Length = 30, ColumnDescription = "用户昵称", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string NickName { get; set; }
|
||||
/// <summary>
|
||||
/// 用户类型(00系统用户)
|
||||
@ -40,7 +40,7 @@ namespace ZR.Model.System
|
||||
|
||||
[JsonIgnore]
|
||||
[ExcelIgnore]
|
||||
[SugarColumn(Length = 100, ColumnDescription = "密码", IsNullable = false)]
|
||||
[SugarColumn(Length = 100, ColumnDescription = "密码", ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public string Password { get; set; }
|
||||
/// <summary>
|
||||
/// 手机号
|
||||
|
||||
@ -5,11 +5,13 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 用户岗位
|
||||
/// </summary>
|
||||
[SugarTable("sys_user_post")]
|
||||
[SugarTable("sys_user_post", "用户与岗位关联表")]
|
||||
[Tenant("0")]
|
||||
public class SysUserPost
|
||||
{
|
||||
[SugarColumn(IsPrimaryKey = true, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public long UserId { get; set; }
|
||||
[SugarColumn(IsPrimaryKey = true, ExtendedAttribute = ProteryConstant.NOTNULL)]
|
||||
public long PostId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ namespace ZR.Model.System
|
||||
/// <summary>
|
||||
/// 用户角色关联表 用户N-1 角色
|
||||
/// </summary>
|
||||
[SugarTable("sys_user_role")]
|
||||
[SugarTable("sys_user_role", "用户和角色关联表")]
|
||||
[Tenant("0")]
|
||||
public class SysUserRole
|
||||
{
|
||||
|
||||
@ -10,8 +10,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MiniExcel" Version="1.30.3" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.73" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.84-preview01" />
|
||||
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@ -15,6 +15,6 @@
|
||||
<PackageReference Include="MySqlConnector" Version="2.2.6" />
|
||||
<PackageReference Include="NETCore.Encrypt" Version="2.1.1" />
|
||||
<PackageReference Include="SqlSugar.IOC" Version="2.0.0" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.73" />
|
||||
<PackageReference Include="SqlSugarCoreNoDrive" Version="5.1.4.84-preview01" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -7,7 +7,7 @@ namespace ZR.Service.System.IService
|
||||
{
|
||||
public interface ISysUserService : IBaseService<SysUser>
|
||||
{
|
||||
public PagedInfo<SysUser> SelectUserList(SysUser user, PagerInfo pager);
|
||||
public PagedInfo<SysUser> SelectUserList(SysUserQueryDto user, PagerInfo pager);
|
||||
|
||||
/// <summary>
|
||||
/// 通过用户ID查询用户
|
||||
|
||||
@ -577,7 +577,6 @@ namespace ZR.Service
|
||||
Path = genTableInfo.BusinessName,
|
||||
Component = $"{genTableInfo.ModuleName.FirstLowerCase()}/{genTableInfo.BusinessName}",
|
||||
Perms = $"{permPrefix}:list",
|
||||
IsFrame = "0",
|
||||
IsCache = "1",
|
||||
MenuType = "C",
|
||||
Visible = "0",
|
||||
@ -596,7 +595,6 @@ namespace ZR.Service
|
||||
ParentId = menu.MenuId,
|
||||
OrderNum = 1,
|
||||
Perms = $"{permPrefix}:query",
|
||||
IsFrame = "0",
|
||||
MenuType = "F",
|
||||
Visible = "0",
|
||||
Status = "0",
|
||||
@ -608,7 +606,6 @@ namespace ZR.Service
|
||||
ParentId = menu.MenuId,
|
||||
OrderNum = 2,
|
||||
Perms = $"{permPrefix}:add",
|
||||
IsFrame = "0",
|
||||
MenuType = "F",
|
||||
Visible = "0",
|
||||
Status = "0",
|
||||
@ -620,7 +617,6 @@ namespace ZR.Service
|
||||
ParentId = menu.MenuId,
|
||||
OrderNum = 3,
|
||||
Perms = $"{permPrefix}:delete",
|
||||
IsFrame = "0",
|
||||
MenuType = "F",
|
||||
Visible = "0",
|
||||
Status = "0",
|
||||
@ -633,7 +629,6 @@ namespace ZR.Service
|
||||
ParentId = menu.MenuId,
|
||||
OrderNum = 4,
|
||||
Perms = $"{permPrefix}:edit",
|
||||
IsFrame = "0",
|
||||
MenuType = "F",
|
||||
Visible = "0",
|
||||
Status = "0",
|
||||
@ -646,7 +641,6 @@ namespace ZR.Service
|
||||
ParentId = menu.MenuId,
|
||||
OrderNum = 5,
|
||||
Perms = $"{permPrefix}:export",
|
||||
IsFrame = "0",
|
||||
MenuType = "F",
|
||||
Visible = "0",
|
||||
Status = "0",
|
||||
|
||||
@ -39,7 +39,7 @@ namespace ZR.Service
|
||||
/// 根据条件分页查询用户列表
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public PagedInfo<SysUser> SelectUserList(SysUser user, PagerInfo pager)
|
||||
public PagedInfo<SysUser> SelectUserList(SysUserQueryDto user, PagerInfo pager)
|
||||
{
|
||||
var exp = Expressionable.Create<SysUser>();
|
||||
exp.AndIF(!string.IsNullOrEmpty(user.UserName), u => u.UserName.Contains(user.UserName));
|
||||
@ -323,7 +323,7 @@ namespace ZR.Service
|
||||
/// <returns></returns>
|
||||
public SysUser Login(LoginBodyDto user)
|
||||
{
|
||||
return GetFirst(it => it.UserName == user.Username && it.Password == user.Password);
|
||||
return GetFirst(it => it.UserName == user.Username && it.Password.ToLower() == user.Password.ToLower());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -96,8 +96,8 @@ CREATE TABLE `sys_dept` (
|
||||
`leader` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '负责人',
|
||||
`phone` varchar(11) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系电话',
|
||||
`email` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '邮箱',
|
||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '部门状态(0正常 1停用)',
|
||||
`delFlag` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`status` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '部门状态(0正常 1停用)',
|
||||
`delFlag` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
@ -181,9 +181,9 @@ CREATE TABLE `sys_menu` (
|
||||
`component` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件路径',
|
||||
`isFrame` int(1) NULL DEFAULT 0 COMMENT '是否外链(0 否 1 是)',
|
||||
`isCache` int(1) NULL DEFAULT 0 COMMENT '是否缓存(0缓存 1不缓存)',
|
||||
`menuType` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮 L链接)',
|
||||
`visible` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0显示 1隐藏)',
|
||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
|
||||
`menuType` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '菜单类型(M目录 C菜单 F按钮 L链接)',
|
||||
`visible` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0显示 1隐藏)',
|
||||
`status` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '0' COMMENT '菜单状态(0正常 1停用)',
|
||||
`perms` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限标识',
|
||||
`icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '#' COMMENT '菜单图标',
|
||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
@ -229,7 +229,7 @@ CREATE TABLE `sys_post` (
|
||||
`postCode` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位编码',
|
||||
`postName` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '岗位名称',
|
||||
`postSort` int(4) NOT NULL COMMENT '显示顺序',
|
||||
`status` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '状态(0正常 1停用)',
|
||||
`status` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '状态(0正常 1停用)',
|
||||
`create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
|
||||
`update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
@ -374,7 +374,7 @@ create table sys_config (
|
||||
configName varchar(100) default '' comment '参数名称',
|
||||
configKey varchar(100) default '' comment '参数键名',
|
||||
configValue varchar(500) default '' comment '参数键值',
|
||||
configType char(1) default 'N' comment '系统内置(Y是 N否)',
|
||||
configType varchar(1) default 'N' comment '系统内置(Y是 N否)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
create_time datetime comment '创建时间',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
|
||||
@ -788,8 +788,8 @@ CREATE TABLE "public"."sys_role" (
|
||||
"rolekey" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
|
||||
"rolesort" int4 NOT NULL,
|
||||
"datascope" int4 COLLATE "pg_catalog"."default",
|
||||
"menu_check_strictly" int2,
|
||||
"dept_check_strictly" int2 NOT NULL,
|
||||
"menu_check_strictly" bool,
|
||||
"dept_check_strictly" bool NOT NULL,
|
||||
"status" int4 COLLATE "pg_catalog"."default" NOT NULL,
|
||||
"delflag" int4 COLLATE "pg_catalog"."default" NOT NULL,
|
||||
"create_by" varchar(64) COLLATE "pg_catalog"."default",
|
||||
|
||||
@ -104,8 +104,8 @@ CREATE TABLE sys_dict_type (
|
||||
customSql varchar(500) NULL DEFAULT NULL ,-- '自定义sql',
|
||||
)
|
||||
GO
|
||||
CREATE UNIQUE INDEX dictType ON dbo.sys_dict_type(dictType)
|
||||
GO
|
||||
--CREATE UNIQUE INDEX dictType ON dbo.sys_dict_type(dictType)
|
||||
--GO
|
||||
|
||||
if OBJECT_ID(N'sys_dict_data',N'U') is not NULL DROP TABLE sys_dict_data
|
||||
GO
|
||||
@ -137,7 +137,7 @@ CREATE TABLE sys_logininfor (
|
||||
loginLocation varchar(255) NULL DEFAULT '' ,-- '登录地点',
|
||||
browser varchar(50) NULL DEFAULT '' ,-- '浏览器类型',
|
||||
os varchar(50) NULL DEFAULT '' ,-- '操作系统',
|
||||
status char(1) NULL DEFAULT '0' ,-- '登录状态(0成功 1失败)',
|
||||
status varchar(1) NULL DEFAULT '0' ,-- '登录状态(0成功 1失败)',
|
||||
msg varchar(255) NULL DEFAULT '' ,-- '提示消息',
|
||||
loginTime DATETIME NULL DEFAULT NULL ,-- '访问时间',
|
||||
)
|
||||
@ -153,9 +153,9 @@ CREATE TABLE sys_menu (
|
||||
component varchar(255) NULL DEFAULT NULL ,-- '组件路径',
|
||||
isFrame int NULL DEFAULT 0 ,-- '是否外链(0 否 1 是)',
|
||||
isCache int NULL DEFAULT 0 ,-- '是否缓存(0缓存 1不缓存)',
|
||||
menuType char(1) NULL DEFAULT '' ,-- '菜单类型(M目录 C菜单 F按钮 L链接)',
|
||||
visible char(1) NULL DEFAULT '0' ,-- '菜单状态(0显示 1隐藏)',
|
||||
status char(1) NULL DEFAULT '0' ,-- '菜单状态(0正常 1停用)',
|
||||
menuType varchar(1) NULL DEFAULT '' ,-- '菜单类型(M目录 C菜单 F按钮 L链接)',
|
||||
visible varchar(1) NULL DEFAULT '0' ,-- '菜单状态(0显示 1隐藏)',
|
||||
status varchar(1) NULL DEFAULT '0' ,-- '菜单状态(0正常 1停用)',
|
||||
perms varchar(100) NULL DEFAULT NULL ,-- '权限标识',
|
||||
icon varchar(100) NULL DEFAULT '#' ,-- '菜单图标',
|
||||
create_by varchar(64) NULL DEFAULT '' ,-- '创建者',
|
||||
@ -186,7 +186,7 @@ CREATE TABLE sys_oper_log (
|
||||
operIP varchar(50) DEFAULT '' , -- '主机地址',
|
||||
operLocation varchar(255) DEFAULT '' , -- '操作地点',
|
||||
operParam varchar(2000) DEFAULT '' , -- '请求参数',
|
||||
jsonResult varchar(max) DEFAULT '' , -- '返回参数',
|
||||
jsonResult TEXT DEFAULT '' , -- '返回参数',
|
||||
status int NULL DEFAULT 0 , -- '操作状态(0正常 1异常)',
|
||||
errorMsg varchar(2000) DEFAULT '' , -- '错误消息',
|
||||
operTime datetime NULL DEFAULT NULL , -- '操作时间',
|
||||
@ -265,8 +265,8 @@ CREATE TABLE sys_role (
|
||||
roleKey varchar(100) NOT NULL , -- '角色权限字符串',
|
||||
roleSort int NOT NULL , -- '显示顺序',
|
||||
dataScope int NULL DEFAULT 1 , -- '数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 )',
|
||||
menu_check_strictly int NULL DEFAULT 1 , -- '菜单树选择项是否关联显示',
|
||||
dept_check_strictly int NOT NULL DEFAULT 1 , -- '部门树选择项是否关联显示',
|
||||
menu_check_strictly BIT NOT NULL DEFAULT 1 , -- '菜单树选择项是否关联显示',
|
||||
dept_check_strictly BIT NOT NULL DEFAULT 1 , -- '部门树选择项是否关联显示',
|
||||
status int NOT NULL , -- '角色状态(0正常 1停用)',
|
||||
delFlag int NOT NULL DEFAULT 0 , -- '删除标志(0代表存在 2代表删除)',
|
||||
create_by varchar(64) NULL DEFAULT '' , -- '创建者',
|
||||
@ -310,7 +310,10 @@ CREATE TABLE sys_role_menu (
|
||||
role_id bigint NOT NULL , -- '角色ID',
|
||||
menu_id bigint NOT NULL , -- '菜单ID',
|
||||
create_by varchar(20) DEFAULT NULL,
|
||||
create_time datetime NULL DEFAULT NULL
|
||||
create_time datetime NULL DEFAULT NULL,
|
||||
update_by VARCHAR(20) DEFAULT NULL,
|
||||
update_time DATETIME NULL ,
|
||||
remark VARCHAR(100)
|
||||
)
|
||||
GO
|
||||
alter table sys_role_menu add primary key(menu_id,role_id)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user