优化实体统一首字母大写

This commit is contained in:
不做码农 2022-09-01 21:54:53 +08:00
parent 401338eadb
commit c372c9a9e2
17 changed files with 184 additions and 185 deletions

View File

@ -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;

View File

@ -106,11 +106,11 @@ namespace ZR.Admin.WebApi.Controllers.System
.NameMatchingStrategy(NameMatchingStrategy.IgnoreCase);//忽略字段名称的大小写;//忽略除以上配置的所有字段
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)://开头"));
}
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, "请求参数错误")); }

View File

@ -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<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())
.ToList();

View File

@ -134,7 +134,7 @@ namespace ZR.Admin.WebApi.Extensions
/// <param name="context"></param>
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;
}
}

View File

@ -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);

View File

@ -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<LogAttribute>();
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);
}

View File

@ -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
/// <summary>
/// 父菜单ID
/// </summary>
public long? parentId { get; set; }
public long? ParentId { get; set; }
/// <summary>
/// 显示顺序
/// </summary>
public int orderNum { get; set; }
public int OrderNum { get; set; }
/// <summary>
/// 路由地址
/// </summary>
public string path { get; set; } = "#";
public string Path { get; set; } = "#";
/// <summary>
/// 组件路径
/// </summary>
public string component { get; set; }
public string Component { get; set; }
/// <summary>
/// 是否缓存1缓存 0不缓存
/// </summary>
[Required(ErrorMessage = "是否缓存不能为空")]
public string isCache { get; set; }
public string IsCache { get; set; }
/// <summary>
/// 是否外链 1、是 0、否
/// </summary>
public string isFrame { get; set; }
public string IsFrame { get; set; }
/// <summary>
/// 类型M目录 C菜单 F按钮 L链接
/// </summary>
[Required(ErrorMessage = "菜单类型不能为空")]
public string menuType { get; set; }
public string MenuType { get; set; }
/// <summary>
/// 显示状态0显示 1隐藏
/// </summary>
[Required(ErrorMessage = "显示状态不能为空")]
public string visible { get; set; }
public string Visible { get; set; }
/// <summary>
/// 菜单状态0正常 1停用
/// </summary>
[Required(ErrorMessage = "菜单状态不能为空")]
public string status { get; set; }
public string Status { get; set; }
/// <summary>
/// 权限字符串
/// </summary>
public string perms { get; set; }
public string Perms { get; set; }
/// <summary>
/// 菜单图标
/// </summary>
public string icon { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
/// <summary>
/// 翻译key
/// </summary>

View File

@ -14,47 +14,47 @@ namespace ZR.Model.System
{
//[Key]
[SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
public long infoId { get; set; }
public long InfoId { get; set; }
/// <summary>
/// 用户账号
/// </summary>
public string userName { get; set; }
public string UserName { get; set; }
/// <summary>
/// 登录状态 0成功 1失败
/// </summary>
public string status { get; set; }
public string Status { get; set; }
/// <summary>
/// 登录IP地址
/// </summary>
public string ipaddr { get; set; }
public string Ipaddr { get; set; }
/// <summary>
/// 登录地点
/// </summary>
public string loginLocation { get; set; }
public string LoginLocation { get; set; }
/// <summary>
/// 浏览器类型
/// </summary>
public string browser { get; set; }
public string Browser { get; set; }
/** 操作系统 */
//@Excel(name = "操作系统")
public string os { get; set; }
public string Os { get; set; }
/// <summary>
/// 提示消息
/// </summary>
public string msg { get; set; }
public string Msg { get; set; }
/// <summary>
/// 访问时间
/// </summary>
[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)]

View File

@ -24,56 +24,56 @@ namespace ZR.Model.System
/// <summary>
/// 父菜单ID
/// </summary>
public long parentId { get; set; }
public long ParentId { get; set; }
/// <summary>
/// 显示顺序
/// </summary>
public int orderNum { get; set; }
public int OrderNum { get; set; }
/// <summary>
/// 路由地址
/// </summary>
public string path { get; set; } = "#";
public string Path { get; set; } = "#";
/// <summary>
/// 组件路径
/// </summary>
public string component { get; set; }
public string Component { get; set; }
/// <summary>
/// 是否缓存1缓存 0不缓存
/// </summary>
public string isCache { get; set; }
public string IsCache { get; set; }
/// <summary>
/// 是否外链 1、是 0、否
/// </summary>
public string isFrame { get; set; }
public string IsFrame { get; set; }
/// <summary>
/// 类型M目录 C菜单 F按钮 L链接
/// </summary>
public string menuType { get; set; }
public string MenuType { get; set; }
/// <summary>
/// 显示状态0显示 1隐藏
/// </summary>
public string visible { get; set; }
public string Visible { get; set; }
/// <summary>
/// 菜单状态0正常 1停用
/// </summary>
public string status { get; set; }
public string Status { get; set; }
/// <summary>
/// 权限字符串
/// </summary>
public string perms { get; set; }
public string Perms { get; set; }
/// <summary>
/// 菜单图标
/// </summary>
public string icon { get; set; } = string.Empty;
public string Icon { get; set; } = string.Empty;
/// <summary>
/// 菜单名key
/// </summary>
@ -83,7 +83,7 @@ namespace ZR.Model.System
/// 子菜单
/// </summary>
[SugarColumn(IsIgnore = true)]
public List<SysMenu> children { get; set; } = new List<SysMenu>();
public List<SysMenu> Children { get; set; } = new List<SysMenu>();
/// <summary>
/// 子菜单个数
/// </summary>
@ -97,7 +97,7 @@ namespace ZR.Model.System
{
get
{
return SubNum > 0 || children.Count > 0;
return SubNum > 0 || Children.Count > 0;
}
}
}

View File

@ -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; }
/// <summary>
/// 错误消息
/// </summary>
[EpplusTableColumn(Header = "错误消息")]
public string errorMsg { get; set; }
public string ErrorMsg { get; set; }
/// <summary>
/// 操作时间
/// </summary>
[EpplusTableColumn(Header = "操作时间", NumberFormat = "yyyy-MM-dd HH:mm:ss")]
public DateTime? operTime { get; set; }
public DateTime? OperTime { get; set; }
/// <summary>
/// 操作用时
/// </summary>

View File

@ -29,7 +29,7 @@ namespace ZR.Model.System.Vo
//menu.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList()); java写法
List<TreeSelectVo> child = new List<TreeSelectVo>();
foreach (var item in menu.children)
foreach (var item in menu.Children)
{
child.Add(new TreeSelectVo(item));
}

View File

@ -20,13 +20,13 @@ namespace ZR.Repository.System
public PagedInfo<SysLogininfor> GetLoginLog(SysLogininfor logininfoDto, PagerInfo pager)
{
var exp = Expressionable.Create<SysLogininfor>();
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<SysLogininfor>()
.Where(exp.ToExpression())
.OrderBy(it => it.infoId, OrderByType.Desc);
.OrderBy(it => it.InfoId, OrderByType.Desc);
return query.ToPage(pager);
}

View File

@ -22,11 +22,12 @@ namespace ZR.Repository.System
{
return Context.Queryable<SysMenu>()
.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);
}
/// <summary>
@ -44,12 +45,12 @@ namespace ZR.Repository.System
return Context.Queryable<SysMenu>()
.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);
}
/// <summary>
@ -60,10 +61,10 @@ namespace ZR.Repository.System
{
return Context.Queryable<SysMenu>()
.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<SysMenu>()
.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
/// <returns></returns>
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<SysMenu>()
.Where(it => it.MenuName == menu.MenuName && it.parentId == menu.parentId).Single();
.Where(it => it.MenuName == menu.MenuName && it.ParentId == menu.ParentId).Single();
}
/// <summary>
@ -178,7 +179,7 @@ namespace ZR.Repository.System
/// <returns></returns>
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

View File

@ -21,11 +21,11 @@ namespace ZR.Repository.System
public PagedInfo<SysOperLog> GetSysOperLog(SysOperLogDto sysOper, PagerInfo pagerInfo)
{
var exp = Expressionable.Create<SysOperLog>();
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);
}

View File

@ -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;

View File

@ -83,10 +83,10 @@ namespace ZR.Service
/// <returns></returns>
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 =>
{
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;
}
@ -108,7 +108,7 @@ namespace ZR.Service
/// <returns></returns>
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
/// <returns></returns>
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
@ -249,7 +249,7 @@ namespace ZR.Service
{
//得到子节点列表
List<SysMenu> 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
/// <returns></returns>
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>
@ -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<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.Redirect = "noRedirect";
@ -304,25 +304,25 @@ namespace ZR.Service
List<RouterVo> 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<RouterVo> 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
/// <returns>路由名称</returns>
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
/// <returns>路由地址</returns>
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
/// <returns></returns>
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);
}
/// <summary>
@ -457,7 +457,7 @@ namespace ZR.Service
/// <returns>结果</returns>
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>
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>

View File

@ -27,9 +27,9 @@ namespace ZR.Service.System
/// <param name="operLog">日志对象</param>
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);
}