集成CSRedis分布式存储,调整创建者和更新者字段,登录RSA使用配置文件配置私钥

This commit is contained in:
文永达 2023-09-22 01:09:47 +08:00
parent de76f5872a
commit d3556cc058
25 changed files with 95 additions and 33 deletions

View File

@ -1,5 +1,6 @@
using CSRedis; using CSRedis;
using Infrastructure; using Infrastructure;
using Microsoft.Extensions.Caching.Distributed;
namespace ZR.Common.Cache namespace ZR.Common.Cache
{ {
@ -12,6 +13,7 @@ namespace ZR.Common.Cache
{ {
Cache = new CSRedisClient(AppSettings.GetConfig("RedisServer:Cache")); Cache = new CSRedisClient(AppSettings.GetConfig("RedisServer:Cache"));
Session = new CSRedisClient(AppSettings.GetConfig("RedisServer:Session")); Session = new CSRedisClient(AppSettings.GetConfig("RedisServer:Session"));
RedisHelper.Initialization(Cache);
} }
} }
} }

View File

@ -157,7 +157,8 @@ namespace Infrastructure
{ {
new Claim(ClaimTypes.PrimarySid, user.UserId.ToString()), new Claim(ClaimTypes.PrimarySid, user.UserId.ToString()),
new Claim(ClaimTypes.Name, user.UserName), new Claim(ClaimTypes.Name, user.UserName),
new Claim(ClaimTypes.UserData, JsonConvert.SerializeObject(user)) new Claim(ClaimTypes.UserData, JsonConvert.SerializeObject(user)),
new Claim("NickName", user.NickName)
}; };
return claims; return claims;

View File

@ -9,6 +9,7 @@ namespace Infrastructure.Model
public long UserId { get; set; } public long UserId { get; set; }
public long DeptId { get; set; } public long DeptId { get; set; }
public string UserName { get; set; } public string UserName { get; set; }
public string NickName { get; set; }
/// <summary> /// <summary>
/// 角色集合 /// 角色集合
/// </summary> /// </summary>

View File

@ -91,6 +91,14 @@ namespace Infrastructure.Extensions
return uid; return uid;
} }
public static string? GetNickName(this HttpContext context)
{
var nickName = context.User.FindFirstValue("NickName");
if (string.IsNullOrEmpty(nickName))
nickName = null;
return nickName;
}
/// <summary> /// <summary>
/// 判断是否是管理员 /// 判断是否是管理员

View File

@ -12,8 +12,10 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="AspectCore.Abstractions" Version="2.4.0" /> <PackageReference Include="AspectCore.Abstractions" Version="2.4.0" />
<PackageReference Include="Caching.CSRedis" Version="3.8.670" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyModel" Version="7.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="RulesEngine" Version="5.0.2" />
<PackageReference Include="UAParser" Version="3.1.47" /> <PackageReference Include="UAParser" Version="3.1.47" />
<PackageReference Include="IPTools.China" Version="1.6.0" /> <PackageReference Include="IPTools.China" Version="1.6.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.7" /> <PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.7" />

View File

@ -304,7 +304,8 @@ namespace ZR.Admin.WebApi.Controllers
if (string.IsNullOrEmpty(tableName) || tableId <= 0) throw new CustomException("参数错误"); if (string.IsNullOrEmpty(tableName) || tableId <= 0) throw new CustomException("参数错误");
GenTable table = GenTableService.GetGenTableInfo(tableId); GenTable table = GenTableService.GetGenTableInfo(tableId);
if (table == null) { throw new CustomException("同步数据失败,原表结构不存在"); } if (table == null) { throw new CustomException("同步数据失败,原表结构不存在"); }
table.Update_by = HttpContext.GetName(); table.Update_by = HttpContext.GetUId();
table.Update_name = HttpContext.GetNickName();
List<DbColumnInfo> dbColumnInfos = _CodeGeneraterService.GetColumnInfo(table.DbName, tableName); List<DbColumnInfo> dbColumnInfos = _CodeGeneraterService.GetColumnInfo(table.DbName, tableName);
List<GenTableColumn> dbTableColumns = CodeGeneratorTool.InitGenTableColumn(table, dbColumnInfos); List<GenTableColumn> dbTableColumns = CodeGeneratorTool.InitGenTableColumn(table, dbColumnInfos);

View File

@ -114,7 +114,8 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
return ToResponse(ResultCode.CUSTOM_ERROR, $"新增部门{dept.DeptName}失败,部门名称已存在"); return ToResponse(ResultCode.CUSTOM_ERROR, $"新增部门{dept.DeptName}失败,部门名称已存在");
} }
dept.Create_by = HttpContext.GetName(); dept.Create_by = HttpContext.GetUId();
dept.Create_name = HttpContext.GetNickName();
return ToResponse(DeptService.InsertDept(dept)); return ToResponse(DeptService.InsertDept(dept));
} }
@ -136,7 +137,8 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
return ToResponse(ResultCode.CUSTOM_ERROR, $"修改部门{dept.DeptName}失败,上级部门不能是自己"); return ToResponse(ResultCode.CUSTOM_ERROR, $"修改部门{dept.DeptName}失败,上级部门不能是自己");
} }
dept.Update_by = HttpContext.GetName(); dept.Update_by = HttpContext.GetUId();
dept.Update_name = HttpContext.GetNickName();
return ToResponse(DeptService.UpdateDept(dept)); return ToResponse(DeptService.UpdateDept(dept));
} }

View File

@ -109,7 +109,8 @@ namespace ZR.Admin.WebApi.Controllers.System
[HttpPost()] [HttpPost()]
public IActionResult Add([FromBody] SysDictData dict) public IActionResult Add([FromBody] SysDictData dict)
{ {
dict.Create_by = HttpContext.GetName(); dict.Create_by = HttpContext.GetUId();
dict.Create_name = HttpContext.GetNickName();
dict.Create_time = DateTime.Now; dict.Create_time = DateTime.Now;
return SUCCESS(SysDictDataService.InsertDictData(dict)); return SUCCESS(SysDictDataService.InsertDictData(dict));
} }
@ -124,7 +125,8 @@ namespace ZR.Admin.WebApi.Controllers.System
[HttpPut()] [HttpPut()]
public IActionResult Edit([FromBody] SysDictData dict) public IActionResult Edit([FromBody] SysDictData dict)
{ {
dict.Update_by = HttpContext.GetName(); dict.Update_by = HttpContext.GetUId();
dict.Update_name = HttpContext.GetNickName();
return SUCCESS(SysDictDataService.UpdateDictData(dict)); return SUCCESS(SysDictDataService.UpdateDictData(dict));
} }

View File

@ -65,7 +65,8 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
return ToResponse(ApiResult.Error($"新增字典'{dict.DictName}'失败,字典类型已存在")); return ToResponse(ApiResult.Error($"新增字典'{dict.DictName}'失败,字典类型已存在"));
} }
dict.Create_by = HttpContext.GetName(); dict.Create_by = HttpContext.GetUId();
dict.Create_name = HttpContext.GetNickName();
dict.Create_time = DateTime.Now; dict.Create_time = DateTime.Now;
return SUCCESS(SysDictService.InsertDictType(dict)); return SUCCESS(SysDictService.InsertDictType(dict));
} }
@ -87,7 +88,8 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ApiResult.Error($"修改字典'{dict.DictName}'失败,字典类型已存在")); return ToResponse(ApiResult.Error($"修改字典'{dict.DictName}'失败,字典类型已存在"));
} }
//设置添加人 //设置添加人
dict.Update_by = HttpContext.GetName(); dict.Update_by = HttpContext.GetUId();
dict.Update_name = HttpContext.GetNickName();
return SUCCESS(SysDictService.UpdateDictType(dict)); return SUCCESS(SysDictService.UpdateDictType(dict));
} }

View File

@ -1,6 +1,7 @@
using Lazy.Captcha.Core; using Lazy.Captcha.Core;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Options; using Microsoft.Extensions.Options;
using NETCore.Encrypt;
using ZR.Admin.WebApi.Filters; using ZR.Admin.WebApi.Filters;
using ZR.Model.System; using ZR.Model.System;
using ZR.Model.System.Dto; using ZR.Model.System.Dto;
@ -47,7 +48,9 @@ namespace ZR.Admin.WebApi.Controllers.System
roleService = sysRoleService; roleService = sysRoleService;
this.optionSettings = optionSettings.Value; this.optionSettings = optionSettings.Value;
} }
// RSA私钥
private static readonly string PrivatePem = AppSettings.GetConfig("RSA:PrivatePem");
/// <summary> /// <summary>
/// 登录 /// 登录
@ -69,6 +72,10 @@ namespace ZR.Admin.WebApi.Controllers.System
sysLoginService.CheckLockUser(loginBody.Username); sysLoginService.CheckLockUser(loginBody.Username);
string location = HttpContextExtension.GetIpInfo(loginBody.LoginIP); string location = HttpContextExtension.GetIpInfo(loginBody.LoginIP);
// RSA解密
loginBody.Password = EncryptProvider.RSADecryptWithPem(PrivatePem, loginBody.Password);
var user = sysLoginService.Login(loginBody, new SysLogininfor() { LoginLocation = location }); var user = sysLoginService.Login(loginBody, new SysLogininfor() { LoginLocation = location });
List<SysRole> roles = roleService.SelectUserRoleListByUserId(user.UserId); List<SysRole> roles = roleService.SelectUserRoleListByUserId(user.UserId);

View File

@ -113,7 +113,8 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,上级菜单不能选择自己")); return ToResponse(ApiResult.Error($"修改菜单'{modal.MenuName}'失败,上级菜单不能选择自己"));
} }
modal.Update_by = HttpContext.GetName(); modal.Update_by = HttpContext.GetUId();
modal.Update_name = HttpContext.GetNickName();
long result = sysMenuService.EditMenu(modal); long result = sysMenuService.EditMenu(modal);
return ToResponse(result); return ToResponse(result);
@ -145,7 +146,8 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ApiResult.Error($"新增菜单'{menu.MenuName}'失败地址必须以http(s)://开头")); return ToResponse(ApiResult.Error($"新增菜单'{menu.MenuName}'失败地址必须以http(s)://开头"));
} }
menu.Create_by = HttpContext.GetName(); menu.Create_by = HttpContext.GetUId();
menu.Create_name = HttpContext.GetNickName();
long result = sysMenuService.AddMenu(menu); long result = sysMenuService.AddMenu(menu);
return ToResponse(result); return ToResponse(result);

View File

@ -104,7 +104,8 @@ namespace ZR.Admin.WebApi.Controllers.System
public IActionResult UpdateSysNotice([FromBody] SysNoticeDto parm) public IActionResult UpdateSysNotice([FromBody] SysNoticeDto parm)
{ {
var model = parm.Adapt<SysNotice>().ToUpdate(HttpContext); var model = parm.Adapt<SysNotice>().ToUpdate(HttpContext);
model.Update_by = HttpContext.GetName(); model.Update_by = HttpContext.GetUId();
model.Update_name = HttpContext.GetNickName();
var response = _SysNoticeService.Update(w => w.NoticeId == model.NoticeId, it => new SysNotice() var response = _SysNoticeService.Update(w => w.NoticeId == model.NoticeId, it => new SysNotice()
{ {
NoticeTitle = model.NoticeTitle, NoticeTitle = model.NoticeTitle,
@ -112,7 +113,8 @@ namespace ZR.Admin.WebApi.Controllers.System
NoticeContent = model.NoticeContent, NoticeContent = model.NoticeContent,
Status = model.Status, Status = model.Status,
Remark = model.Remark, Remark = model.Remark,
Update_by = HttpContext.GetName(), Update_by = HttpContext.GetUId(),
Update_name = HttpContext.GetNickName(),
Update_time = DateTime.Now Update_time = DateTime.Now
}); });

View File

@ -70,7 +70,8 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ApiResult.Error((int)ResultCode.CUSTOM_ERROR, $"新增角色'{sysRoleDto.RoleName}'失败,角色权限已存在")); return ToResponse(ApiResult.Error((int)ResultCode.CUSTOM_ERROR, $"新增角色'{sysRoleDto.RoleName}'失败,角色权限已存在"));
} }
sysRoleDto.Create_by = HttpContext.GetName(); sysRoleDto.Create_by = HttpContext.GetUId();
sysRoleDto.Create_name = HttpContext.GetNickName();
long roleId = sysRoleService.InsertRole(sysRoleDto); long roleId = sysRoleService.InsertRole(sysRoleDto);
return ToResponse(roleId); return ToResponse(roleId);
@ -101,7 +102,8 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ApiResult.Error($"编辑角色'{sysRoleDto.RoleName}'失败,角色权限已存在")); return ToResponse(ApiResult.Error($"编辑角色'{sysRoleDto.RoleName}'失败,角色权限已存在"));
} }
} }
sysRoleDto.Update_by = HttpContext.GetName(); sysRoleDto.Update_by = HttpContext.GetUId();
sysRoleDto.Update_name = HttpContext.GetNickName();
int upResult = sysRoleService.UpdateRole(sysRoleDto); int upResult = sysRoleService.UpdateRole(sysRoleDto);
if (upResult > 0) if (upResult > 0)
{ {
@ -122,7 +124,8 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
if (sysRoleDto == null || sysRoleDto.RoleId <= 0) return ToResponse(ApiResult.Error(101, "请求参数错误")); if (sysRoleDto == null || sysRoleDto.RoleId <= 0) return ToResponse(ApiResult.Error(101, "请求参数错误"));
SysRole sysRole = sysRoleDto.Adapt<SysRole>(); SysRole sysRole = sysRoleDto.Adapt<SysRole>();
sysRoleDto.Create_by = HttpContext.GetName(); sysRoleDto.Create_by = HttpContext.GetUId();
sysRoleDto.Create_name = HttpContext.GetNickName();
sysRoleService.CheckRoleAllowed(sysRole); sysRoleService.CheckRoleAllowed(sysRole);
bool result = sysRoleService.AuthDataScope(sysRoleDto); bool result = sysRoleService.AuthDataScope(sysRoleDto);

View File

@ -92,7 +92,8 @@ namespace ZR.Admin.WebApi.Controllers.System
return ToResponse(ApiResult.Error($"新增用户 '{user.UserName}'失败,登录账号已存在")); return ToResponse(ApiResult.Error($"新增用户 '{user.UserName}'失败,登录账号已存在"));
} }
user.Create_by = HttpContext.GetName(); user.Create_by = HttpContext.GetUId();
user.Create_name = HttpContext.GetNickName();
user.Create_time = DateTime.Now; user.Create_time = DateTime.Now;
user.Password = NETCore.Encrypt.EncryptProvider.Md5(user.Password); user.Password = NETCore.Encrypt.EncryptProvider.Md5(user.Password);
@ -111,7 +112,8 @@ namespace ZR.Admin.WebApi.Controllers.System
{ {
if (user == null || user.UserId <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); } if (user == null || user.UserId <= 0) { return ToResponse(ApiResult.Error(101, "请求参数错误")); }
user.Update_by = HttpContext.GetName(); user.Update_by = HttpContext.GetUId();
user.Update_name = HttpContext.GetNickName();
int upResult = UserService.UpdateUser(user); int upResult = UserService.UpdateUser(user);
return ToResponse(upResult); return ToResponse(upResult);

View File

@ -87,7 +87,8 @@ namespace ZR.Admin.WebApi.Controllers
} }
//从 Dto 映射到 实体 //从 Dto 映射到 实体
var tasksQz = parm.Adapt<SysTasks>().ToCreate(HttpContext); var tasksQz = parm.Adapt<SysTasks>().ToCreate(HttpContext);
tasksQz.Create_by = HttpContext.GetName(); tasksQz.Create_by = HttpContext.GetUId();
tasksQz.Create_name = HttpContext.GetNickName();
tasksQz.ID = SnowFlakeSingle.Instance.NextId().ToString(); tasksQz.ID = SnowFlakeSingle.Instance.NextId().ToString();
return SUCCESS(_tasksQzService.AddTasks(tasksQz)); return SUCCESS(_tasksQzService.AddTasks(tasksQz));
@ -126,7 +127,8 @@ namespace ZR.Admin.WebApi.Controllers
throw new CustomException($"该任务正在运行中,请先停止在更新"); throw new CustomException($"该任务正在运行中,请先停止在更新");
} }
var model = parm.Adapt<SysTasks>(); var model = parm.Adapt<SysTasks>();
model.Update_by = HttpContextExtension.GetName(HttpContext); model.Update_by = HttpContext.GetUId();
model.Update_name = HttpContext.GetNickName();
int response = _tasksQzService.UpdateTasks(model); int response = _tasksQzService.UpdateTasks(model);
if (response > 0) if (response > 0)
{ {

View File

@ -4,6 +4,8 @@ using Microsoft.AspNetCore.DataProtection;
using NLog.Web; using NLog.Web;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
using Microsoft.Extensions.Caching.Distributed;
using Microsoft.Extensions.Caching.Redis;
using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Extensions;
using ZR.Common.Cache; using ZR.Common.Cache;
using ZR.Infrastructure.WebExtensions; using ZR.Infrastructure.WebExtensions;
@ -11,6 +13,10 @@ using ZR.ServiceCore.Signalr;
using ZR.ServiceCore.SqlSugar; using ZR.ServiceCore.SqlSugar;
var builder = WebApplication.CreateBuilder(args); var builder = WebApplication.CreateBuilder(args);
//load json config by loginVerify
builder.Configuration.AddJsonFile("loginVerifyConf.json", true, true);
// NLog: Setup NLog for Dependency injection // NLog: Setup NLog for Dependency injection
//builder.Logging.ClearProviders(); //builder.Logging.ClearProviders();
builder.Host.UseNLog(); builder.Host.UseNLog();
@ -52,6 +58,7 @@ var openRedis = builder.Configuration["RedisServer:open"];
if (openRedis == "1") if (openRedis == "1")
{ {
RedisServer.Initalize(); RedisServer.Initalize();
builder.Services.AddSingleton<IDistributedCache>(new CSRedisCache(RedisHelper.Instance));
} }
builder.Services.AddMvc(options => builder.Services.AddMvc(options =>

View File

@ -51,7 +51,7 @@
"SECRET": "Klcm77KdpkIROAl2ffPemK5I1yDshM", "SECRET": "Klcm77KdpkIROAl2ffPemK5I1yDshM",
"bucketName": "markdownhexo", "bucketName": "markdownhexo",
"domainUrl": "https://markdownhexo.oss-cn-hangzhou.aliyuncs.com", //访 "domainUrl": "https://markdownhexo.oss-cn-hangzhou.aliyuncs.com", //访
"maxSize": 1000// 1000M "maxSize": 1000 // 1000M
}, },
// //
"WxCorp": { "WxCorp": {

View File

@ -0,0 +1,5 @@
{
"RSA": {
"PrivatePem": "-----BEGIN PRIVATE KEY-----MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCjvJHH6V8fHL9zuVkW1mcDcYF5D72fEG45xLP8jyXR0/klmxZUT6My2ajGcWtOAKyca4Mcw2lKV7FRzchVyylsLi1JaH+vgbL0qwjDS0hjSm6Uqw39WFX//t1qMxX8OD5F3lvAYaNauVY6nYQ9VgEcjrq5nc+kRB7cVsR1ouQlFMQ1vLCAZwajW2pSmpjkEMYC70iJfBl7iF0za6eIVLZEpxgOi8KIkTWUDvLLH0cRR30+FgyE8wu8gh09ZbYarGyLchmAbbmERHT6jfMgKCob/ZVuh0EzrklMsFj4qdjofejzRvS/arA4HtOS1W1ZBHovPxR36quWB4DO9lvkWakNAgMBAAECggEADiLHizTQq4T12m3UDS6xchColuUO/96RRZd/2nwZTcY5Kk/7W4gMlOVJtugv1WolfNOjXCZavrpXarKTayTBDL/n1QCalXJjGtBxTzr+ouPYLCmgaZDoy9MbFoIWkdHhPnL2BOPpEHoTwbe7pPf53JdN85x2Qr5G08sB5w4LGFBRPAkOoD2LgW4QK7Ut5k4GAHmcn7nqHlkMM8ksdNGkQEhSHfoQOh7FFgR1GHJMeO0JgXprJCIFjyhtyzzDj47r02LWqEaaTdokvkYPEqyzjSI/Gufvq6nvgIlf2mU9KA2NC3VwJrXtAQQezy7yB6blvBceygwXChVKAuUtEyOf2QKBgQDaKC76PlG+p61DIwfIJIcP6JgzWVXj7gJr82hpu8NIf0Wz354eYRl1gdW6dkgpkPhnDvZ/b23P5FsWG8OR0f0VMgPvKVDo+Z+cHLsoroqeCw7B1MEdv2d69gbAk343BTVkTui94152GeCu3O/C0QmaZyqOtumEbxDl8K+lsusEkwKBgQDAI7XzXx+EqKD1m2DKnj2YILEplB4pmJnTWaZi5qAKO+XxbUTGcSxRALBYxuMEvd2AIEk9VhQiLpJ9DoOzVg5LY/zeRvK1vE2tUj/cx8X8jekdY7QayP6KigWbe3juqBHm9eD97wwmQgbFRg+ZZrpKhENym4BVqCuJwc7nC02/3wKBgFIvCyuIqKDraBE/tCHI6PysQhIuGHZKZq0mQHJ8op/AGpEdr+J/7+hdphedkaffDkU81M3DO5oyy8GzaeSYOABxHBxP80QhLejQxg0YW+4X+lI5BRtgzOn8nySTK9wsYSXNuE44xpA1RXh6kPRSbYy2SskCzUvvz2zgVDtXAMRzAoGABItTrFPdnPeYBvcLzP79GfH7/q3AIN+5E6SVKNWnh1ZvU8xvyfm3QJsxkIfzqpMLABLDaK32f/B2CnsjZkRsxh+xRViMOPwhIi5F0GTxK833a3iGM/P5ATHOfCTpcUuMUNgT4C2dLfJ10oibqdciJM0IA1fmKyB1Fyb8S76asiUCgYEAu6ZQ5BfxtbhZCjZ7/hYKHuzDjRzyiaBkKjtN5ZvqLgkG6Zdfjrm2/RcFCMVtqZKXcgVcD9yxy561fmS+5gE3yTfKiFcYoYITT/N26MJ5G7Qeb/FPpmDRVQGjCaAw0o8dvaqe3pUEROdYX+JVQMxQ4WOPiV45FXazAZtFNr8Z+xA=-----END PRIVATE KEY-----"
}
}

View File

@ -439,7 +439,7 @@ namespace ZR.CodeGenerator
TableName = tableName, TableName = tableName,
TableComment = desc, TableComment = desc,
FunctionName = desc, FunctionName = desc,
Create_by = userName, Create_name = userName,
Options = new Options() Options = new Options()
{ {
SortType = "asc", SortType = "asc",

View File

@ -23,7 +23,7 @@ namespace ZR.Model.System.Dto
{ {
public string NoticeTitle { get; set; } public string NoticeTitle { get; set; }
public int? NoticeType { get; set; } public int? NoticeType { get; set; }
public string CreateBy { get; set; } public string CreateName { get; set; }
public int? Status { get; set; } public int? Status { get; set; }
} }
} }

View File

@ -11,11 +11,16 @@ namespace ZR.Model.System
/// <summary> /// <summary>
/// 创建人 /// 创建人
/// </summary> /// </summary>
[SugarColumn(IsOnlyIgnoreUpdate = true, Length = 64, IsNullable = true)] [SugarColumn(IsOnlyIgnoreUpdate = true)]
[JsonProperty(propertyName: "CreateBy")] [JsonProperty(propertyName: "CreateBy")]
[ExcelIgnore] [ExcelIgnore]
public string Create_by { get; set; } public long Create_by { get; set; }
[SugarColumn(IsOnlyIgnoreUpdate = true)]
[JsonProperty(propertyName: "CreateName")]
[ExcelIgnore]
public string Create_name { get; set; }
/// <summary> /// <summary>
/// 创建时间 /// 创建时间
/// </summary> /// </summary>
@ -29,10 +34,16 @@ namespace ZR.Model.System
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
[JsonProperty(propertyName: "UpdateBy")] [JsonProperty(propertyName: "UpdateBy")]
[SugarColumn(IsOnlyIgnoreInsert = true, Length = 64, IsNullable = true)] [SugarColumn(IsOnlyIgnoreInsert = true)]
[ExcelIgnore] [ExcelIgnore]
public string Update_by { get; set; } public long Update_by { get; set; }
[JsonIgnore]
[JsonProperty(propertyName: "UpdateName")]
[SugarColumn(IsOnlyIgnoreInsert = true)]
[ExcelIgnore]
public string Update_name { get; set; }
/// <summary> /// <summary>
/// 更新时间 /// 更新时间
/// </summary> /// </summary>

View File

@ -8,7 +8,7 @@ namespace ZR.Model.System
/// </summary> /// </summary>
[SugarTable("sys_role_menu", "角色菜单")] [SugarTable("sys_role_menu", "角色菜单")]
[Tenant("0")] [Tenant("0")]
public class SysRoleMenu : SysBase public class SysRoleMenu
{ {
[JsonProperty("roleId")] [JsonProperty("roleId")]
[SugarColumn(IsPrimaryKey = true, ExtendedAttribute = ProteryConstant.NOTNULL)] [SugarColumn(IsPrimaryKey = true, ExtendedAttribute = ProteryConstant.NOTNULL)]

View File

@ -606,7 +606,7 @@ namespace ZR.Service
Visible = "0", Visible = "0",
Status = "0", Status = "0",
Icon = "icon1", Icon = "icon1",
Create_by = "system", Create_name = "system"
}; };
menu.MenuId = AddMenu(menu); menu.MenuId = AddMenu(menu);
} }

View File

@ -38,9 +38,11 @@ namespace ZR.Service.System
{ {
var predicate = Expressionable.Create<SysNotice>(); var predicate = Expressionable.Create<SysNotice>();
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.NoticeTitle), m => m.NoticeTitle.Contains(parm.NoticeTitle)); predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.NoticeTitle),
m => m.NoticeTitle.Contains(parm.NoticeTitle));
predicate = predicate.AndIF(parm.NoticeType != null, m => m.NoticeType == parm.NoticeType); predicate = predicate.AndIF(parm.NoticeType != null, m => m.NoticeType == parm.NoticeType);
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CreateBy), m => m.Create_by.Contains(parm.CreateBy) || m.Update_by.Contains(parm.CreateBy)); predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CreateName),
m => m.Create_name.Contains(parm.CreateName) || m.Update_name.Contains(parm.CreateName));
predicate = predicate.AndIF(parm.Status != null, m => m.Status == parm.Status); predicate = predicate.AndIF(parm.Status != null, m => m.Status == parm.Status);
var response = GetPages(predicate.ToExpression(), parm); var response = GetPages(predicate.ToExpression(), parm);
return response; return response;

View File

@ -224,8 +224,6 @@ namespace ZR.Service
{ {
Menu_id = item, Menu_id = item,
Role_id = sysRoleDto.RoleId, Role_id = sysRoleDto.RoleId,
Create_by = sysRoleDto.Create_by,
Create_time = DateTime.Now
}; };
sysRoleMenus.Add(rm); sysRoleMenus.Add(rm);
} }