diff --git a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs index ee5bb7a..0dbbf77 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysLoginController.cs @@ -192,11 +192,11 @@ namespace ZR.Admin.WebApi.Controllers.System ClientInfo clientInfo = context.GetClientInfo(); SysLogininfor sysLogininfor = new() { - browser = clientInfo.Device.Family, - os = clientInfo.OS.ToString(), - ipaddr = ipAddr, - userName = context.GetName(), - loginLocation = ip_info.Province + "-" + ip_info.City + Browser = clientInfo.Device.Family, + Os = clientInfo.OS.ToString(), + Ipaddr = ipAddr, + UserName = context.GetName(), + LoginLocation = ip_info?.Province + "-" + ip_info?.City }; return sysLogininfor; diff --git a/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs b/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs index 7281ead..13fa174 100644 --- a/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs +++ b/ZR.Admin.WebApi/Controllers/System/SysMenuController.cs @@ -106,11 +106,11 @@ namespace ZR.Admin.WebApi.Controllers.System .NameMatchingStrategy(NameMatchingStrategy.IgnoreCase);//忽略字段名称的大小写;//忽略除以上配置的所有字段 var modal = menuDto.Adapt(config).ToUpdate(HttpContext); - if (UserConstants.YES_FRAME.Equals(modal.isFrame) && !modal.path.StartsWith("http")) + if (UserConstants.YES_FRAME.Equals(modal.IsFrame) && !modal.Path.StartsWith("http")) { return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,地址必须以http(s)://开头")); } - if (modal.MenuId.Equals(modal.parentId)) + if (modal.MenuId.Equals(modal.ParentId)) { return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,上级菜单不能选择自己")); } @@ -141,7 +141,7 @@ namespace ZR.Admin.WebApi.Controllers.System { return ToResponse(ApiResult.Error($"新增菜单'{menu.MenuName}'失败,菜单名称已存在")); } - if (UserConstants.YES_FRAME.Equals(menu.isFrame) && !menu.path.StartsWith("http")) + if (UserConstants.YES_FRAME.Equals(menu.IsFrame) && !menu.Path.StartsWith("http")) { return ToResponse(ApiResult.Error($"新增菜单'{menu.MenuName}'失败,地址必须以http(s)://开头")); } @@ -189,7 +189,7 @@ namespace ZR.Admin.WebApi.Controllers.System MenuDto MenuDto = new() { MenuId = id, - orderNum = value + OrderNum = value }; if (MenuDto == null) { return ToResponse(ApiResult.Error(101, "请求参数错误")); } diff --git a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs index f66d19e..189a1f5 100644 --- a/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs +++ b/ZR.Admin.WebApi/Controllers/System/monitor/SysLogininforController.cs @@ -87,7 +87,7 @@ namespace ZR.Admin.WebApi.Controllers.monitor logininfoDto.BeginTime = DateTimeHelper.GetBeginTime(logininfoDto.BeginTime, -1); logininfoDto.EndTime = DateTimeHelper.GetBeginTime(logininfoDto.EndTime, 1); var exp = Expressionable.Create() - .And(it => it.loginTime >= logininfoDto.BeginTime && it.loginTime <= logininfoDto.EndTime); + .And(it => it.LoginTime >= logininfoDto.BeginTime && it.LoginTime <= logininfoDto.EndTime); var list = sysLoginService.Queryable().Where(exp.ToExpression()) .ToList(); diff --git a/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs b/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs index 9be5361..17474dc 100644 --- a/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs +++ b/ZR.Admin.WebApi/Extensions/HttpContextExtension.cs @@ -134,7 +134,7 @@ namespace ZR.Admin.WebApi.Extensions /// public static void GetRequestValue(this HttpContext context, SysOperLog operLog) { - string reqMethod = operLog.requestMethod; + string reqMethod = operLog.RequestMethod; string param; if (HttpMethods.IsPost(reqMethod) || HttpMethods.IsPut(reqMethod)) @@ -148,7 +148,7 @@ namespace ZR.Admin.WebApi.Extensions { param = context.Request.QueryString.Value.ToString(); } - operLog.operParam = param; + operLog.OperParam = param; } } diff --git a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs index 7f699c7..d382a03 100644 --- a/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs +++ b/ZR.Admin.WebApi/Filters/GlobalActionMonitor.cs @@ -95,31 +95,31 @@ namespace ZR.Admin.WebApi.Filters SysOperLog sysOperLog = new() { - status = 0, - operName = userName, - operIp = ip, - operUrl = HttpContextExtension.GetRequestUrl(context.HttpContext), - requestMethod = method, - jsonResult = jsonResult, - operLocation = ip_info.Province + " " + ip_info.City, - method = controller + "." + action + "()", + Status = 0, + OperName = userName, + OperIp = ip, + OperUrl = HttpContextExtension.GetRequestUrl(context.HttpContext), + RequestMethod = method, + JsonResult = jsonResult, + OperLocation = ip_info.Province + " " + ip_info.City, + Method = controller + "." + action + "()", //Elapsed = _stopwatch.ElapsedMilliseconds, - operTime = DateTime.Now + OperTime = DateTime.Now }; HttpContextExtension.GetRequestValue(context.HttpContext, sysOperLog); if (logAttribute != null) { - sysOperLog.title = logAttribute?.Title; - sysOperLog.businessType = (int)logAttribute?.BusinessType; - sysOperLog.operParam = logAttribute.IsSaveRequestData ? sysOperLog.operParam : ""; - sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : ""; + sysOperLog.Title = logAttribute?.Title; + sysOperLog.BusinessType = (int)logAttribute?.BusinessType; + sysOperLog.OperParam = logAttribute.IsSaveRequestData ? sysOperLog.OperParam : ""; + sysOperLog.JsonResult = logAttribute.IsSaveResponseData ? sysOperLog.JsonResult : ""; } LogEventInfo ei = new(NLog.LogLevel.Info, "GlobalActionMonitor", ""); ei.Properties["jsonResult"] = !HttpMethods.IsGet(method) ? jsonResult : ""; - ei.Properties["requestParam"] = sysOperLog.operParam; + ei.Properties["requestParam"] = sysOperLog.OperParam; ei.Properties["user"] = userName; logger.Log(ei); diff --git a/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs index 7298fcf..7cd7915 100644 --- a/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs +++ b/ZR.Admin.WebApi/Middleware/GlobalExceptionMiddleware.cs @@ -84,15 +84,15 @@ namespace ZR.Admin.WebApi.Middleware SysOperLog sysOperLog = new() { - status = 1, - operIp = ip, - operUrl = HttpContextExtension.GetRequestUrl(context), - requestMethod = context.Request.Method, - jsonResult = responseResult, - errorMsg = string.IsNullOrEmpty(error) ? msg : error, - operName = HttpContextExtension.GetName(context) , - operLocation = ip_info.Province + " " + ip_info.City, - operTime = DateTime.Now + Status = 1, + OperIp = ip, + OperUrl = HttpContextExtension.GetRequestUrl(context), + RequestMethod = context.Request.Method, + JsonResult = responseResult, + ErrorMsg = string.IsNullOrEmpty(error) ? msg : error, + OperName = context.User.Identity.Name, + OperLocation = ip_info.Province + " " + ip_info.City, + OperTime = DateTime.Now }; HttpContextExtension.GetRequestValue(context, sysOperLog); var endpoint = GetEndpoint(context); @@ -101,10 +101,10 @@ namespace ZR.Admin.WebApi.Middleware var logAttribute = endpoint.Metadata.GetMetadata(); if (logAttribute != null) { - sysOperLog.businessType = (int)logAttribute?.BusinessType; - sysOperLog.title = logAttribute?.Title; - sysOperLog.operParam = logAttribute.IsSaveRequestData ? sysOperLog.operParam : ""; - sysOperLog.jsonResult = logAttribute.IsSaveResponseData ? sysOperLog.jsonResult : ""; + sysOperLog.BusinessType = (int)logAttribute?.BusinessType; + sysOperLog.Title = logAttribute?.Title; + sysOperLog.OperParam = logAttribute.IsSaveRequestData ? sysOperLog.OperParam : ""; + sysOperLog.JsonResult = logAttribute.IsSaveResponseData ? sysOperLog.JsonResult : ""; } } LogEventInfo ei = new(logLevel, "GlobalExceptionMiddleware", error) @@ -114,13 +114,13 @@ namespace ZR.Admin.WebApi.Middleware }; ei.Properties["status"] = 1;//走正常返回都是通过走GlobalExceptionFilter不通过 ei.Properties["jsonResult"] = responseResult; - ei.Properties["requestParam"] = sysOperLog.operParam; + ei.Properties["requestParam"] = sysOperLog.OperParam; ei.Properties["user"] = HttpContextExtension.GetName(context); Logger.Log(ei); context.Response.ContentType = "text/json;charset=utf-8"; await context.Response.WriteAsync(responseResult, System.Text.Encoding.UTF8); - WxNoticeHelper.SendMsg("系统出错", sysOperLog.errorMsg); + WxNoticeHelper.SendMsg("系统出错", sysOperLog.ErrorMsg); SysOperLogService.InsertOperlog(sysOperLog); } diff --git a/ZR.Model/System/Dto/MenuDto.cs b/ZR.Model/System/Dto/MenuDto.cs index 2152c99..23c3a26 100644 --- a/ZR.Model/System/Dto/MenuDto.cs +++ b/ZR.Model/System/Dto/MenuDto.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.ComponentModel.DataAnnotations; -using System.Text; namespace ZR.Model.System.Dto { @@ -14,60 +12,60 @@ namespace ZR.Model.System.Dto /// /// 父菜单ID /// - public long? parentId { get; set; } + public long? ParentId { get; set; } /// /// 显示顺序 /// - public int orderNum { get; set; } + public int OrderNum { get; set; } /// /// 路由地址 /// - public string path { get; set; } = "#"; + public string Path { get; set; } = "#"; /// /// 组件路径 /// - public string component { get; set; } + public string Component { get; set; } /// /// 是否缓存(1缓存 0不缓存) /// [Required(ErrorMessage = "是否缓存不能为空")] - public string isCache { get; set; } + public string IsCache { get; set; } /// /// 是否外链 1、是 0、否 /// - public string isFrame { get; set; } + public string IsFrame { get; set; } /// /// 类型(M目录 C菜单 F按钮 L链接) /// [Required(ErrorMessage = "菜单类型不能为空")] - public string menuType { get; set; } + public string MenuType { get; set; } /// /// 显示状态(0显示 1隐藏) /// [Required(ErrorMessage = "显示状态不能为空")] - public string visible { get; set; } + public string Visible { get; set; } /// /// 菜单状态(0正常 1停用) /// [Required(ErrorMessage = "菜单状态不能为空")] - public string status { get; set; } + public string Status { get; set; } /// /// 权限字符串 /// - public string perms { get; set; } + public string Perms { get; set; } /// /// 菜单图标 /// - public string icon { get; set; } = string.Empty; + public string Icon { get; set; } = string.Empty; /// /// 翻译key /// diff --git a/ZR.Model/System/SysLogininfor.cs b/ZR.Model/System/SysLogininfor.cs index 1350e02..471feb9 100644 --- a/ZR.Model/System/SysLogininfor.cs +++ b/ZR.Model/System/SysLogininfor.cs @@ -14,47 +14,47 @@ namespace ZR.Model.System { //[Key] [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] - public long infoId { get; set; } + public long InfoId { get; set; } /// /// 用户账号 /// - public string userName { get; set; } + public string UserName { get; set; } /// /// 登录状态 0成功 1失败 /// - public string status { get; set; } + public string Status { get; set; } /// /// 登录IP地址 /// - public string ipaddr { get; set; } + public string Ipaddr { get; set; } /// /// 登录地点 /// - public string loginLocation { get; set; } + public string LoginLocation { get; set; } /// /// 浏览器类型 /// - public string browser { get; set; } + public string Browser { get; set; } /** 操作系统 */ //@Excel(name = "操作系统") - public string os { get; set; } + public string Os { get; set; } /// /// 提示消息 /// - public string msg { get; set; } + public string Msg { get; set; } /// /// 访问时间 /// [EpplusTableColumn(NumberFormat = "yyyy-MM-dd HH:mm:ss")] - public DateTime loginTime { get; set; } = DateTime.Now; + public DateTime LoginTime { get; set; } = DateTime.Now; [SugarColumn(IsIgnore = true)] public DateTime? BeginTime { get; set; } [SugarColumn(IsIgnore = true)] diff --git a/ZR.Model/System/SysMenu.cs b/ZR.Model/System/SysMenu.cs index 61d0c4f..6613e0a 100644 --- a/ZR.Model/System/SysMenu.cs +++ b/ZR.Model/System/SysMenu.cs @@ -24,56 +24,56 @@ namespace ZR.Model.System /// /// 父菜单ID /// - public long parentId { get; set; } + public long ParentId { get; set; } /// /// 显示顺序 /// - public int orderNum { get; set; } + public int OrderNum { get; set; } /// /// 路由地址 /// - public string path { get; set; } = "#"; + public string Path { get; set; } = "#"; /// /// 组件路径 /// - public string component { get; set; } + public string Component { get; set; } /// /// 是否缓存(1缓存 0不缓存) /// - public string isCache { get; set; } + public string IsCache { get; set; } /// /// 是否外链 1、是 0、否 /// - public string isFrame { get; set; } + public string IsFrame { get; set; } /// /// 类型(M目录 C菜单 F按钮 L链接) /// - public string menuType { get; set; } + public string MenuType { get; set; } /// /// 显示状态(0显示 1隐藏) /// - public string visible { get; set; } + public string Visible { get; set; } /// /// 菜单状态(0正常 1停用) /// - public string status { get; set; } + public string Status { get; set; } /// /// 权限字符串 /// - public string perms { get; set; } + public string Perms { get; set; } /// /// 菜单图标 /// - public string icon { get; set; } = string.Empty; + public string Icon { get; set; } = string.Empty; /// /// 菜单名key /// @@ -83,7 +83,7 @@ namespace ZR.Model.System /// 子菜单 /// [SugarColumn(IsIgnore = true)] - public List children { get; set; } = new List(); + public List Children { get; set; } = new List(); /// /// 子菜单个数 /// @@ -97,7 +97,7 @@ namespace ZR.Model.System { get { - return SubNum > 0 || children.Count > 0; + return SubNum > 0 || Children.Count > 0; } } } diff --git a/ZR.Model/System/SysOperLog.cs b/ZR.Model/System/SysOperLog.cs index bdaa098..1a7c0d2 100644 --- a/ZR.Model/System/SysOperLog.cs +++ b/ZR.Model/System/SysOperLog.cs @@ -1,9 +1,6 @@ -using Newtonsoft.Json; +using OfficeOpenXml.Attributes; using SqlSugar; using System; -using System.Collections.Generic; -using System.Text; -using OfficeOpenXml.Attributes; namespace ZR.Model.System { @@ -14,72 +11,75 @@ namespace ZR.Model.System [SugarColumn(IsPrimaryKey = true, IsIdentity = true)] public long OperId { get; set; } /** 操作模块 */ - //@Excel(name = "操作模块") - public string title { get; set; } + [EpplusTableColumn(Header = "操作模块")] + public string Title { get; set; } /** 业务类型(0其它 1新增 2修改 3删除) */ //@Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据") - public int businessType { get; set; } + [EpplusTableColumn(Header = "业务类型")] + public int BusinessType { get; set; } /** 业务类型数组 */ [SugarColumn(IsIgnore = true)] - public int[] businessTypes { get; set; } + [EpplusIgnore] + public int[] BusinessTypes { get; set; } /** 请求方法 */ - //@Excel(name = "请求方法") - public string method { get; set; } + [EpplusTableColumn(Header = "请求方法")] + public string Method { get; set; } /** 请求方式 */ - //@Excel(name = "请求方式") - public string requestMethod { get; set; } + [EpplusTableColumn(Header = "请求方式")] + public string RequestMethod { get; set; } /** 操作类别(0其它 1后台用户 2手机端用户) */ //@Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户") - public int operatorType { get; set; } + [EpplusTableColumn(Header = "操作类别")] + public int OperatorType { get; set; } /** 操作人员 */ - //@Excel(name = "操作人员") - public string operName { get; set; } + [EpplusTableColumn(Header = "操作人员")] + public string OperName { get; set; } /** 部门名称 */ - //@Excel(name = "部门名称") - public string deptName { get; set; } + [EpplusTableColumn(Header = "部门名称")] + public string DeptName { get; set; } /** 请求url */ - //@Excel(name = "请求地址") - public string operUrl { get; set; } + [EpplusTableColumn(Header = "请求地址")] + public string OperUrl { get; set; } /** 操作地址 */ - //@Excel(name = "操作地址") - public string operIp { get; set; } + [EpplusTableColumn(Header = "操作地址")] + public string OperIp { get; set; } /** 操作地点 */ - //@Excel(name = "操作地点") - public string operLocation { get; set; } + [EpplusTableColumn(Header = "操作地点")] + public string OperLocation { get; set; } /** 请求参数 */ - //@Excel(name = "请求参数") - public string operParam { get; set; } + [EpplusTableColumn(Header = "请求参数")] + public string OperParam { get; set; } /** 返回参数 */ - //@Excel(name = "返回参数") - public string jsonResult { get; set; } + [EpplusTableColumn(Header = "返回结果")] + public string JsonResult { get; set; } /** 操作状态(0正常 1异常) */ - //@Excel(name = "状态", readConverterExp = "0=正常,1=异常") - public int status { get; set; } + [EpplusTableColumn(Header = "状态")] + public int Status { get; set; } /// /// 错误消息 /// [EpplusTableColumn(Header = "错误消息")] - public string errorMsg { get; set; } + public string ErrorMsg { get; set; } /// /// 操作时间 /// [EpplusTableColumn(Header = "操作时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")] - public DateTime? operTime { get; set; } + public DateTime? OperTime { get; set; } /// /// 操作用时 /// diff --git a/ZR.Model/System/Vo/TreeSelectVo.cs b/ZR.Model/System/Vo/TreeSelectVo.cs index eba965f..01bbe3b 100644 --- a/ZR.Model/System/Vo/TreeSelectVo.cs +++ b/ZR.Model/System/Vo/TreeSelectVo.cs @@ -29,7 +29,7 @@ namespace ZR.Model.System.Vo //menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); java写法 List child = new List(); - foreach (var item in menu.children) + foreach (var item in menu.Children) { child.Add(new TreeSelectVo(item)); } diff --git a/ZR.Repository/System/SysLogininfoRepository.cs b/ZR.Repository/System/SysLogininfoRepository.cs index 5537664..5ab19fd 100644 --- a/ZR.Repository/System/SysLogininfoRepository.cs +++ b/ZR.Repository/System/SysLogininfoRepository.cs @@ -20,13 +20,13 @@ namespace ZR.Repository.System public PagedInfo GetLoginLog(SysLogininfor logininfoDto, PagerInfo pager) { var exp = Expressionable.Create(); - exp.And(it => it.loginTime >= logininfoDto.BeginTime && it.loginTime <= logininfoDto.EndTime); - exp.AndIF(logininfoDto.ipaddr.IfNotEmpty(), f => f.ipaddr == logininfoDto.ipaddr); - exp.AndIF(logininfoDto.userName.IfNotEmpty(), f => f.userName.Contains(logininfoDto.userName)); - exp.AndIF(logininfoDto.status.IfNotEmpty(), f => f.status == logininfoDto.status); + exp.And(it => it.LoginTime >= logininfoDto.BeginTime && it.LoginTime <= logininfoDto.EndTime); + exp.AndIF(logininfoDto.Ipaddr.IfNotEmpty(), f => f.Ipaddr == logininfoDto.Ipaddr); + exp.AndIF(logininfoDto.UserName.IfNotEmpty(), f => f.UserName.Contains(logininfoDto.UserName)); + exp.AndIF(logininfoDto.Status.IfNotEmpty(), f => f.Status == logininfoDto.Status); var query = Context.Queryable() .Where(exp.ToExpression()) - .OrderBy(it => it.infoId, OrderByType.Desc); + .OrderBy(it => it.InfoId, OrderByType.Desc); return query.ToPage(pager); } diff --git a/ZR.Repository/System/SysMenuRepository.cs b/ZR.Repository/System/SysMenuRepository.cs index d3d09ba..667407b 100644 --- a/ZR.Repository/System/SysMenuRepository.cs +++ b/ZR.Repository/System/SysMenuRepository.cs @@ -22,11 +22,12 @@ namespace ZR.Repository.System { return Context.Queryable() .WhereIF(!string.IsNullOrEmpty(menu.MenuName), it => it.MenuName.Contains(menu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(menu.Visible), it => it.visible == menu.Visible) - .WhereIF(!string.IsNullOrEmpty(menu.Status), it => it.status == menu.Status) - .WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), it => menu.MenuTypeIdArr.Contains(it.menuType)) - .OrderBy(it => new { it.parentId, it.orderNum }) - .ToTree(it => it.children, it => it.parentId, 0); + .WhereIF(!string.IsNullOrEmpty(menu.Visible), it => it.Visible == menu.Visible) + .WhereIF(!string.IsNullOrEmpty(menu.Status), it => it.Status == menu.Status) + .WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), it => menu.MenuTypeIdArr.Contains(it.MenuType)) + .WhereIF(menu.ParentId != null, it => it.ParentId == menu.ParentId) + .OrderBy(it => new { it.ParentId, it.OrderNum }) + .ToTree(it => it.Children, it => it.ParentId, menu.ParentId); } /// @@ -44,12 +45,12 @@ namespace ZR.Repository.System return Context.Queryable() .Where(c => roleMenus.Contains(c.MenuId)) .WhereIF(!string.IsNullOrEmpty(menu.MenuName), (c) => c.MenuName.Contains(menu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(menu.Visible), (c) => c.visible == menu.Visible) - .WhereIF(!string.IsNullOrEmpty(menu.Status), (c) => c.status == menu.Status) - .WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), c => menu.MenuTypeIdArr.Contains(c.menuType)) - .OrderBy((c) => new { c.parentId, c.orderNum }) + .WhereIF(!string.IsNullOrEmpty(menu.Visible), (c) => c.Visible == menu.Visible) + .WhereIF(!string.IsNullOrEmpty(menu.Status), (c) => c.Status == menu.Status) + .WhereIF(!string.IsNullOrEmpty(menu.MenuTypeIds), c => menu.MenuTypeIdArr.Contains(c.MenuType)) + .OrderBy((c) => new { c.ParentId, c.OrderNum }) .Select(c => c) - .ToTree(it => it.children, it => it.parentId, 0); + .ToTree(it => it.Children, it => it.ParentId, 0); } /// @@ -60,10 +61,10 @@ namespace ZR.Repository.System { return Context.Queryable() .WhereIF(!string.IsNullOrEmpty(menu.MenuName), it => it.MenuName.Contains(menu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(menu.Visible), it => it.visible == menu.Visible) - .WhereIF(!string.IsNullOrEmpty(menu.Status), it => it.status == menu.Status) - .WhereIF(menu.ParentId != null, it => it.parentId == menu.ParentId) - .OrderBy(it => new { it.parentId, it.orderNum }) + .WhereIF(!string.IsNullOrEmpty(menu.Visible), it => it.Visible == menu.Visible) + .WhereIF(!string.IsNullOrEmpty(menu.Status), it => it.Status == menu.Status) + .WhereIF(menu.ParentId != null, it => it.ParentId == menu.ParentId) + .OrderBy(it => new { it.ParentId, it.OrderNum }) .ToList(); } @@ -80,10 +81,10 @@ namespace ZR.Repository.System return Context.Queryable() .InnerJoin(roleMenus, (c, j) => c.MenuId == j.Menu_id) - .Where((c, j) => c.status == "0") + .Where((c, j) => c.Status == "0") .WhereIF(!string.IsNullOrEmpty(sysMenu.MenuName), (c, j) => c.MenuName.Contains(sysMenu.MenuName)) - .WhereIF(!string.IsNullOrEmpty(sysMenu.Visible), (c, j) => c.visible == sysMenu.Visible) - .OrderBy((c, j) => new { c.parentId, c.orderNum }) + .WhereIF(!string.IsNullOrEmpty(sysMenu.Visible), (c, j) => c.Visible == sysMenu.Visible) + .OrderBy((c, j) => new { c.ParentId, c.OrderNum }) .Select(c => c) .ToList(); } @@ -138,8 +139,8 @@ namespace ZR.Repository.System /// public int ChangeSortMenu(MenuDto menuDto) { - var result = Context.Updateable(new SysMenu() { MenuId = menuDto.MenuId, orderNum = menuDto.orderNum }) - .UpdateColumns(it => new { it.orderNum }).ExecuteCommand(); + var result = Context.Updateable(new SysMenu() { MenuId = menuDto.MenuId, OrderNum = menuDto.OrderNum }) + .UpdateColumns(it => new { it.OrderNum }).ExecuteCommand(); return result; } @@ -156,7 +157,7 @@ namespace ZR.Repository.System JoinType.Left, ur.RoleId == r.RoleId )) //.Distinct() - .Where((m, rm, ur, r) => m.status == "0" && r.Status == "0" && ur.UserId == userId) + .Where((m, rm, ur, r) => m.Status == "0" && r.Status == "0" && ur.UserId == userId) .Select((m, rm, ur, r) => m).ToList(); } @@ -168,7 +169,7 @@ namespace ZR.Repository.System public SysMenu CheckMenuNameUnique(SysMenu menu) { return Context.Queryable() - .Where(it => it.MenuName == menu.MenuName && it.parentId == menu.parentId).Single(); + .Where(it => it.MenuName == menu.MenuName && it.ParentId == menu.ParentId).Single(); } /// @@ -178,7 +179,7 @@ namespace ZR.Repository.System /// public int HasChildByMenuId(long menuId) { - return Context.Queryable().Where(it => it.parentId == menuId).Count(); + return Context.Queryable().Where(it => it.ParentId == menuId).Count(); } #region RoleMenu diff --git a/ZR.Repository/System/SysOperLogRepository.cs b/ZR.Repository/System/SysOperLogRepository.cs index 3050170..81a1126 100644 --- a/ZR.Repository/System/SysOperLogRepository.cs +++ b/ZR.Repository/System/SysOperLogRepository.cs @@ -21,11 +21,11 @@ namespace ZR.Repository.System public PagedInfo GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo) { var exp = Expressionable.Create(); - exp.And(it => it.operTime >= sysOper.BeginTime && it.operTime <= sysOper.EndTime); - exp.AndIF(sysOper.Title.IfNotEmpty(), it => it.title.Contains(sysOper.Title)); - exp.AndIF(sysOper.operName.IfNotEmpty(), it => it.operName.Contains(sysOper.operName)); - exp.AndIF(sysOper.BusinessType != -1, it => it.businessType == sysOper.BusinessType); - exp.AndIF(sysOper.Status != -1, it => it.status == sysOper.Status); + exp.And(it => it.OperTime >= sysOper.BeginTime && it.OperTime <= sysOper.EndTime); + exp.AndIF(sysOper.Title.IfNotEmpty(), it => it.Title.Contains(sysOper.Title)); + exp.AndIF(sysOper.operName.IfNotEmpty(), it => it.OperName.Contains(sysOper.operName)); + exp.AndIF(sysOper.BusinessType != -1, it => it.BusinessType == sysOper.BusinessType); + exp.AndIF(sysOper.Status != -1, it => it.Status == sysOper.Status); return GetPages(exp.ToExpression(), pagerInfo, x => x.OperId, OrderByType.Desc); } diff --git a/ZR.Service/System/SysLoginService.cs b/ZR.Service/System/SysLoginService.cs index 563bb11..48fa6fa 100644 --- a/ZR.Service/System/SysLoginService.cs +++ b/ZR.Service/System/SysLoginService.cs @@ -35,25 +35,25 @@ namespace ZR.Service.System loginBody.Password = NETCore.Encrypt.EncryptProvider.Md5(loginBody.Password); SysUser user = SysLogininfoRepository.Login(loginBody); - logininfor.userName = loginBody.Username; - logininfor.status = "1"; - logininfor.loginTime = DateTime.Now; + logininfor.UserName = loginBody.Username; + logininfor.Status = "1"; + logininfor.LoginTime = DateTime.Now; if (user == null || user.UserId <= 0) { - logininfor.msg = "用户名或密码错误"; + logininfor.Msg = "用户名或密码错误"; AddLoginInfo(logininfor); - throw new CustomException(ResultCode.LOGIN_ERROR ,logininfor.msg); + throw new CustomException(ResultCode.LOGIN_ERROR ,logininfor.Msg); } if (user.Status == "1") { - logininfor.msg = "该用户已禁用"; + logininfor.Msg = "该用户已禁用"; AddLoginInfo(logininfor); - throw new CustomException(ResultCode.LOGIN_ERROR, logininfor.msg); + throw new CustomException(ResultCode.LOGIN_ERROR, logininfor.Msg); } - logininfor.status = "0"; - logininfor.msg = "登录成功"; + logininfor.Status = "0"; + logininfor.Msg = "登录成功"; AddLoginInfo(logininfor); SysLogininfoRepository.UpdateLoginInfo(loginBody, user.UserId); return user; diff --git a/ZR.Service/System/SysMenuService.cs b/ZR.Service/System/SysMenuService.cs index 78a45bc..475bfc9 100644 --- a/ZR.Service/System/SysMenuService.cs +++ b/ZR.Service/System/SysMenuService.cs @@ -83,10 +83,10 @@ namespace ZR.Service /// public List GetMenusByMenuId(int menuId) { - var list = MenuRepository.GetList(f => f.parentId == menuId).OrderBy(f => f.orderNum).ToList(); + var list = MenuRepository.GetList(f => f.ParentId == menuId).OrderBy(f => f.OrderNum).ToList(); Context.ThenMapper(list, item => { - item.SubNum = Context.Queryable().SetContext(x => x.parentId, () => item.MenuId, item).Count; + item.SubNum = Context.Queryable().SetContext(x => x.ParentId, () => item.MenuId, item).Count; }); return list; } @@ -108,7 +108,7 @@ namespace ZR.Service /// public int EditMenu(SysMenu menu) { - menu.icon = string.IsNullOrEmpty(menu.icon) ? "" : menu.icon; + menu.Icon = string.IsNullOrEmpty(menu.Icon) ? "" : menu.Icon; return MenuRepository.EditMenu(menu); } @@ -199,9 +199,9 @@ namespace ZR.Service /// public List SelectMenuPermsByUserId(long userId) { - var menuList = SelectMenuPermsListByUserId(userId).Where(f => !string.IsNullOrEmpty(f.perms)); + var menuList = SelectMenuPermsListByUserId(userId).Where(f => !string.IsNullOrEmpty(f.Perms)); - return menuList.Select(x => x.perms).Distinct().ToList(); + return menuList.Select(x => x.Perms).Distinct().ToList(); } #region RoleMenu @@ -249,7 +249,7 @@ namespace ZR.Service { //得到子节点列表 List childList = GetChildList(list, t); - t.children = childList; + t.Children = childList; foreach (var item in childList) { if (GetChildList(list, item).Count() > 0) @@ -267,7 +267,7 @@ namespace ZR.Service /// private List GetChildList(List list, SysMenu sysMenu) { - return list.Where(p => p.parentId == sysMenu.MenuId).ToList(); + return list.Where(p => p.ParentId == sysMenu.MenuId).ToList(); } /// @@ -283,16 +283,16 @@ namespace ZR.Service { RouterVo router = new() { - Hidden = "1".Equals(menu.visible), + Hidden = "1".Equals(menu.Visible), Name = GetRouteName(menu), Path = GetRoutePath(menu), Component = GetComponent(menu), - Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache), menu.MenuNameKey, menu.path) + Meta = new Meta(menu.MenuName, menu.Icon, "1".Equals(menu.IsCache), menu.MenuNameKey, menu.Path) }; - List cMenus = menu.children; + List cMenus = menu.Children; //是目录并且有子菜单 - if (cMenus != null && cMenus.Count > 0 && (UserConstants.TYPE_DIR.Equals(menu.menuType))) + if (cMenus != null && cMenus.Count > 0 && (UserConstants.TYPE_DIR.Equals(menu.MenuType))) { router.AlwaysShow = true; router.Redirect = "noRedirect"; @@ -304,25 +304,25 @@ namespace ZR.Service List childrenList = new(); RouterVo children = new() { - Path = menu.path, - Component = menu.component, - Name = string.IsNullOrEmpty(menu.path) ? "" : menu.path.ToLower(), - Meta = new Meta(menu.MenuName, menu.icon, "1".Equals(menu.isCache), menu.MenuNameKey, menu.path) + Path = menu.Path, + Component = menu.Component, + Name = string.IsNullOrEmpty(menu.Path) ? "" : menu.Path.ToLower(), + Meta = new Meta(menu.MenuName, menu.Icon, "1".Equals(menu.IsCache), menu.MenuNameKey, menu.Path) }; childrenList.Add(children); router.Children = childrenList; } - else if (menu.parentId == 0 && IsInnerLink(menu)) + else if (menu.ParentId == 0 && IsInnerLink(menu)) { - router.Meta = new Meta(menu.MenuName, menu.icon); + router.Meta = new Meta(menu.MenuName, menu.Icon); router.Path = "/"; List childrenList = new(); RouterVo children = new(); - string routerPath = InnerLinkReplaceEach(menu.path); + string routerPath = InnerLinkReplaceEach(menu.Path); children.Path = routerPath; children.Component = UserConstants.INNER_LINK; children.Name = routerPath.ToLower(); - children.Meta = new Meta(menu.MenuName, menu.icon, menu.path); + children.Meta = new Meta(menu.MenuName, menu.Icon, menu.Path); childrenList.Add(children); router.Children = childrenList; } @@ -345,7 +345,7 @@ namespace ZR.Service foreach (var menu in menus) { // 如果是顶级节点, 遍历该父节点的所有子节点 - if (!tempList.Contains(menu.parentId)) + if (!tempList.Contains(menu.ParentId)) { RecursionFn(menus, menu); returnList.Add(menu); @@ -381,7 +381,7 @@ namespace ZR.Service /// 路由名称 public string GetRouteName(SysMenu menu) { - string routerName = menu.path.ToLower(); + string routerName = menu.Path.ToLower(); // 非外链并且是一级目录(类型为目录) if (IsMeunFrame(menu)) { @@ -397,17 +397,17 @@ namespace ZR.Service /// 路由地址 public string GetRoutePath(SysMenu menu) { - string routerPath = menu.path; + string routerPath = menu.Path; // 内链打开外网方式 - if (menu.parentId != 0 && IsInnerLink(menu)) + if (menu.ParentId != 0 && IsInnerLink(menu)) { routerPath = InnerLinkReplaceEach(routerPath); } // 非外链并且是一级目录(类型为目录) - if (0 == menu.parentId && UserConstants.TYPE_DIR.Equals(menu.menuType) - && UserConstants.NO_FRAME.Equals(menu.isFrame)) + if (0 == menu.ParentId && UserConstants.TYPE_DIR.Equals(menu.MenuType) + && UserConstants.NO_FRAME.Equals(menu.IsFrame)) { - routerPath = "/" + menu.path; + routerPath = "/" + menu.Path; } else if (IsMeunFrame(menu))// 非外链并且是一级目录(类型为菜单) { @@ -424,15 +424,15 @@ namespace ZR.Service public string GetComponent(SysMenu menu) { string component = UserConstants.LAYOUT; - if (!string.IsNullOrEmpty(menu.component) && !IsMeunFrame(menu)) + if (!string.IsNullOrEmpty(menu.Component) && !IsMeunFrame(menu)) { - component = menu.component; + component = menu.Component; } - else if (menu.component.IsEmpty() && menu.parentId != 0 && IsInnerLink(menu)) + else if (menu.Component.IsEmpty() && menu.ParentId != 0 && IsInnerLink(menu)) { component = UserConstants.INNER_LINK; } - else if (string.IsNullOrEmpty(menu.component) && IsParentView(menu)) + else if (string.IsNullOrEmpty(menu.Component) && IsParentView(menu)) { component = UserConstants.PARENT_VIEW; } @@ -446,8 +446,8 @@ namespace ZR.Service /// public bool IsMeunFrame(SysMenu menu) { - return menu.parentId == 0 && UserConstants.TYPE_MENU.Equals(menu.menuType) - && menu.isFrame.Equals(UserConstants.NO_FRAME); + return menu.ParentId == 0 && UserConstants.TYPE_MENU.Equals(menu.MenuType) + && menu.IsFrame.Equals(UserConstants.NO_FRAME); } /// @@ -457,7 +457,7 @@ namespace ZR.Service /// 结果 public bool IsInnerLink(SysMenu menu) { - return menu.isFrame.Equals(UserConstants.NO_FRAME) && Tools.IsUrl(menu.path); + return menu.IsFrame.Equals(UserConstants.NO_FRAME) && Tools.IsUrl(menu.Path); } /// @@ -468,7 +468,7 @@ namespace ZR.Service /// public bool IsParentView(SysMenu menu) { - return menu.parentId != 0 && UserConstants.TYPE_DIR.Equals(menu.menuType); + return menu.ParentId != 0 && UserConstants.TYPE_DIR.Equals(menu.MenuType); } /// diff --git a/ZR.Service/System/SysOperLogService.cs b/ZR.Service/System/SysOperLogService.cs index c17ed66..cefb0ff 100644 --- a/ZR.Service/System/SysOperLogService.cs +++ b/ZR.Service/System/SysOperLogService.cs @@ -27,9 +27,9 @@ namespace ZR.Service.System /// 日志对象 public void InsertOperlog(SysOperLog operLog) { - if (operLog.operParam.Length >= 1000) + if (operLog.OperParam.Length >= 1000) { - operLog.operParam = operLog.operParam.Substring(0, 1000); + operLog.OperParam = operLog.OperParam[..1000]; } sysOperLogRepository.AddSysOperLog(operLog); }