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