Compare commits

..

No commits in common. "6238361bd206dfe3e8503d96809a0211fe780a13" and "8c884b326984664ec3a055380faa4091eb2a8e45" have entirely different histories.

13 changed files with 71 additions and 19088 deletions

View File

@ -1,6 +1,5 @@
using EntityFramework.Exceptions.SqlServer;
using IRaCIS.Core.Application.Triggers;
using IRaCIS.Core.Application.Triggers.AfterSaveTrigger;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infra.EFCore;
using IRaCIS.Core.Infra.EFCore.Interceptor;
@ -81,9 +80,6 @@ namespace IRaCIS.Core.API
triggerOptions.AddTrigger<UserLogTrigger>();
triggerOptions.AddTrigger<UserAddTrigger>();
triggerOptions.AddTrigger<UserLogAfterTrigger>();
});

View File

@ -4245,13 +4245,6 @@
<param name="calculateType"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.MRIPDFFCalculateService.GetFatFractionAvg(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
获取脂肪分数平均值
</summary>
<param name="inDto"></param>
<returns></returns>
</member>
<member name="M:IRaCIS.Core.Application.Service.ReadingCalculate.MRIPDFFCalculateService.CalculateAvg(IRaCIS.Core.Application.Service.Reading.Dto.ReadingCalculateDto)">
<summary>
计算平均值
@ -14051,11 +14044,6 @@
检查日期
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.TableMarkInfo.RowId">
<summary>
表格问题标记
</summary>
</member>
<member name="P:IRaCIS.Core.Application.ViewModel.IRECISTTargetLesionDto.NotExistsTargetLesion">
<summary>
基线未选择任何靶病灶

View File

@ -15,19 +15,23 @@ namespace IRaCIS.Core.Application.ViewModel
public string LoginFaildName { get; set; }
public int OptType { get; set; }
public string? ActionUserName { get; set; }
public UserTypeEnum? ActionUserTypeEnum { get; set; }
public string? LoginUserName { get; set; }
public UserTypeEnum? LoginUserTypeEnum { get; set; }
public DateTime CreateTime { get; set; }
public Guid CreateUserId { get; set; }
public string TargetIdentityUserName { get; set; }
public string? OptUserName { get; set; }
public UserTypeEnum? OptUserTypeEnum { get; set; }
public UserLogJsonObj JsonObj { get; set; }
public Guid? LoginUserId { get; set; }
public Guid? OptUserId { get; set; }
public string IPRegion { get; set; }
}

View File

@ -1,11 +1,9 @@
using DocumentFormat.OpenXml.Spreadsheet;
using DocumentFormat.OpenXml.Wordprocessing;
using DocumentFormat.OpenXml.Wordprocessing;
using IP2Region.Net.Abstractions;
using IRaCIS.Application.Contracts;
using IRaCIS.Core.Application.Auth;
using IRaCIS.Core.Application.Contracts;
using IRaCIS.Core.Application.Helper;
using IRaCIS.Core.Application.Service.OAuth;
using IRaCIS.Core.Application.ViewModel;
using IRaCIS.Core.Domain.Share;
using IRaCIS.Core.Infrastructure;
@ -204,8 +202,7 @@ namespace IRaCIS.Core.Application.Service
//删除验证码历史记录
await _verificationCodeRepository.BatchDeleteNoTrackingAsync(t => t.UserId == _userInfo.UserRoleId && t.CodeType == 0);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true);
return ResponseOutput.Ok();
@ -225,8 +222,7 @@ namespace IRaCIS.Core.Application.Service
Phone = newPhone
});
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true);
return ResponseOutput.Ok();
}
@ -243,8 +239,7 @@ namespace IRaCIS.Core.Application.Service
UserName = newUserName
});
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true);
return ResponseOutput.Ok();
}
@ -272,7 +267,7 @@ namespace IRaCIS.Core.Application.Service
}, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.UpdateUser }, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.UpdateUser }, true);
return ResponseOutput.Ok();
}
@ -303,7 +298,7 @@ namespace IRaCIS.Core.Application.Service
await _fusionCache.RemoveAsync(CacheKeys.UserLoginError(userName));
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.ResetPassword }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = userId, OptType = UserOptType.ResetPassword }, true);
return ResponseOutput.Ok();
}
@ -413,8 +408,7 @@ namespace IRaCIS.Core.Application.Service
IsFirstAdd = false
});
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = identityUserId, OptType = UserOptType.LoginModifyPassword }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = userId, OptUserId = userId, LoginPassword = newPwd, OptType = UserOptType.UnloginModifyPasswoed }, true);
return ResponseOutput.Result(success);
@ -450,7 +444,7 @@ namespace IRaCIS.Core.Application.Service
IsFirstAdd = false
});
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = _userInfo.IdentityUserId, OptType = UserOptType.LoginModifyPassword }, true);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.UserRoleId, OptUserId = _userInfo.UserRoleId, OptType = UserOptType.LoginModifyPassword }, true);
return ResponseOutput.Result(success);
@ -567,11 +561,9 @@ namespace IRaCIS.Core.Application.Service
var success = await _identityUserRepository.SaveChangesAsync();
}
await _mailVerificationService.AddUserSendEmailAsync(saveItem.Id, userAddModel.BaseUrl, userAddModel.RouteUrl);
return ResponseOutput.Ok(new UserAddedReturnDTO { Id = saveItem.Id, UserCode = saveItem.UserCode });
}
@ -599,7 +591,7 @@ namespace IRaCIS.Core.Application.Service
if (user.Status != model.Status)
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, OptType = model.Status == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = _userInfo.Id, OptUserId = model.Id, OptType = model.Status == UserStateEnum.Enable ? UserOptType.AccountEnable : UserOptType.AccountLocked }, true);
}
@ -639,9 +631,6 @@ namespace IRaCIS.Core.Application.Service
var success = await _userRoleRepository.SaveChangesAsync();
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = model.Id, OptType = UserOptType.UpdateUser }, true);
return ResponseOutput.Ok(success);
}
@ -654,12 +643,13 @@ namespace IRaCIS.Core.Application.Service
var user = await _identityUserRepository.Where(t => t.Id == command.Id, true).FirstOrDefaultAsync();
if (user == null) return Null404NotFound(user);
_mapper.Map(command, user);
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = command.Id, OptType = UserOptType.UpdateUser }, true);
await _identityUserRepository.SaveChangesAsync();
return ResponseOutput.Ok();
}
[HttpPut]
@ -692,7 +682,6 @@ namespace IRaCIS.Core.Application.Service
var success = await _userRoleRepository.SaveChangesAsync();
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, TargetIdentityUserId = command.Id, OptType = UserOptType.UpdateUserRole }, true);
return ResponseOutput.Ok();
}
@ -906,17 +895,17 @@ namespace IRaCIS.Core.Application.Service
var userLogQueryable =
_userLogRepository.AsQueryable().IgnoreQueryFilters()
.WhereIf(inQuery.TrialId != null, t => t.CreateUserRole.UserRoleTrials.Any(c => c.TrialId == inQuery.TrialId && (c.UserId == t.LoginUserId || c.UserId == t.OptUserId)))
.WhereIf(inQuery.TrialId != null, t => t.LoginUser.UserRoleTrials.Any(c => c.TrialId == inQuery.TrialId && (c.UserId == t.LoginUserId || c.UserId == t.OptUserId)))
.WhereIf(trialCreateTime != null, t => t.CreateTime >= trialCreateTime)
.WhereIf(inQuery.OptType != null, t => t.OptType == inQuery.OptType)
.WhereIf(inQuery.UserId != null, t => t.LoginUserId == inQuery.UserId)
.WhereIf(inQuery.BeginDate != null, t => t.CreateTime >= inQuery.BeginDate)
.WhereIf(inQuery.EndDate != null, t => t.CreateTime <= inQuery.EndDate)
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.CreateUserRole.UserName.Contains(inQuery.LoginUserName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginUserName), t => t.LoginUser.UserName.Contains(inQuery.LoginUserName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.LoginFaildName), t => t.LoginFaildName.Contains(inQuery.LoginFaildName!))
.WhereIf(!string.IsNullOrEmpty(inQuery.IP), t => t.IP.Contains(inQuery.IP!))
.WhereIf(inQuery.LoginUserTypeEnum != null, t => t.CreateUserRole.UserTypeEnum == inQuery.LoginUserTypeEnum)
.WhereIf(inQuery.UserTypeId != null, t => t.CreateUserRole.UserTypeId == inQuery.UserTypeId)
.WhereIf(inQuery.LoginUserTypeEnum != null, t => t.LoginUser.UserTypeEnum == inQuery.LoginUserTypeEnum)
.WhereIf(inQuery.UserTypeId != null, t => t.LoginUser.UserTypeId == inQuery.UserTypeId)
.ProjectTo<UserLogView>(_mapper.ConfigurationProvider);
@ -927,14 +916,10 @@ namespace IRaCIS.Core.Application.Service
[AllowAnonymous]
[HttpGet]
public async Task<IResponseOutput> LoginOut(Guid identityUserId, Guid userRoleId)
public async Task<IResponseOutput> LoginOut(Guid identityUserId)
{
await _fusionCache.RemoveAsync(CacheKeys.UserToken(identityUserId));
var userName = await _userRoleRepository.Where(t => t.Id == userRoleId).Select(t => t.IdentityUser.UserName).FirstOrDefaultAsync();
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = identityUserId, ActionUserName = userName, OptType = UserOptType.LoginOut }, true);
return ResponseOutput.Ok();
}
@ -981,7 +966,7 @@ namespace IRaCIS.Core.Application.Service
if (failCount >= maxFailures)
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountLocked }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = Guid.Empty, OptUserId = Guid.Empty, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountLocked }, true);
//$"密码连续错误{maxFailures}次,当前账号已被限制登录,请等待 {lockoutMinutes} 分钟后再试。"
throw new BusinessValidationFailedException(_localizer["User_ErrorLimit", maxFailures, lockoutMinutes]);
@ -1001,7 +986,7 @@ namespace IRaCIS.Core.Application.Service
var errorPwdUserId = await _identityUserRepository.Where(u => u.UserName == userName).Select(t => t.Id).FirstOrDefaultAsync();
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionUserName = userName, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = errorPwdUserId, OptUserId = errorPwdUserId, LoginFaildName = userName, LoginPassword = password, OptType = UserOptType.AccountOrPasswordError }, true);
return ResponseOutput.NotOk(_localizer["User_CheckNameOrPw"], new IRCLoginReturnDTO());
@ -1009,7 +994,7 @@ namespace IRaCIS.Core.Application.Service
if (loginUser.Status == 0)
{
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, LoginFaildName = userName, OptType = UserOptType.LoginLockedAccount }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, OptUserId = loginUser.Id, LoginFaildName = userName, OptType = UserOptType.LoginLockedAccount }, true);
//---该用户已经被禁用。
return ResponseOutput.NotOk(_localizer["User_Disabled"], new IRCLoginReturnDTO());
@ -1036,7 +1021,7 @@ namespace IRaCIS.Core.Application.Service
loginUser.LoginState = 1;
}
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = loginUser.IdentityUserId, OptType = UserOptType.Login }, true);
//await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, LoginUserId = loginUser.Id, OptUserId = loginUser.Id, OptType = UserOptType.Login }, true);
userLoginReturnModel.BasicInfo = loginUser;
@ -1131,9 +1116,8 @@ namespace IRaCIS.Core.Application.Service
PermissionStr = t.UserTypeRole.PermissionStr,
UserName = t.UserName,
UserTypeShortName = t.UserTypeRole.UserTypeShortName,
}).FirstOrDefaultAsync();
await _userLogRepository.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = userTokenInfo.IdentityUserId, ActionUserName = userTokenInfo.UserName, OptType = UserOptType.LoginSelectRole }, true);
}).FirstOrDefaultAsync();
if (userTokenInfo != null)
{

View File

@ -93,7 +93,7 @@ namespace IRaCIS.Core.Application.Service
CreateMap<IdentityUser, UserDetailDTO>();
var token = string.Empty;
var token = string.Empty;
var userId = Guid.Empty;
CreateMap<SystemNotice, SystemNoticeView>()
.ForMember(t => t.PublishUserName, d => d.MapFrom(t => t.PublishedUser.UserName))
@ -123,8 +123,11 @@ namespace IRaCIS.Core.Application.Service
CreateMap<UserLog, UserLogView>()
.ForMember(d => d.TargetIdentityUserName, c => c.MapFrom(t => t.TargetIdentityUser.UserName))
.ForMember(d => d.ActionUserTypeEnum, c => c.MapFrom(t => t.CreateUserRole.UserTypeEnum));
.ForMember(d => d.LoginUserName, c => c.MapFrom(t => t.LoginUser.UserName))
.ForMember(d => d.LoginUserTypeEnum, c => c.MapFrom(t => t.LoginUser.UserTypeEnum))
.ForMember(d => d.OptUserName, c => c.MapFrom(t => t.OptUser.UserName))
.ForMember(d => d.OptUserTypeEnum, c => c.MapFrom(t => t.OptUser.UserTypeEnum))
;
CreateMap<UserFeedBack, UserFeedBackView>()
@ -154,18 +157,16 @@ namespace IRaCIS.Core.Application.Service
.ForMember(d => d.IdentityUserId, c => c.MapFrom(t => t.Id));
CreateMap<IdentityUser, UserListDTO>();
CreateMap<UserAddUserType, UserRole>().ReverseMap();
CreateMap<UserAddUserType, UserRole> ().ReverseMap();
CreateMap<UserRole, IdentityUserTypeDTO>()
.ForMember(d => d.UserTypeShortName, c => c.MapFrom(t => t.UserTypeRole.UserTypeShortName));
CreateMap<UserBasicInfoCommand, IdentityUser>();
CreateMap<UserRole, IdentityUser>();
CreateMap<UserCommand, UserRole>();
}
}

View File

@ -1,52 +0,0 @@
using AutoMapper.QueryableExtensions;
using EntityFrameworkCore.Triggered;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace IRaCIS.Core.Application.Triggers.AfterSaveTrigger
{
public class UserLogAfterTrigger(IRepository<IdentityUser> _identityUserRepository) : IAfterSaveTrigger<UserLog>
{
public async Task AfterSave(ITriggerContext<UserLog> context, CancellationToken cancellationToken)
{
var userlog = context.Entity;
if (context.ChangeType == ChangeType.Added)
{
if (userlog.TargetIdentityUserId != null)
{
var obj = await _identityUserRepository.Where(t => t.Id == userlog.TargetIdentityUserId).Select(t => new UserLogJsonObj()
{
DepartmentName = t.DepartmentName,
EMail = t.EMail,
FirstName = t.FirstName,
LastName = t.LastName,
OrganizationName = t.OrganizationName,
Phone = t.Phone,
PositionName = t.PositionName,
Sex = t.Sex,
Status = t.Status,
UserCode = t.UserCode,
UserName = t.UserName,
UserRoleList = t.UserRoleList.Select(t => new UserRoleLogObj()
{
IsUserRoleDisabled = t.IsUserRoleDisabled,
UserTypeEnum = t.UserTypeEnum,
UserTypeShortName = t.UserTypeRole.UserTypeShortName
}).ToList()
}).FirstOrDefaultAsync();
userlog.JsonObj = obj;
await _identityUserRepository.SaveChangesAsync();
}
}
}
}
}

View File

@ -28,16 +28,15 @@ namespace IRaCIS.Core.Application.Triggers
}
public class UserAddTrigger(IUserInfo _userInfo, IRepository<UserLog> _userLogReposiotry) : IBeforeSaveTrigger<IdentityUser>
public class UserAddTrigger(IUserInfo _userInfo, IRepository<UserLog> _userLogReposiotry) : IBeforeSaveTrigger<UserRole>
{
public async Task BeforeSave(ITriggerContext<IdentityUser> context, CancellationToken cancellationToken)
public async Task BeforeSave(ITriggerContext<UserRole> context, CancellationToken cancellationToken)
{
var user = context.Entity;
if (context.ChangeType == ChangeType.Added)
{
await _userLogReposiotry.AddAsync(new UserLog() { IP = _userInfo.IP, ActionIdentityUserId = _userInfo.IdentityUserId, ActionUserName = _userInfo.UserName, OptType = UserOptType.AddUser }, true);
await _userLogReposiotry.AddAsync(new UserLog() { OptType = UserOptType.AddUser, OptUserId = user.Id, LoginUserId = _userInfo.UserRoleId, IP = _userInfo.IP });
}

View File

@ -14,13 +14,6 @@ public enum UserOptType
[Description("用户登录")]
Login = 1,
[Description("选择登录角色")]
LoginSelectRole =11,
[Description("更新用户角色")]
UpdateUserRole =15,
[Description("用户登出")]
LoginOut = 2,

View File

@ -8,8 +8,10 @@ public class UserLog : BaseAddAuditEntity
{
#region 导航属性
[JsonIgnore]
public IdentityUser TargetIdentityUser { get; set; }
public UserRole LoginUser { get; set; }
[JsonIgnore]
public UserRole OptUser { get; set; }
#endregion
public string IP { get; set; } = string.Empty;
@ -22,61 +24,20 @@ public class UserLog : BaseAddAuditEntity
#region 账号修改 维护
public Guid? ActionIdentityUserId { get; set; }
//public Guid? LoginIdentityUserId { get; set; }
public string ActionUserName { get; set; }
//public string LoginUserName { get; set; }
[MaxLength]
public UserLogJsonObj JsonObj { get; set; }
//public UserTypeEnum loginUserType { get; set; }
[Comment("被操作的对象 admin 修改张三信息 张三是被操作对象")]
public Guid? TargetIdentityUserId { get; set; }
#endregion
[Comment("后续删除")]
public Guid? LoginUserId { get; set; }
[Comment("被操作的人,自己操作的就是自己--后续删除")]
[Comment("被操作的人,自己操作的就是自己")]
public Guid? OptUserId { get; set; }
}
public class UserLogJsonObj
{
public string FullName => LastName + " / " + FirstName;
public string UserCode { get; set; }
public string UserName { get; set; }
public string EMail { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Phone { get; set; }
public int? Sex { get; set; }
public UserStateEnum Status { get; set; } = UserStateEnum.Enable;
public string OrganizationName { get; set; }
public string PositionName { get; set; }
public string DepartmentName { get; set; }
[NotMapped]
public List<UserRoleLogObj> UserRoleList { get; set; }
}
public class UserRoleLogObj
{
public string UserTypeShortName { get; set; }
public UserTypeEnum UserTypeEnum { get; set; }
public bool IsUserRoleDisabled { get; set; }
}

View File

@ -63,15 +63,6 @@ public class IRaCISDBContext : DbContext
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<UserLog>(entity =>
{
entity.OwnsOne(x => x.JsonObj, ownedNavigationBuilder =>
{
ownedNavigationBuilder.ToJson();
});
});
modelBuilder.Entity<TestLength>(entity =>
{
// 使用部分加密值转换器,前 2 个字符不加密,方便模糊搜索
@ -156,7 +147,7 @@ public class IRaCISDBContext : DbContext
//软删除筛选器通常依赖于实体模型的完整定义(例如属性映射、继承关系等)
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
@ -182,7 +173,7 @@ public class IRaCISDBContext : DbContext
{
if (navigation.IsCollection) continue;
#region 有问题
// 比如 e.SourceSubjectVisit.IsDeleted == False 还会导致 dicom 查询增加额外很多的连表 因为访视 项目 项目中心dicom 都是软删除
//
@ -643,7 +634,7 @@ public class IRaCISDBContext : DbContext
public virtual DbSet<TrialIdentityUser> TrialIdentityUser { get; set; }
}

File diff suppressed because it is too large Load Diff

View File

@ -1,223 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace IRaCIS.Core.Infra.EFCore.Migrations
{
/// <inheritdoc />
public partial class UserlogModifg7 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserLog_User_LoginUserId",
table: "UserLog");
migrationBuilder.DropForeignKey(
name: "FK_UserLog_User_OptUserId",
table: "UserLog");
//migrationBuilder.DropIndex(
// name: "IX_UserLog_LoginUserId",
// table: "UserLog");
//migrationBuilder.DropIndex(
// name: "IX_UserLog_OptUserId",
// table: "UserLog");
migrationBuilder.AlterColumn<Guid>(
name: "OptUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true,
comment: "被操作的人,自己操作的就是自己--后续删除",
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true,
oldComment: "被操作的人,自己操作的就是自己");
//migrationBuilder.AlterColumn<Guid>(
// name: "LoginUserId",
// table: "UserLog",
// type: "uniqueidentifier",
// nullable: true,
// comment: "后续删除",
// oldClrType: typeof(Guid),
// oldType: "uniqueidentifier",
// oldNullable: true);
migrationBuilder.AddColumn<Guid>(
name: "ActionIdentityUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "ActionUserName",
table: "UserLog",
type: "nvarchar(400)",
maxLength: 400,
nullable: false,
defaultValue: "");
//migrationBuilder.AddColumn<string>(
// name: "JsonObj",
// table: "UserLog",
// type: "nvarchar(max)",
// nullable: false,
// defaultValue: "");
migrationBuilder.AddColumn<Guid>(
name: "TargetIdentityUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true,
comment: "被操作的对象 admin 修改张三信息 张三是被操作对象");
//migrationBuilder.AlterColumn<Guid>(
// name: "SystemUserId",
// table: "TrialSiteUserSurvey",
// type: "uniqueidentifier",
// nullable: true,
// comment: "IdentityUser 表的用户Id",
// oldClrType: typeof(Guid),
// oldType: "uniqueidentifier",
// oldNullable: true);
//migrationBuilder.AlterColumn<Guid>(
// name: "SystemUserId",
// table: "TrialExternalUser",
// type: "uniqueidentifier",
// nullable: false,
// comment: "IdentityUser 表的用户Id",
// oldClrType: typeof(Guid),
// oldType: "uniqueidentifier");
//migrationBuilder.AlterColumn<bool>(
// name: "AutoCutNextTask",
// table: "IdentityUser",
// type: "bit",
// nullable: false,
// comment: "这个字段废除,放在用户角色上面,后续删除",
// oldClrType: typeof(bool),
// oldType: "bit",
// oldComment: "自动切换下一个任务");
//migrationBuilder.CreateIndex(
// name: "IX_UserLog_TargetIdentityUserId",
// table: "UserLog",
// column: "TargetIdentityUserId");
//migrationBuilder.AddForeignKey(
// name: "FK_UserLog_IdentityUser_TargetIdentityUserId",
// table: "UserLog",
// column: "TargetIdentityUserId",
// principalTable: "IdentityUser",
// principalColumn: "Id");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_UserLog_IdentityUser_TargetIdentityUserId",
table: "UserLog");
migrationBuilder.DropIndex(
name: "IX_UserLog_TargetIdentityUserId",
table: "UserLog");
migrationBuilder.DropColumn(
name: "ActionIdentityUserId",
table: "UserLog");
migrationBuilder.DropColumn(
name: "ActionUserName",
table: "UserLog");
migrationBuilder.DropColumn(
name: "JsonObj",
table: "UserLog");
migrationBuilder.DropColumn(
name: "TargetIdentityUserId",
table: "UserLog");
migrationBuilder.AlterColumn<Guid>(
name: "OptUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true,
comment: "被操作的人,自己操作的就是自己",
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true,
oldComment: "被操作的人,自己操作的就是自己--后续删除");
migrationBuilder.AlterColumn<Guid>(
name: "LoginUserId",
table: "UserLog",
type: "uniqueidentifier",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true,
oldComment: "后续删除");
migrationBuilder.AlterColumn<Guid>(
name: "SystemUserId",
table: "TrialSiteUserSurvey",
type: "uniqueidentifier",
nullable: true,
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldNullable: true,
oldComment: "IdentityUser 表的用户Id");
migrationBuilder.AlterColumn<Guid>(
name: "SystemUserId",
table: "TrialExternalUser",
type: "uniqueidentifier",
nullable: false,
oldClrType: typeof(Guid),
oldType: "uniqueidentifier",
oldComment: "IdentityUser 表的用户Id");
migrationBuilder.AlterColumn<bool>(
name: "AutoCutNextTask",
table: "IdentityUser",
type: "bit",
nullable: false,
comment: "自动切换下一个任务",
oldClrType: typeof(bool),
oldType: "bit",
oldComment: "这个字段废除,放在用户角色上面,后续删除");
migrationBuilder.CreateIndex(
name: "IX_UserLog_LoginUserId",
table: "UserLog",
column: "LoginUserId");
migrationBuilder.CreateIndex(
name: "IX_UserLog_OptUserId",
table: "UserLog",
column: "OptUserId");
migrationBuilder.AddForeignKey(
name: "FK_UserLog_User_LoginUserId",
table: "UserLog",
column: "LoginUserId",
principalTable: "User",
principalColumn: "Id");
migrationBuilder.AddForeignKey(
name: "FK_UserLog_User_OptUserId",
table: "UserLog",
column: "OptUserId",
principalTable: "User",
principalColumn: "Id");
}
}
}

View File

@ -2704,7 +2704,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<bool>("AutoCutNextTask")
.HasColumnType("bit")
.HasComment("这个字段废除,放在用户角色上面,后续删除");
.HasComment("自动切换下一个任务");
b.Property<int>("Code")
.HasColumnType("int");
@ -11676,8 +11676,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)");
b.Property<Guid>("SystemUserId")
.HasColumnType("uniqueidentifier")
.HasComment("IdentityUser 表的用户Id");
.HasColumnType("uniqueidentifier");
b.Property<Guid>("TrialId")
.HasColumnType("uniqueidentifier");
@ -12586,8 +12585,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)");
b.Property<Guid?>("SystemUserId")
.HasColumnType("uniqueidentifier")
.HasComment("IdentityUser 表的用户Id");
.HasColumnType("uniqueidentifier");
b.Property<int?>("TrialRoleCode")
.HasColumnType("int");
@ -12941,14 +12939,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Property<Guid>("Id")
.HasColumnType("uniqueidentifier");
b.Property<Guid?>("ActionIdentityUserId")
.HasColumnType("uniqueidentifier");
b.Property<string>("ActionUserName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b.Property<DateTime>("CreateTime")
.HasColumnType("datetime2");
@ -12976,25 +12966,22 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.HasColumnType("nvarchar(400)");
b.Property<Guid?>("LoginUserId")
.HasColumnType("uniqueidentifier")
.HasComment("后续删除");
.HasColumnType("uniqueidentifier");
b.Property<int>("OptType")
.HasColumnType("int");
b.Property<Guid?>("OptUserId")
.HasColumnType("uniqueidentifier")
.HasComment("被操作的人,自己操作的就是自己--后续删除");
b.Property<Guid?>("TargetIdentityUserId")
.HasColumnType("uniqueidentifier")
.HasComment("被操作的对象 admin 修改张三信息 张三是被操作对象");
.HasComment("被操作的人,自己操作的就是自己");
b.HasKey("Id");
b.HasIndex("CreateUserId");
b.HasIndex("TargetIdentityUserId");
b.HasIndex("LoginUserId");
b.HasIndex("OptUserId");
b.ToTable("UserLog", t =>
{
@ -17759,82 +17746,19 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "TargetIdentityUser")
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "LoginUser")
.WithMany()
.HasForeignKey("TargetIdentityUserId");
.HasForeignKey("LoginUserId");
b.OwnsOne("IRaCIS.Core.Domain.Models.UserLogJsonObj", "JsonObj", b1 =>
{
b1.Property<Guid>("UserLogId")
.HasColumnType("uniqueidentifier");
b1.Property<string>("DepartmentName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("EMail")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("FirstName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("LastName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("OrganizationName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("Phone")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("PositionName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<int?>("Sex")
.HasColumnType("int");
b1.Property<int>("Status")
.HasColumnType("int");
b1.Property<string>("UserCode")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.Property<string>("UserName")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("nvarchar(400)");
b1.HasKey("UserLogId");
b1.ToTable("UserLog");
b1.ToJson("JsonObj");
b1.WithOwner()
.HasForeignKey("UserLogId");
});
b.HasOne("IRaCIS.Core.Domain.Models.UserRole", "OptUser")
.WithMany()
.HasForeignKey("OptUserId");
b.Navigation("CreateUserRole");
b.Navigation("JsonObj")
.IsRequired();
b.Navigation("LoginUser");
b.Navigation("TargetIdentityUser");
b.Navigation("OptUser");
});
modelBuilder.Entity("IRaCIS.Core.Domain.Models.UserPassWordLog", b =>
@ -17857,7 +17781,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
.IsRequired();
b.HasOne("IRaCIS.Core.Domain.Models.Doctor", null)
.WithOne("UserRole")
.WithOne("User")
.HasForeignKey("IRaCIS.Core.Domain.Models.UserRole", "DoctorId");
b.HasOne("IRaCIS.Core.Domain.Models.IdentityUser", "IdentityUser")
@ -18208,7 +18132,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
b.Navigation("TrialExperienceCriteriaList");
b.Navigation("UserRole")
b.Navigation("User")
.IsRequired();
});