diff --git a/Infrastructure/Helper/XmlCommentHelper.cs b/Infrastructure/Helper/XmlCommentHelper.cs new file mode 100644 index 0000000..984b8ef --- /dev/null +++ b/Infrastructure/Helper/XmlCommentHelper.cs @@ -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}:)?(?.+?)"" ?/>"); + private static Regex CodeTagPattern = new Regex(@"(?.+?)"); + private static Regex ParaTagPattern = new Regex(@"(?.+?)", RegexOptions.Singleline); + + List navigators = new List(); + + /// + /// 从当前dll文件中加载所有的xml文件 + /// + 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); + } + } + } + /// + /// 从xml中加载 + /// + /// + public void LoadXml(params string[] xmls) + { + foreach (var xml in xmls) + { + Load(new MemoryStream(Encoding.UTF8.GetBytes(xml))); + } + } + /// + /// 从文件中加载 + /// + /// + public void Load(params string[] xmlFiles) + { + foreach (var xmlFile in xmlFiles) + { + var doc = new XPathDocument(xmlFile); + navigators.Add(doc.CreateNavigator()); + + //Console.WriteLine("加载xml文件=" + xmlFile); + } + } + /// + /// 从流中加载 + /// + /// + public void Load(params Stream[] streams) + { + foreach (var stream in streams) + { + var doc = new XPathDocument(stream); + navigators.Add(doc.CreateNavigator()); + } + } + + /// + /// 读取类型中的注释 + /// + /// 类型 + /// 注释路径 + /// 可读性优化(比如:去掉xml标记) + /// + public string GetTypeComment(Type type, string xPath = "summary", bool humanize = true) + { + var typeMemberName = GetMemberNameForType(type); + return GetComment(typeMemberName, xPath, humanize); + } + /// + /// 读取字段或者属性的注释 + /// + /// 字段或者属性 + /// 注释路径 + /// 可读性优化(比如:去掉xml标记) + /// + public string GetFieldOrPropertyComment(MemberInfo fieldOrPropertyInfo, string xPath = "summary", bool humanize = true) + { + var fieldOrPropertyMemberName = GetMemberNameForFieldOrProperty(fieldOrPropertyInfo); + return GetComment(fieldOrPropertyMemberName, xPath, humanize); + } + /// + /// 读取方法中的注释 + /// + /// 方法 + /// 注释路径 + /// 可读性优化(比如:去掉xml标记) + /// + public string GetMethodComment(MethodInfo methodInfo, string xPath = "summary", bool humanize = true) + { + var methodMemberName = GetMemberNameForMethod(methodInfo); + return GetComment(methodMemberName, xPath, humanize); + } + /// + /// 读取方法中的返回值注释 + /// + /// 方法 + /// 可读性优化(比如:去掉xml标记) + /// + public string GetMethodReturnComment(MethodInfo methodInfo, bool humanize = true) + { + return GetMethodComment(methodInfo, "returns", humanize); + } + /// + /// 读取参数的注释 + /// + /// 参数 + /// 可读性优化(比如:去掉xml标记) + /// + 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); + } + /// + /// 读取方法的所有参数的注释 + /// + /// 方法 + /// 可读性优化(比如:去掉xml标记) + /// + public Dictionary GetParameterComments(MethodInfo methodInfo, bool humanize = true) + { + var parameterInfos = methodInfo.GetParameters(); + Dictionary dict = new Dictionary(); + foreach (var parameterInfo in parameterInfos) + { + dict[parameterInfo.Name] = GetParameterComment(parameterInfo, humanize); + } + return dict; + } + /// + /// 读取指定名称节点的注释 + /// + /// 节点名称 + /// 注释路径 + /// 可读性优化(比如:去掉xml标记) + /// + 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注释 + /// + /// 节点名称 + /// 可读性优化(比如:去掉xml标记) + /// + public string GetSummary(string name, bool humanize = true) + { + return GetComment(name, "summary", humanize); + } + /// + /// 读取指定节点的example注释 + /// + /// 节点名称 + /// 可读性优化(比如:去掉xml标记) + /// + public string GetExample(string name, bool humanize = true) + { + return GetComment(name, "example", humanize); + } + /// + /// 获取方法的节点名称 + /// + /// + /// + 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(); + } + /// + /// 获取类型的节点名称 + /// + /// + /// + public string GetMemberNameForType(Type type) + { + var builder = new StringBuilder("T:"); + builder.Append(QualifiedNameFor(type)); + + return builder.ToString(); + } + /// + /// 获取字段或者属性的节点名称 + /// + /// + /// + 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 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) => "
" + match.Groups["display"].Value); + } + private string DecodeXml(string text) + { + return System.Net.WebUtility.HtmlDecode(text); + } + } +} diff --git a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs index 40b1ab1..37b5276 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysRoleController.cs @@ -58,16 +58,16 @@ namespace ZR.Admin.WebApi.Controllers.System /// /// 添加角色 /// - /// + /// /// [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(); 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 /// /// 修改角色 /// - /// + /// /// [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(); sysRoleService.CheckRoleAllowed(sysRoleDto); var info = sysRoleService.SelectRoleById(sysRoleDto.RoleId); if (info != null && info.RoleKey != sysRoleDto.RoleKey) diff --git a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs index dc64553..bde841d 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysUserController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysUserController.cs @@ -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 /// [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)); diff --git a/ZR.Admin.WebApi/Extensions/DbExtension.cs b/ZR.Admin.WebApi/Extensions/DbExtension.cs index ed3fb44..eec1f86 100644 --- a/ZR.Admin.WebApi/Extensions/DbExtension.cs +++ b/ZR.Admin.WebApi/Extensions/DbExtension.cs @@ -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(); + /// /// 初始化db /// + /// /// public static void AddDb(this IServiceCollection services, IConfiguration Configuration) { + commentHelper.LoadAll(); List dbConfigs = Configuration.GetSection("DbConfigs").Get>(); var iocList = new List(); @@ -110,12 +116,44 @@ 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.DataType = "text"; + 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() != null).ToArray(); - db.CodeFirst.SetStringDefaultLength(200).InitTables(entityes); + + //23个表 + db.CodeFirst.InitTables(entityes); } private static object GetParsValue(SugarParameter x) diff --git a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs index 2038144..8d73605 100644 --- a/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs +++ b/ZR.Admin.WebApi/Extensions/SwaggerExtension.cs @@ -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 hostEnvironment = services.BuildServiceProvider().GetRequiredService(); 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) diff --git a/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs b/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs index 4d66ab2..09fe303 100644 --- a/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs +++ b/ZR.Admin.WebApi/Filters/ActionPermissionFilter.cs @@ -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 { diff --git a/ZR.Admin.WebApi/Filters/VerifyAttribute.cs b/ZR.Admin.WebApi/Filters/VerifyAttribute.cs index f0ec952..a925b3e 100644 --- a/ZR.Admin.WebApi/Filters/VerifyAttribute.cs +++ b/ZR.Admin.WebApi/Filters/VerifyAttribute.cs @@ -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 { diff --git a/ZR.Admin.WebApi/Framework/JwtUtil.cs b/ZR.Admin.WebApi/Framework/JwtUtil.cs index bb5b9f2..c6ef113 100644 --- a/ZR.Admin.WebApi/Framework/JwtUtil.cs +++ b/ZR.Admin.WebApi/Framework/JwtUtil.cs @@ -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 diff --git a/ZR.CodeGenerator/ZR.CodeGenerator.csproj b/ZR.CodeGenerator/ZR.CodeGenerator.csproj index 31c8979..e697420 100644 --- a/ZR.CodeGenerator/ZR.CodeGenerator.csproj +++ b/ZR.CodeGenerator/ZR.CodeGenerator.csproj @@ -12,6 +12,6 @@ - + diff --git a/ZR.Model/ProteryConstant.cs b/ZR.Model/ProteryConstant.cs new file mode 100644 index 0000000..382c459 --- /dev/null +++ b/ZR.Model/ProteryConstant.cs @@ -0,0 +1,9 @@ +using System; + +namespace ZR.Model +{ + public enum ProteryConstant + { + NOTNULL = 0 + } +} diff --git a/ZR.Model/System/Article.cs b/ZR.Model/System/Article.cs index a5ecfb3..558deb0 100644 --- a/ZR.Model/System/Article.cs +++ b/ZR.Model/System/Article.cs @@ -6,7 +6,7 @@ namespace ZR.Model.System /// /// 文章表 /// - [SugarTable("article")] + [SugarTable("article", "文章管理")] [Tenant("0")] public class Article { @@ -18,54 +18,64 @@ namespace ZR.Model.System /// /// 文章标题 /// + [SugarColumn(ColumnDescription = "文章标题", Length = 254, ExtendedAttribute = ProteryConstant.NOTNULL)] public string Title { get; set; } /// /// 发布时间 /// + [SugarColumn(ColumnDescription = "发布时间")] public DateTime? CreateTime { get; set; } /// /// 更新时间 /// - [SugarColumn(IsOnlyIgnoreInsert = true)] + [SugarColumn(IsOnlyIgnoreInsert = true, ColumnDescription = "更新时间")] public DateTime? UpdateTime { get; set; } /// /// 文章内容 /// + [SugarColumn(ColumnDescription = "文章内容", ColumnDataType = "text")] public string Content { get; set; } /// /// 作者名 /// + [SugarColumn(ColumnDescription = "作者名", Length = 20, ExtendedAttribute = ProteryConstant.NOTNULL)] public string AuthorName { get; set; } /// /// 发布者用户id /// + [SugarColumn(ColumnDescription = "发布者用户id", ExtendedAttribute = ProteryConstant.NOTNULL)] public long UserId { get; set; } /// /// 文章状态 1、发布 2、草稿 /// + [SugarColumn(ColumnDescription = "文章状态 1、发布 2、草稿", Length = 20)] public string Status { get; set; } /// /// 编辑器类型 markdown,html /// - [SugarColumn(ColumnName = "fmt_type")] + [SugarColumn(ColumnDescription = "编辑器类型markdown,html", ColumnName = "fmt_type", Length = 20, IsNullable = true)] public string FmtType { get; set; } /// /// 文章标签eg:Net5,java /// + [SugarColumn(ColumnDescription = "文章标签", Length = 20)] public string Tags { get; set; } /// /// 点击量 /// + [SugarColumn(ColumnDescription = "点击量", DefaultValue = "0")] public int Hits { get; set; } - [SugarColumn(ColumnName = "category_Id")] + [SugarColumn(ColumnDescription = "目录id", ColumnName = "category_Id")] public int CategoryId { get; set; } /// /// 封面地址 /// + [SugarColumn(ColumnDescription = "封面地址", Length = 255)] public string CoverUrl { get; set; } /// /// 是否公开 1、公开 0、不公开 /// + [SugarColumn(ColumnDescription = "是否公开 1、公开 0、不公开", DefaultValue = "0")] public int IsPublic { get; set; } [Navigate(NavigateType.OneToOne, nameof(CategoryId), nameof(ArticleCategory.CategoryId))] //自定义关系映射 diff --git a/ZR.Model/System/ArticleCategory.cs b/ZR.Model/System/ArticleCategory.cs index d10569b..934b257 100644 --- a/ZR.Model/System/ArticleCategory.cs +++ b/ZR.Model/System/ArticleCategory.cs @@ -8,18 +8,20 @@ namespace ZR.Model.System /// /// 文章目录 /// - [SugarTable("articleCategory")] + [SugarTable("articleCategory", "文章目录")] [Tenant("0")] public class ArticleCategory { /// /// 目录id /// - [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)] diff --git a/ZR.Model/System/CommonLang.cs b/ZR.Model/System/CommonLang.cs index 8f27bb0..883e46e 100644 --- a/ZR.Model/System/CommonLang.cs +++ b/ZR.Model/System/CommonLang.cs @@ -9,7 +9,7 @@ namespace ZR.Model.Models /// 多语言配置,数据实体对象 /// [Tenant("0")] - [SugarTable("sys_common_lang")] + [SugarTable("sys_common_lang", "多语言配置表")] public class CommonLang { /// @@ -23,21 +23,21 @@ namespace ZR.Model.Models /// 语言code /// [DisplayName("语言code")] - [SugarColumn(ColumnName = "lang_code", IsNullable = false)] + [SugarColumn(ColumnName = "lang_code", Length = 10, ExtendedAttribute = ProteryConstant.NOTNULL)] public string LangCode { get; set; } /// /// 语言key /// [DisplayName("语言key")] - [SugarColumn(ColumnName = "lang_key")] + [SugarColumn(ColumnName = "lang_key", Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string LangKey { get; set; } /// /// 名称 /// [DisplayName("名称")] - [SugarColumn(ColumnName = "lang_name", IsNullable = false)] + [SugarColumn(ColumnName = "lang_name", Length = 2000, ExtendedAttribute = ProteryConstant.NOTNULL)] public string LangName { get; set; } /// diff --git a/ZR.Model/System/LoginUser.cs b/ZR.Model/System/Dto/LoginUser.cs similarity index 97% rename from ZR.Model/System/LoginUser.cs rename to ZR.Model/System/Dto/LoginUser.cs index 4ded62a..8bf08d7 100644 --- a/ZR.Model/System/LoginUser.cs +++ b/ZR.Model/System/Dto/LoginUser.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Linq; -namespace ZR.Model.System +namespace ZR.Model.System.Dto { /// /// 登录用户信息存储 diff --git a/ZR.Model/System/Dto/MenuDto.cs b/ZR.Model/System/Dto/MenuDto.cs index b75a59e..5c21422 100644 --- a/ZR.Model/System/Dto/MenuDto.cs +++ b/ZR.Model/System/Dto/MenuDto.cs @@ -33,11 +33,11 @@ namespace ZR.Model.System.Dto /// 是否缓存(1缓存 0不缓存) /// [Required(ErrorMessage = "是否缓存不能为空")] - public string IsCache { get; set; } + public int IsCache { get; set; } /// /// 是否外链 1、是 0、否 /// - public string IsFrame { get; set; } + public int IsFrame { get; set; } /// /// 类型(M目录 C菜单 F按钮 L链接) diff --git a/ZR.Model/System/Dto/SysRoleDto.cs b/ZR.Model/System/Dto/SysRoleDto.cs index 1ff297f..8ad6866 100644 --- a/ZR.Model/System/Dto/SysRoleDto.cs +++ b/ZR.Model/System/Dto/SysRoleDto.cs @@ -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; } /// /// 减少菜单集合 /// public List DelMenuIds { get; set; } = new List(); + public bool MenuCheckStrictly { get; set; } + public bool DeptCheckStrictly { get; set; } + } } diff --git a/ZR.Model/System/Dto/SysUserDto.cs b/ZR.Model/System/Dto/SysUserDto.cs index 771d501..d8ba37a 100644 --- a/ZR.Model/System/Dto/SysUserDto.cs +++ b/ZR.Model/System/Dto/SysUserDto.cs @@ -1,4 +1,6 @@ -namespace ZR.Model.System.Dto +using System; + +namespace ZR.Model.System.Dto { public class SysUserDto { @@ -13,4 +15,22 @@ /// 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; } + /// + /// 用户性别(0男 1女 2未知) + /// + 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; } + } } diff --git a/ZR.Model/System/Generate/GenTable.cs b/ZR.Model/System/Generate/GenTable.cs index d62734a..ec49963 100644 --- a/ZR.Model/System/Generate/GenTable.cs +++ b/ZR.Model/System/Generate/GenTable.cs @@ -1,38 +1,44 @@ -using System.Collections.Generic; +using SqlSugar; +using System.Collections.Generic; namespace ZR.Model.System.Generate { /// /// 代码生成表 /// - [SqlSugar.SugarTable("gen_table")] - [SqlSugar.Tenant("0")] + [SugarTable("gen_table", "代码生成表")] + [Tenant("0")] public class GenTable : SysBase { /// /// 表id /// - [SqlSugar.SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public int TableId { get; set; } + [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] + public long TableId { get; set; } /// /// 数据库名 /// + [SugarColumn(Length = 50)] public string DbName { get; set; } /// /// 表名 /// + [SugarColumn(Length = 150)] public string TableName { get; set; } /// /// 表描述 /// + [SugarColumn(Length = 150)] public string TableComment { get; set; } /// /// 关联父表的表名 /// + [SugarColumn(Length = 150)] public string SubTableName { get; set; } /// /// 本表关联父表的外键名 /// + [SugarColumn(Length = 150)] public string SubTableFkName { get; set; } /// /// csharp类名 @@ -41,18 +47,22 @@ namespace ZR.Model.System.Generate /// /// 使用的模板(crud单表操作 tree树表操作 sub主子表操作) /// + [SugarColumn(Length = 50, DefaultValue = "crud")] public string TplCategory { get; set; } /// /// 基本命名空间前缀 /// + [SugarColumn(Length = 100)] public string BaseNameSpace { get; set; } /// /// 生成模块名 /// + [SugarColumn(Length = 50)] public string ModuleName { get; set; } /// /// 生成业务名 /// + [SugarColumn(Length = 50)] public string BusinessName { get; set; } /// /// 生成功能名 @@ -65,23 +75,30 @@ namespace ZR.Model.System.Generate /// /// 生成代码方式(0zip压缩包 1自定义路径) /// + [SugarColumn(Length = 1, DefaultValue = "0")] public string GenType { get; set; } + /// + /// 代码生成保存路径 + /// + [SugarColumn(Length = 200, DefaultValue = "/")] public string GenPath { get; set; } /// /// 其他生成选项 /// - [SqlSugar.SugarColumn(IsJson = true, ColumnDataType = "nvarchar(4000)")] + [SugarColumn(IsJson = true)] public Options Options { get; set; } #region 表额外字段 - /** 表列信息 */ - [SqlSugar.SugarColumn(IsIgnore = true)] + /// + /// 表列信息 + /// + [SugarColumn(IsIgnore = true)] public List Columns { get; set; } /// /// 字表信息 /// - [SqlSugar.SugarColumn(IsIgnore = true)] + [SugarColumn(IsIgnore = true)] public GenTable SubTable { get; set; } #endregion } diff --git a/ZR.Model/System/Generate/GenTableColumn.cs b/ZR.Model/System/Generate/GenTableColumn.cs index 12f5ff6..917fc78 100644 --- a/ZR.Model/System/Generate/GenTableColumn.cs +++ b/ZR.Model/System/Generate/GenTableColumn.cs @@ -7,18 +7,21 @@ namespace ZR.Model.System.Generate /// /// 代码生成表字段 /// - [SugarTable("gen_table_column")] + [SugarTable("gen_table_column", "代码生成表字段")] [Tenant("0")] public class GenTableColumn : SysBase { + /// + /// 列id + /// [SugarColumn(IsIdentity = true, IsPrimaryKey = true)] - public int ColumnId { get; set; } + public long ColumnId { get; set; } /// /// 导入代码生成表列名 首字母转了小写 /// 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 /// /// 查询类型(等于、不等于、大于、小于、范围) /// + [SugarColumn(DefaultValue = "EQ")] public string QueryType { get; set; } = "EQ"; public int Sort { get; set; } /// diff --git a/ZR.Model/System/SysBase.cs b/ZR.Model/System/SysBase.cs index 5e1f58c..5618c83 100644 --- a/ZR.Model/System/SysBase.cs +++ b/ZR.Model/System/SysBase.cs @@ -8,6 +8,9 @@ namespace ZR.Model.System //[EpplusTable(PrintHeaders = true, AutofitColumns = true, AutoCalculate = true, ShowTotal = true)] public class SysBase { + /// + /// 创建人 + /// [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; } } } diff --git a/ZR.Model/System/SysConfig.cs b/ZR.Model/System/SysConfig.cs index c253b36..764cf52 100644 --- a/ZR.Model/System/SysConfig.cs +++ b/ZR.Model/System/SysConfig.cs @@ -8,7 +8,7 @@ namespace ZR.Model.System /// @author mr.zhao /// @date 2021-09-29 /// - [SugarTable("sys_config")] + [SugarTable("sys_config", "配置表")] [Tenant("0")] public class SysConfig : SysBase { @@ -20,18 +20,22 @@ namespace ZR.Model.System /// /// 参数名称 /// + [SugarColumn(Length = 100)] public string ConfigName { get; set; } /// /// 参数键名 /// + [SugarColumn(Length = 100)] public string ConfigKey { get; set; } /// /// 参数键值 /// + [SugarColumn(Length = 500)] public string ConfigValue { get; set; } /// /// 系统内置(Y是 N否) /// + [SugarColumn(Length = 1)] public string ConfigType { get; set; } } diff --git a/ZR.Model/System/SysDept.cs b/ZR.Model/System/SysDept.cs index b38e3af..4e37a0b 100644 --- a/ZR.Model/System/SysDept.cs +++ b/ZR.Model/System/SysDept.cs @@ -6,9 +6,9 @@ namespace ZR.Model.System /// /// 部门表 /// - [SugarTable("sys_dept")] + [SugarTable("sys_dept", "部门配置表")] [Tenant("0")] - public class SysDept: SysBase + public class SysDept : SysBase { /// /// 部门ID @@ -29,6 +29,7 @@ namespace ZR.Model.System /// /// 部门名称 /// + [SugarColumn(Length = 30, ExtendedAttribute = ProteryConstant.NOTNULL)] public string DeptName { get; set; } /// @@ -39,32 +40,36 @@ namespace ZR.Model.System /// /// 负责人 /// + [SugarColumn(Length = 30)] public string Leader { get; set; } /// /// 联系电话 /// + [SugarColumn(Length = 11)] public string Phone { get; set; } /// /// 邮箱 /// + [SugarColumn(Length = 50)] public string Email { get; set; } /// /// 部门状态:0正常,1停用 /// + [SugarColumn(Length = 1, DefaultValue = "0")] public string Status { get; set; } /// /// 删除标志(0代表存在 2代表删除) /// - [SugarColumn(IsOnlyIgnoreInsert = true)] + [SugarColumn(Length = 1, DefaultValue = "0")] public string DelFlag { get; set; } /// /// 子菜单 /// - public List children = new List(); + public List children = new(); } } diff --git a/ZR.Model/System/SysDictData.cs b/ZR.Model/System/SysDictData.cs index d11ad44..9dbccae 100644 --- a/ZR.Model/System/SysDictData.cs +++ b/ZR.Model/System/SysDictData.cs @@ -6,7 +6,7 @@ namespace ZR.Model.System /// 字典数据表 /// [Tenant("0")] - [SugarTable("sys_dict_data")] + [SugarTable("sys_dict_data", "字典数据表")] public class SysDictData : SysBase { /// @@ -21,30 +21,37 @@ namespace ZR.Model.System /// /// 字典标签 /// + [SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string DictLabel { get; set; } /// /// 字典键值 /// + [SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string DictValue { get; set; } /// /// 字典类型 /// + [SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string DictType { get; set; } /// /// 样式属性(其他样式扩展) /// + [SugarColumn(Length = 100)] public string CssClass { get; set; } = string.Empty; /// /// 表格回显样式 /// + [SugarColumn(Length = 100)] public string ListClass { get; set; } = string.Empty; /// /// 是否默认(Y是 N否) /// + [SugarColumn(Length = 1, DefaultValue = "N")] public string IsDefault { get; set; } /// /// 状态(0正常 1停用) /// + [SugarColumn(Length = 1)] public string Status { get; set; } } } diff --git a/ZR.Model/System/SysDictType.cs b/ZR.Model/System/SysDictType.cs index 17b07c1..c323a63 100644 --- a/ZR.Model/System/SysDictType.cs +++ b/ZR.Model/System/SysDictType.cs @@ -5,7 +5,8 @@ namespace ZR.Model.System /// /// 字典类型表 /// - [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 /// /// 字典名称 /// + [SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string DictName { get; set; } /// /// 字典类型 /// + [SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string DictType { get; set; } /// /// 状态 0、正常 1、停用 /// + [SugarColumn(Length = 1, DefaultValue = "0")] public string Status { get; set; } /// /// 系统内置 Y是 N否 /// + [SugarColumn(Length = 1, DefaultValue = "N")] public string Type { get; set; } /// /// 自定义sql diff --git a/ZR.Model/System/SysFile.cs b/ZR.Model/System/SysFile.cs index 5c18651..cc8eb1d 100644 --- a/ZR.Model/System/SysFile.cs +++ b/ZR.Model/System/SysFile.cs @@ -5,7 +5,7 @@ using System; namespace ZR.Model.System { [Tenant("0")] - [SugarTable("sys_file")] + [SugarTable("sys_file", "文件存储表")] public class SysFile { /// diff --git a/ZR.Model/System/SysLogininfor.cs b/ZR.Model/System/SysLogininfor.cs index 4cdc074..79b979c 100644 --- a/ZR.Model/System/SysLogininfor.cs +++ b/ZR.Model/System/SysLogininfor.cs @@ -6,7 +6,7 @@ namespace ZR.Model.System /// /// sys_logininfor 表 /// - [SugarTable("sys_logininfor")] + [SugarTable("sys_logininfor", "登录日志表")] [Tenant("0")] public class SysLogininfor { @@ -21,32 +21,33 @@ namespace ZR.Model.System /// /// 登录状态 0成功 1失败 /// + [SugarColumn(Length = 1, DefaultValue = "0")] public string Status { get; set; } /// /// 登录IP地址 /// - public string Ipaddr { get; set; } + public string Ipaddr { get; set; } = string.Empty; /// /// 登录地点 /// - public string LoginLocation { get; set; } + public string LoginLocation { get; set; } = string.Empty; /// /// 浏览器类型 /// - public string Browser { get; set; } + public string Browser { get; set; } = string.Empty; /// /// 操作系统 /// - public string Os { get; set; } + public string Os { get; set; } = string.Empty; /// /// 提示消息 /// - public string Msg { get; set; } + public string Msg { get; set; } = string.Empty; /// /// 访问时间 diff --git a/ZR.Model/System/SysMenu.cs b/ZR.Model/System/SysMenu.cs index 8edfc50..028f11e 100644 --- a/ZR.Model/System/SysMenu.cs +++ b/ZR.Model/System/SysMenu.cs @@ -6,7 +6,7 @@ namespace ZR.Model.System /// /// Sys_menu表 /// - [SugarTable("sys_menu")] + [SugarTable("sys_menu", "系统菜单表")] [Tenant("0")] public class SysMenu : SysBase { @@ -18,22 +18,25 @@ namespace ZR.Model.System /// /// 菜单名称 /// + [SugarColumn(Length = 50, ExtendedAttribute = ProteryConstant.NOTNULL)] public string MenuName { get; set; } /// /// 父菜单ID /// + [SugarColumn(DefaultValue = "0")] public long ParentId { get; set; } /// /// 显示顺序 /// + [SugarColumn(DefaultValue = "0")] public int OrderNum { get; set; } /// /// 路由地址 /// - public string Path { get; set; } = "#"; + public string Path { get; set; } = ""; /// /// 组件路径 @@ -43,35 +46,42 @@ namespace ZR.Model.System /// /// 是否缓存(1缓存 0不缓存) /// + [SugarColumn(DefaultValue = "0", ColumnDataType = "int")] public string IsCache { get; set; } /// /// 是否外链 1、是 0、否 /// - public string IsFrame { get; set; } + [SugarColumn(DefaultValue = "0", ColumnDataType = "int")] + public string IsFrame { get; set; } = "0"; /// /// 类型(M目录 C菜单 F按钮 L链接) /// - public string MenuType { get; set; } + [SugarColumn(Length = 1)] + public string MenuType { get; set; } = string.Empty; /// /// 显示状态(0显示 1隐藏) /// + [SugarColumn(DefaultValue = "0", Length = 1)] public string Visible { get; set; } /// /// 菜单状态(0正常 1停用) /// + [SugarColumn(DefaultValue = "0", Length = 1)] public string Status { get; set; } /// /// 权限字符串 /// + [SugarColumn(Length = 100)] public string Perms { get; set; } /// /// 菜单图标 /// + [SugarColumn(DefaultValue = "#")] public string Icon { get; set; } = string.Empty; /// /// 菜单名key diff --git a/ZR.Model/System/SysNotice.cs b/ZR.Model/System/SysNotice.cs index 758fc03..de82a33 100644 --- a/ZR.Model/System/SysNotice.cs +++ b/ZR.Model/System/SysNotice.cs @@ -3,12 +3,12 @@ using SqlSugar; namespace ZR.Model.System { /// - /// 通知公告表,数据实体对象 + /// 通知公告表 /// /// @author zr /// @date 2021-12-15 /// - [SugarTable("sys_notice")] + [SugarTable("sys_notice", "通知公告表")] [Tenant(0)] public class SysNotice : SysBase { @@ -20,21 +20,22 @@ namespace ZR.Model.System /// /// 公告标题 /// - [SugarColumn(ColumnName = "notice_title")] + [SugarColumn(ColumnName = "notice_title", ExtendedAttribute = ProteryConstant.NOTNULL)] public string NoticeTitle { get; set; } /// /// 公告类型 (1通知 2公告) /// - [SugarColumn(ColumnName = "notice_type")] + [SugarColumn(ColumnName = "notice_type", ExtendedAttribute = ProteryConstant.NOTNULL)] public int NoticeType { get; set; } /// /// 公告内容 /// - [SugarColumn(ColumnName = "notice_content")] + [SugarColumn(ColumnName = "notice_content", ColumnDataType = "text")] public string NoticeContent { get; set; } /// /// 公告状态 (0正常 1关闭) /// + [SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)] public int Status { get; set; } } } \ No newline at end of file diff --git a/ZR.Model/System/SysOperLog.cs b/ZR.Model/System/SysOperLog.cs index 9929ffb..3e33e21 100644 --- a/ZR.Model/System/SysOperLog.cs +++ b/ZR.Model/System/SysOperLog.cs @@ -5,22 +5,24 @@ using System.ComponentModel; namespace ZR.Model.System { - [SugarTable("sys_oper_log")] + [SugarTable("sys_oper_log", "操作日志表")] [Tenant("0")] public class SysOperLog { + /// + /// 操作id + /// [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public long OperId { get; set; } /// /// 操作模块 /// - [DisplayName("操作模块")] public string Title { get; set; } /// /// 业务类型(0其它 1新增 2修改 3删除 4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据) /// - [DisplayName("业务类型")] + [SugarColumn(DefaultValue = "0")] public int BusinessType { get; set; } /// @@ -33,79 +35,71 @@ namespace ZR.Model.System /// /// 请求方法 /// - [DisplayName("请求方法")] public string Method { get; set; } /// /// 请求方式 /// - [DisplayName("请求方式")] public string RequestMethod { get; set; } /// /// 操作类别(0其它 1后台用户 2手机端用户) /// //@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") - [DisplayName("操作类别")] + [SugarColumn(DefaultValue = "0")] public int OperatorType { get; set; } /// /// 操作人员 /// - [DisplayName("操作人员")] public string OperName { get; set; } /// /// 请求url /// - [DisplayName("请求地址")] public string OperUrl { get; set; } /// /// 操作地址 /// - [DisplayName("操作地址")] public string OperIp { get; set; } /// /// 操作地点 /// - [DisplayName("操作地点")] public string OperLocation { get; set; } /// /// 请求参数 /// - [DisplayName("请求参数")] + [SugarColumn(Length = 2000)] public string OperParam { get; set; } /// /// 返回参数 /// - [DisplayName("返回结果")] + [SugarColumn(ColumnDataType = "text")] public string JsonResult { get; set; } /// /// 操作状态(0正常 1异常) /// - [DisplayName("状态")] + [SugarColumn(DefaultValue = "0")] public int Status { get; set; } /// /// 错误消息 /// - [DisplayName("错误消息")] public string ErrorMsg { get; set; } /// /// 操作时间 /// - [DisplayName("操作时间")] public DateTime? OperTime { get; set; } /// /// 操作用时 /// - [DisplayName("操作用时")] public long Elapsed { get; set; } + public string DeptName { get; set; } } } diff --git a/ZR.Model/System/SysPost.cs b/ZR.Model/System/SysPost.cs index 8441f26..26edfcf 100644 --- a/ZR.Model/System/SysPost.cs +++ b/ZR.Model/System/SysPost.cs @@ -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 /// [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; } } } diff --git a/ZR.Model/System/SysRole.cs b/ZR.Model/System/SysRole.cs index dea2527..3f48946 100644 --- a/ZR.Model/System/SysRole.cs +++ b/ZR.Model/System/SysRole.cs @@ -5,7 +5,7 @@ namespace ZR.Model.System /// /// 角色表 sys_role /// - [SugarTable("sys_role")] + [SugarTable("sys_role", "角色表")] [Tenant("0")] public class SysRole : SysBase { @@ -18,41 +18,47 @@ namespace ZR.Model.System /// /// 角色名称 /// + [SugarColumn(Length = 30, ExtendedAttribute = ProteryConstant.NOTNULL)] public string RoleName { get; set; } /// /// 角色权限 /// + [SugarColumn(Length = 100, ExtendedAttribute = ProteryConstant.NOTNULL)] public string RoleKey { get; set; } /// /// 角色排序 /// + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public int RoleSort { get; set; } /// /// 帐号状态(0正常 1停用) /// + [SugarColumn(DefaultValue = "0")] public int Status { get; set; } /// /// 删除标志(0代表存在 2代表删除) /// + [SugarColumn(DefaultValue = "0")] public int DelFlag { get; set; } /// /// 数据范围(1:全部数据权限 2:自定数据权限 3:本部门数据权限 4:本部门及以下数据权限)) /// + [SugarColumn(DefaultValue = "1")] public int DataScope { get; set; } /// /// 菜单树选择项是否关联显示 /// [SugarColumn(ColumnName = "menu_check_strictly")] - public bool MenuCheckStrictly { get; set; } + public bool MenuCheckStrictly { get; set; } = true; /// /// 部门树选择项是否关联显示 /// [SugarColumn(ColumnName = "dept_check_strictly")] - public bool DeptCheckStrictly { get; set; } + public bool DeptCheckStrictly { get; set; } = true; /// /// 菜单组 /// diff --git a/ZR.Model/System/SysRoleDept.cs b/ZR.Model/System/SysRoleDept.cs index bbe4a96..168d048 100644 --- a/ZR.Model/System/SysRoleDept.cs +++ b/ZR.Model/System/SysRoleDept.cs @@ -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; } } } diff --git a/ZR.Model/System/SysRoleMenu.cs b/ZR.Model/System/SysRoleMenu.cs index ba32d30..94a6fa6 100644 --- a/ZR.Model/System/SysRoleMenu.cs +++ b/ZR.Model/System/SysRoleMenu.cs @@ -7,17 +7,15 @@ namespace ZR.Model.System /// /// 角色菜单 /// - [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; } } } diff --git a/ZR.Model/System/SysRolePost.cs b/ZR.Model/System/SysRolePost.cs deleted file mode 100644 index d0cee95..0000000 --- a/ZR.Model/System/SysRolePost.cs +++ /dev/null @@ -1,15 +0,0 @@ -using SqlSugar; - -namespace ZR.Model.System -{ - /// - /// 角色部门 - /// - [SugarTable("sys_role_post")] - [Tenant("0")] - public class SysRolePost - { - public long RoleId { get; set; } - public long DeptId { get; set; } - } -} diff --git a/ZR.Model/System/SysTasks.cs b/ZR.Model/System/SysTasks.cs index 56519f7..b1a413c 100644 --- a/ZR.Model/System/SysTasks.cs +++ b/ZR.Model/System/SysTasks.cs @@ -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 /// ///计划任务 /// - [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 /// 任务名称 /// [Display(Name = "任务名称")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string Name { get; set; } /// /// 任务分组 /// [Display(Name = "任务分组")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string JobGroup { get; set; } /// /// 运行时间表达式 /// [Display(Name = "运行时间表达式")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string Cron { get; set; } /// /// 程序集名称 /// [Display(Name = "程序集名称")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string AssemblyName { get; set; } /// /// 任务所在类 /// [Display(Name = "任务所在类")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string ClassName { get; set; } - /// - /// 任务描述 - /// - [Display(Name = "任务描述")] - public string Remark { get; set; } - /// /// 执行次数 /// [Display(Name = "执行次数")] + [SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)] public int RunTimes { get; set; } /// @@ -83,6 +82,7 @@ namespace ZR.Model.System /// 默认 : 1 /// [Display(Name = "触发器类型(0、simple 1、cron)")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public int TriggerType { get; set; } /// @@ -90,42 +90,22 @@ namespace ZR.Model.System /// 默认 : 0 /// [Display(Name = "执行间隔时间(单位:秒)")] + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public int IntervalSecond { get; set; } /// /// 是否启动 - /// 默认 : 0 /// [Display(Name = "是否启动")] + [SugarColumn(DefaultValue = "0", ExtendedAttribute = ProteryConstant.NOTNULL)] public int IsStart { get; set; } /// /// 传入参数 - /// 默认 : /// [Display(Name = "传入参数")] public string JobParams { get; set; } - [SugarColumn(IsOnlyIgnoreUpdate = true)]//设置后修改不会有此字段 - [JsonProperty(propertyName: "CreateBy")] - public string Create_by { get; set; } - - /// - /// 创建时间 - /// - //[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; /// /// 最后运行时间 /// @@ -137,6 +117,7 @@ namespace ZR.Model.System /// /// 任务类型 1、程序集 2、网络请求 3、SQL语句 /// + [SugarColumn(DefaultValue = "1")] public int TaskType { get; set; } /// @@ -146,6 +127,7 @@ namespace ZR.Model.System /// /// 网络请求方式 /// + [SugarColumn(Length = 20)] public string RequestMethod { get; set; } } } diff --git a/ZR.Model/System/SysTasksLog.cs b/ZR.Model/System/SysTasksLog.cs index 666f1ea..88fbcfc 100644 --- a/ZR.Model/System/SysTasksLog.cs +++ b/ZR.Model/System/SysTasksLog.cs @@ -6,7 +6,7 @@ namespace ZR.Model.System /// /// 任务日志 /// - [SugarTable("sys_tasks_log")] + [SugarTable("sys_tasks_log", "任务日志表")] [Tenant("0")] public class SysTasksLog { @@ -18,12 +18,22 @@ namespace ZR.Model.System /// /// 任务Id /// + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string JobId { get; set; } + /// + /// 任务名 + /// + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string JobName { get; set; } + /// + /// 任务分组 + /// + [SugarColumn(ExtendedAttribute = ProteryConstant.NOTNULL)] public string JobGroup { get; set; } /// /// 执行状态(0正常 1失败) /// + [SugarColumn(DefaultValue = "0")] public string Status { get; set; } /// /// 异常 diff --git a/ZR.Model/System/SysUser.cs b/ZR.Model/System/SysUser.cs index e9d31ae..ff55b72 100644 --- a/ZR.Model/System/SysUser.cs +++ b/ZR.Model/System/SysUser.cs @@ -9,7 +9,7 @@ namespace ZR.Model.System /// /// 用户表 /// - [SugarTable("sys_user")] + [SugarTable("sys_user", "用户表")] [Tenant("0")] public class SysUser : SysBase { @@ -21,12 +21,12 @@ namespace ZR.Model.System /// /// 登录用户名 /// - [SugarColumn(Length = 30, ColumnDescription = "用户账号", IsNullable = false)] + [SugarColumn(Length = 30, ColumnDescription = "用户账号", ExtendedAttribute = ProteryConstant.NOTNULL)] public string UserName { get; set; } /// /// 用户昵称 /// - [SugarColumn(Length = 30, ColumnDescription = "用户昵称", IsNullable = false)] + [SugarColumn(Length = 30, ColumnDescription = "用户昵称", ExtendedAttribute = ProteryConstant.NOTNULL)] public string NickName { get; set; } /// /// 用户类型(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; } /// /// 手机号 diff --git a/ZR.Model/System/SysUserPost.cs b/ZR.Model/System/SysUserPost.cs index e58c2f1..7eadfd0 100644 --- a/ZR.Model/System/SysUserPost.cs +++ b/ZR.Model/System/SysUserPost.cs @@ -5,11 +5,13 @@ namespace ZR.Model.System /// /// 用户岗位 /// - [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; } } } diff --git a/ZR.Model/System/SysUserRole.cs b/ZR.Model/System/SysUserRole.cs index fab8cfd..c1570dc 100644 --- a/ZR.Model/System/SysUserRole.cs +++ b/ZR.Model/System/SysUserRole.cs @@ -5,7 +5,7 @@ namespace ZR.Model.System /// /// 用户角色关联表 用户N-1 角色 /// - [SugarTable("sys_user_role")] + [SugarTable("sys_user_role", "用户和角色关联表")] [Tenant("0")] public class SysUserRole { diff --git a/ZR.Model/ZR.Model.csproj b/ZR.Model/ZR.Model.csproj index 627c363..dde0b12 100644 --- a/ZR.Model/ZR.Model.csproj +++ b/ZR.Model/ZR.Model.csproj @@ -10,8 +10,7 @@ - + - diff --git a/ZR.Repository/ZR.Repository.csproj b/ZR.Repository/ZR.Repository.csproj index 7ff20e2..5ccc57d 100644 --- a/ZR.Repository/ZR.Repository.csproj +++ b/ZR.Repository/ZR.Repository.csproj @@ -15,6 +15,6 @@ - + diff --git a/ZR.Service/System/IService/ISysUserService.cs b/ZR.Service/System/IService/ISysUserService.cs index 493ac59..eb463fb 100644 --- a/ZR.Service/System/IService/ISysUserService.cs +++ b/ZR.Service/System/IService/ISysUserService.cs @@ -7,7 +7,7 @@ namespace ZR.Service.System.IService { public interface ISysUserService : IBaseService { - public PagedInfo SelectUserList(SysUser user, PagerInfo pager); + public PagedInfo SelectUserList(SysUserQueryDto user, PagerInfo pager); /// /// 通过用户ID查询用户 diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs index 62aecb3..88e76f4 100644 --- a/ZR.Service/System/SysMenuService.cs +++ b/ZR.Service/System/SysMenuService.cs @@ -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", diff --git a/ZR.Service/System/SysUserService.cs b/ZR.Service/System/SysUserService.cs index 47b900a..ee874d4 100644 --- a/ZR.Service/System/SysUserService.cs +++ b/ZR.Service/System/SysUserService.cs @@ -39,7 +39,7 @@ namespace ZR.Service /// 根据条件分页查询用户列表 /// /// - public PagedInfo SelectUserList(SysUser user, PagerInfo pager) + public PagedInfo SelectUserList(SysUserQueryDto user, PagerInfo pager) { var exp = Expressionable.Create(); exp.AndIF(!string.IsNullOrEmpty(user.UserName), u => u.UserName.Contains(user.UserName)); @@ -323,7 +323,7 @@ namespace ZR.Service /// 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()); } /// diff --git a/document/mysql/admin-mysql.sql b/document/mysql/admin-mysql.sql index 2743423..e8b4d55 100644 --- a/document/mysql/admin-mysql.sql +++ b/document/mysql/admin-mysql.sql @@ -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 '更新者', diff --git a/document/pgsql/admin-pg15.sql b/document/pgsql/admin-pg15.sql index 31ad71b..abb95cf 100644 --- a/document/pgsql/admin-pg15.sql +++ b/document/pgsql/admin-pg15.sql @@ -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", diff --git a/document/sqlserver/admin-sqlserver.sql b/document/sqlserver/admin-sqlserver.sql index e49d7f6..a2bd8e5 100644 --- a/document/sqlserver/admin-sqlserver.sql +++ b/document/sqlserver/admin-sqlserver.sql @@ -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)