diff --git a/YD_Event.Application/Role/Dtos/AddSysRoleInput.cs b/YD_Event.Application/Role/Dtos/AddSysRoleInput.cs
index 20d142b..c6fc55a 100644
--- a/YD_Event.Application/Role/Dtos/AddSysRoleInput.cs
+++ b/YD_Event.Application/Role/Dtos/AddSysRoleInput.cs
@@ -1,4 +1,7 @@
-namespace YD_Event.Application.Role.Dtos;
+using System.ComponentModel.DataAnnotations;
+using YD_Event.Core.Enum;
+
+namespace YD_Event.Application.Role.Dtos;
public class AddSysRoleInput
{
@@ -9,23 +12,6 @@ public class AddSysRoleInput
[MaxLength(32, ErrorMessage = "角色名称限制32个字符内")]
public string Name { get; set; }
- ///
- /// 状态
- ///
- public AvailabilityStatus Status { get; set; }
-
- ///
- /// 角色编码
- ///
- [Required(ErrorMessage = "角色编码为必填项")]
- [MaxLength(32, ErrorMessage = "角色名称限制32个字符内")]
- public string Code { get; set; }
-
- ///
- /// 排序值
- ///
- public int Sort { get; set; }
-
///
/// 备注
///
@@ -33,8 +19,12 @@ public class AddSysRoleInput
public string Remark { get; set; }
///
- /// 授权按钮菜单Id
+ /// 排序
///
- [Required(ErrorMessage = "请为角色分配权限")]
- public List Menus { get; set; }
-}
\ No newline at end of file
+ public int Sort { get; set; } = 100;
+
+ ///
+ /// 状态
+ ///
+ public AvailabilityStatus Status { get; set; } = AvailabilityStatus.Enable;
+}
diff --git a/YD_Event.Application/Role/Dtos/GrantRolePermissionInput.cs b/YD_Event.Application/Role/Dtos/GrantRolePermissionInput.cs
new file mode 100644
index 0000000..2140acc
--- /dev/null
+++ b/YD_Event.Application/Role/Dtos/GrantRolePermissionInput.cs
@@ -0,0 +1,18 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace YD_Event.Application.Role.Dtos;
+
+public class GrantRolePermissionInput
+{
+ ///
+ /// 角色ID
+ ///
+ [Required(ErrorMessage = "角色ID不能为空")]
+ public long Id { get; set; }
+
+ ///
+ /// 菜单ID集合
+ ///
+ [Required(ErrorMessage = "请选择权限")]
+ public List MenuIds { get; set; }
+}
diff --git a/YD_Event.Application/Role/Dtos/UpdateSysRoleInput.cs b/YD_Event.Application/Role/Dtos/UpdateSysRoleInput.cs
index 2ad0b50..bbfe85c 100644
--- a/YD_Event.Application/Role/Dtos/UpdateSysRoleInput.cs
+++ b/YD_Event.Application/Role/Dtos/UpdateSysRoleInput.cs
@@ -1,9 +1,12 @@
-namespace YD_Event.Application.Role.Dtos;
+using System.ComponentModel.DataAnnotations;
+
+namespace YD_Event.Application.Role.Dtos;
public class UpdateSysRoleInput : AddSysRoleInput
{
///
- /// 角色Id
+ /// 主键Id
///
+ [Required(ErrorMessage = "Id不能为空")]
public long Id { get; set; }
-}
\ No newline at end of file
+}
diff --git a/YD_Event.Application/Role/SysRoleService.cs b/YD_Event.Application/Role/SysRoleService.cs
index 51c0961..1784241 100644
--- a/YD_Event.Application/Role/SysRoleService.cs
+++ b/YD_Event.Application/Role/SysRoleService.cs
@@ -1,11 +1,12 @@
using YD_Event.Application.Role.Dtos;
+using YD_Event.Core.Shared;
namespace YD_Event.Application.Role;
///
/// 角色管理
///
-public class SysRoleService : BaseService
+public class SysRoleService : BaseService, ITransient
{
private readonly ISqlSugarRepository _sysRoleRepository;
private readonly ISqlSugarRepository _sysRoleMenuRepository;
@@ -28,7 +29,8 @@ public class SysRoleService : BaseService
///
///
///
- [HttpGet]
+ [DisplayName("角色分页查询")]
+ [HttpGet("page")]
public async Task> Page([FromQuery] SysRoleQueryInput dto)
{
return await _sysRoleRepository.AsQueryable()
@@ -52,25 +54,22 @@ public class SysRoleService : BaseService
///
///
///
- [Description("添加角色")]
+ [DisplayName("添加角色")]
[HttpPost("add")]
[UnitOfWork]
public async Task AddRole(AddSysRoleInput dto)
{
- if (await _sysRoleRepository.IsAnyAsync(x => x.Code == dto.Code))
- {
- throw Oops.Bah("角色编码已存在");
- }
-
var role = dto.Adapt();
role.Id = _idGenerator.NewLong();
- var roleMenus = dto.Menus.Select(x => new SysRoleMenu()
+ // 自动生成Code,避免重复
+ role.Code = $"Role_{role.Id}";
+
+ if (await _sysRoleRepository.IsAnyAsync(x => x.Name == dto.Name))
{
- MenuId = x,
- RoleId = role.Id
- }).ToList();
+ throw new InvalidOperationException($"角色名称 {dto.Name} 已存在");
+ }
+
await _sysRoleRepository.InsertAsync(role);
- await _sysRoleMenuRepository.InsertRangeAsync(roleMenus);
}
///
@@ -78,7 +77,7 @@ public class SysRoleService : BaseService
///
///
///
- [Description("更新角色")]
+ [DisplayName("更新角色")]
[HttpPut("edit")]
[UnitOfWork]
public async Task UpdateRole(UpdateSysRoleInput dto)
@@ -86,22 +85,42 @@ public class SysRoleService : BaseService
var sysRole = await _sysRoleRepository.GetByIdAsync(dto.Id);
if (sysRole == null)
{
- throw Oops.Bah("无效参数");
+ throw new InvalidOperationException("角色不存在");
}
- if (await _sysRoleRepository.IsAnyAsync(x => x.Id != dto.Id && x.Code == dto.Code))
+
+ if (await _sysRoleRepository.IsAnyAsync(x => x.Id != dto.Id && x.Name == dto.Name))
{
- throw Oops.Bah("角色编码已存在");
+ throw new InvalidOperationException($"角色名称 {dto.Name} 已存在");
}
dto.Adapt(sysRole);
- var roleMenus = dto.Menus.Select(x => new SysRoleMenu()
+ await _sysRoleRepository.UpdateAsync(sysRole);
+ }
+
+ ///
+ /// 授权角色权限
+ ///
+ ///
+ ///
+ [DisplayName("授权角色权限")]
+ [HttpPost("grantPermission")]
+ [UnitOfWork]
+ public async Task GrantPermission(GrantRolePermissionInput input)
+ {
+ var sysRole = await _sysRoleRepository.GetByIdAsync(input.Id);
+ if (sysRole == null) throw new InvalidOperationException("角色不存在");
+
+ var roleMenus = input.MenuIds.Select(x => new SysRoleMenu()
{
MenuId = x,
- RoleId = sysRole.Id
+ RoleId = input.Id
}).ToList();
- await _sysRoleRepository.UpdateAsync(sysRole);
- await _sysRoleMenuRepository.DeleteAsync(x => x.RoleId == sysRole.Id);
- await _sysRoleMenuRepository.InsertRangeAsync(roleMenus);
+
+ await _sysRoleMenuRepository.DeleteAsync(x => x.RoleId == input.Id);
+ if (roleMenus.Any())
+ {
+ await _sysRoleMenuRepository.InsertRangeAsync(roleMenus);
+ }
await _easyCachingProvider.RemoveByPrefixAsync(CacheConst.PermissionKey);
}
@@ -110,14 +129,16 @@ public class SysRoleService : BaseService
///
/// 角色id
///
- [Description("获取角色可访问的菜单和按钮id")]
- [HttpGet("getRuleMenu")]
- public async Task> GetRuleMenu([FromQuery] long id)
+ [DisplayName("获取角色可访问的菜单和按钮id")]
+ [HttpGet("getRoleMenu")]
+ public async Task> GetRoleMenu([FromQuery] long id)
{
- return await _sysRoleRepository.AsQueryable().InnerJoin((role, roleMenu) => role.Id == roleMenu.RoleId)
+ return await _sysRoleRepository.AsQueryable()
+ .InnerJoin((role, roleMenu) => role.Id == roleMenu.RoleId)
.InnerJoin((role, roleMenu, menu) => roleMenu.MenuId == menu.Id)
.Where((role, roleMenu, menu) => role.Id == id && menu.Status == AvailabilityStatus.Enable)
- .Select((role, roleMenu) => roleMenu.MenuId).ToListAsync();
+ .Select((role, roleMenu) => roleMenu.MenuId)
+ .ToListAsync();
}
///
@@ -125,7 +146,8 @@ public class SysRoleService : BaseService
///
///
///
- [Description("修改角色状态"), HttpPut("setStatus")]
+ [DisplayName("修改角色状态")]
+ [HttpPut("setStatus")]
public override async Task SetStatus(AvailabilityDto dto)
{
await base.SetStatus(dto);
@@ -137,10 +159,13 @@ public class SysRoleService : BaseService
///
///
///
- [Description("删除角色"), HttpDelete("delete")]
+ [DisplayName("删除角色")]
+ [HttpDelete("delete")]
public override async Task Delete(KeyDto dto)
{
await base.Delete(dto);
+ // 物理删除关联权限
+ await _sysRoleMenuRepository.DeleteAsync(x => x.RoleId == dto.Id);
await _easyCachingProvider.RemoveByPrefixAsync(CacheConst.PermissionKey);
}
@@ -148,8 +173,8 @@ public class SysRoleService : BaseService
/// 角色下拉选项
///
///
- [Description("角色下拉选项")]
- [HttpGet]
+ [DisplayName("角色下拉选项")]
+ [HttpGet("select")]
public async Task> RoleSelect()
{
return await _sysRoleRepository.AsQueryable().Where(x => x.Status == AvailabilityStatus.Enable)
@@ -161,4 +186,4 @@ public class SysRoleService : BaseService
Label = x.Name
}).ToListAsync();
}
-}
\ No newline at end of file
+}
diff --git a/YD_Event.Application/User/Dtos/AddSysUserInput.cs b/YD_Event.Application/User/Dtos/AddSysUserInput.cs
index 102ab1e..1b5d592 100644
--- a/YD_Event.Application/User/Dtos/AddSysUserInput.cs
+++ b/YD_Event.Application/User/Dtos/AddSysUserInput.cs
@@ -2,13 +2,6 @@
public class AddSysUserInput
{
- ///
- /// 用户名
- ///
- [Required(ErrorMessage = "用户名为必填项")]
- [MaxLength(32, ErrorMessage = "用户名限制32个字符内")]
- public string Account { get; set; }
-
///
/// 姓名
///
@@ -17,55 +10,20 @@ public class AddSysUserInput
public string Name { get; set; }
///
- /// 性别
+ /// 账号
///
- public Gender Gender { get; set; }
+ [Required(ErrorMessage = "账号为必填项")]
+ [MaxLength(32, ErrorMessage = "账号限制32个字符内")]
+ public string Account { get; set; }
///
- /// 组织机构id
- ///
- public long OrgId { get; set; }
-
- ///
- /// 昵称
- ///
- [DataValidation(AllowNullValue = true)]
- [MaxLength(32, ErrorMessage = "昵称限制32个字符")]
- public string NickName { get; set; }
-
- ///
- /// 生日
- ///
- public DateOnly? Birthday { get; set; }
-
- ///
- /// 手机号码
- ///
- [MaxLength(16, ErrorMessage = "手机号码限制16个字符内")]
- [DataValidation(ValidationTypes.PhoneNumber, ErrorMessage = "手机号码不合法", AllowNullValue = true)]
- public string Mobile { get; set; }
-
- ///
- /// 可用状态
- ///
- public AvailabilityStatus Status { get; set; }
-
- ///
- /// 邮箱
- ///
- [MaxLength(64, ErrorMessage = "邮箱限制64个字符内")]
- [DataValidation(ValidationTypes.EmailAddress, ErrorMessage = "邮箱地址不合法", AllowNullValue = true)]
- public string Email { get; set; }
-
- ///
- /// 备注
- ///
- [MaxLength(200, ErrorMessage = "备注限制200字符内")]
- [DataValidation(AllowNullValue = true)]
- public string Remark { get; set; }
-
- ///
- /// 角色
+ /// 关联角色ID集合
///
+ [Required(ErrorMessage = "请选择关联角色")]
public List Roles { get; set; }
-}
\ No newline at end of file
+
+ ///
+ /// 状态(默认启用)
+ ///
+ public AvailabilityStatus Status { get; set; } = AvailabilityStatus.Enable;
+}
diff --git a/YD_Event.Application/User/Dtos/GrantRoleInput.cs b/YD_Event.Application/User/Dtos/GrantRoleInput.cs
new file mode 100644
index 0000000..82af05e
--- /dev/null
+++ b/YD_Event.Application/User/Dtos/GrantRoleInput.cs
@@ -0,0 +1,16 @@
+namespace YD_Event.Application.User.Dtos;
+
+public class GrantRoleInput
+{
+ ///
+ /// 用户ID
+ ///
+ [Required]
+ public long UserId { get; set; }
+
+ ///
+ /// 角色ID集合
+ ///
+ [Required]
+ public List RoleIds { get; set; }
+}
diff --git a/YD_Event.Application/User/Dtos/QuerySysUserInput.cs b/YD_Event.Application/User/Dtos/QuerySysUserInput.cs
index d019e42..92c28a2 100644
--- a/YD_Event.Application/User/Dtos/QuerySysUserInput.cs
+++ b/YD_Event.Application/User/Dtos/QuerySysUserInput.cs
@@ -7,18 +7,23 @@ public class QuerySysUserInput : Pagination
///
public string Account { get; set; }
- ///
- /// 组织机构Id
- ///
- public long? OrgId { get; set; }
-
- ///
- /// 手机号
- ///
- public string Mobile { get; set; }
-
///
/// 姓名
///
public string Name { get; set; }
-}
\ No newline at end of file
+
+ ///
+ /// 关联角色ID
+ ///
+ public long? RoleId { get; set; }
+
+ ///
+ /// 开始时间
+ ///
+ public DateTime? StartTime { get; set; }
+
+ ///
+ /// 结束时间
+ ///
+ public DateTime? EndTime { get; set; }
+}
diff --git a/YD_Event.Application/User/Dtos/SysUserPageOutput.cs b/YD_Event.Application/User/Dtos/SysUserPageOutput.cs
index 4fe0561..338f536 100644
--- a/YD_Event.Application/User/Dtos/SysUserPageOutput.cs
+++ b/YD_Event.Application/User/Dtos/SysUserPageOutput.cs
@@ -7,35 +7,15 @@ public class SysUserPageOutput : KeyDto
///
public string Name { get; set; }
- ///
- /// 状态
- ///
- public AvailabilityStatus Status { get; set; }
-
///
/// 账户名
///
public string Account { get; set; }
///
- /// 生日
+ /// 关联角色名称(逗号分隔)
///
- public DateOnly? Birthday { get; set; }
-
- ///
- /// 手机号码
- ///
- public string Mobile { get; set; }
-
- ///
- /// 性别
- ///
- public Gender Gender { get; set; }
-
- ///
- /// 昵称
- ///
- public string NickName { get; set; }
+ public string RoleNames { get; set; }
///
/// 创建时间
@@ -43,7 +23,7 @@ public class SysUserPageOutput : KeyDto
public DateTime CreatedTime { get; set; }
///
- /// 邮箱
+ /// 状态
///
- public string Email { get; set; }
-}
\ No newline at end of file
+ public AvailabilityStatus Status { get; set; }
+}
diff --git a/YD_Event.Application/User/SysUserService.cs b/YD_Event.Application/User/SysUserService.cs
index 8562401..cda7c5b 100644
--- a/YD_Event.Application/User/SysUserService.cs
+++ b/YD_Event.Application/User/SysUserService.cs
@@ -1,6 +1,7 @@
using YD_Event.Application.Auth;
using YD_Event.Application.Menu;
using YD_Event.Application.User.Dtos;
+using YD_Event.Core.Shared;
namespace YD_Event.Application.User;
@@ -11,6 +12,7 @@ public class SysUserService : BaseService, ITransient
{
private readonly ISqlSugarRepository _repository;
private readonly ISqlSugarRepository _userRoleRepository;
+ private readonly ISqlSugarRepository _roleRepository;
private readonly ISqlSugarRepository _orgRepository;
private readonly SysMenuService _sysMenuService;
private readonly AuthManager _authManager;
@@ -19,6 +21,7 @@ public class SysUserService : BaseService, ITransient
public SysUserService(ISqlSugarRepository repository,
ISqlSugarRepository userRoleRepository,
+ ISqlSugarRepository roleRepository,
ISqlSugarRepository orgRepository,
SysMenuService sysMenuService,
AuthManager authManager,
@@ -27,6 +30,7 @@ public class SysUserService : BaseService, ITransient
{
_repository = repository;
_userRoleRepository = userRoleRepository;
+ _roleRepository = roleRepository;
_orgRepository = orgRepository;
_sysMenuService = sysMenuService;
_authManager = authManager;
@@ -40,35 +44,52 @@ public class SysUserService : BaseService, ITransient
///
///
[DisplayName("系统用户分页查询")]
- [HttpGet]
+ [HttpGet("page")]
public async Task> Page([FromQuery] QuerySysUserInput dto)
{
- List orgIdList = new List();
- if (dto.OrgId.HasValue)
- {
- orgIdList.Add(dto.OrgId.Value);
- var list = await _orgRepository.AsQueryable().ToChildListAsync(x => x.ParentId, dto.OrgId);
- orgIdList.AddRange(list.Select(x => x.Id));
- }
- return await _repository.AsQueryable()
- .Where(x => x.Id > 1)
+ // 构造基本查询
+ var query = _repository.AsQueryable()
+ .Where(x => x.Id > 1) // 排除超级管理员或特定ID
.WhereIF(!string.IsNullOrWhiteSpace(dto.Name), x => x.Name.Contains(dto.Name))
.WhereIF(!string.IsNullOrWhiteSpace(dto.Account), x => x.Account.Contains(dto.Account))
- .WhereIF(!string.IsNullOrWhiteSpace(dto.Mobile), x => x.Mobile.Contains(dto.Mobile))
- .WhereIF(orgIdList.Any(), x => orgIdList.Contains(x.OrgId))
- .Select(x => new SysUserPageOutput
- {
- Name = x.Name,
- Status = x.Status,
- Account = x.Account,
- Birthday = x.Birthday,
- Mobile = x.Mobile,
- Gender = x.Gender,
- NickName = x.NickName,
- CreatedTime = x.CreatedTime,
- Email = x.Email,
- Id = x.Id
- }).ToPagedListAsync(dto);
+ .WhereIF(dto.StartTime.HasValue, x => x.CreatedTime >= dto.StartTime.Value)
+ .WhereIF(dto.EndTime.HasValue, x => x.CreatedTime <= dto.EndTime.Value);
+
+ // 如果需要按角色筛选
+ if (dto.RoleId.HasValue)
+ {
+ query = query.InnerJoin((u, ur) => u.Id == ur.UserId && ur.RoleId == dto.RoleId.Value);
+ }
+
+ var entityList = await query.ToPagedListAsync(dto);
+
+ // 转换并填充角色名称
+ var resultList = new List();
+
+ // 批量获取角色信息优化性能
+ var userIds = entityList.Rows.Select(x => x.Id).ToList();
+ var userRoles = await _userRoleRepository.AsQueryable()
+ .InnerJoin((ur, r) => ur.RoleId == r.Id)
+ .Where((ur, r) => userIds.Contains(ur.UserId))
+ .Select((ur, r) => new { ur.UserId, RoleName = r.Name })
+ .ToListAsync();
+
+ foreach (var user in entityList.Rows)
+ {
+ var output = user.Adapt();
+ var roles = userRoles.Where(x => x.UserId == user.Id).Select(x => x.RoleName).ToList();
+ output.RoleNames = string.Join(",", roles);
+ resultList.Add(output);
+ }
+
+ return new PageResult
+ {
+ PageNo = entityList.PageNo,
+ PageSize = entityList.PageSize,
+ Total = entityList.Total,
+ Rows = resultList,
+ Pages = entityList.Pages
+ };
}
///
@@ -76,21 +97,36 @@ public class SysUserService : BaseService, ITransient
///
///
///
- [UnitOfWork, HttpPost("add")]
+ [UnitOfWork, HttpPost]
[DisplayName("添加系统用户")]
public async Task AddUser(AddSysUserInput dto)
{
+ // 校验账号是否已存在
+ if (await _repository.IsAnyAsync(x => x.Account == dto.Account))
+ throw new InvalidOperationException($"账号 {dto.Account} 已存在");
+
var user = dto.Adapt();
user.Id = _idGenerator.NextId();
string encode = _idGenerator.Encode(user.Id);
- user.Password = MD5Encryption.Encrypt(encode + "123456");
- var roles = dto.Roles.Select(x => new SysUserRole()
+ user.Password = MD5Encryption.Encrypt(encode + "123456"); // 默认密码
+ user.CreatedTime = DateTime.Now; // 确保设置创建时间
+
+ // 处理角色关联
+ var roles = new List();
+ if (dto.Roles != null && dto.Roles.Any())
{
- RoleId = x,
- UserId = user.Id
- }).ToList();
+ roles = dto.Roles.Select(x => new SysUserRole()
+ {
+ RoleId = x,
+ UserId = user.Id
+ }).ToList();
+ }
+
await _repository.InsertAsync(user);
- await _userRoleRepository.InsertRangeAsync(roles);
+ if (roles.Any())
+ {
+ await _userRoleRepository.InsertRangeAsync(roles);
+ }
}
///
@@ -99,21 +135,69 @@ public class SysUserService : BaseService, ITransient
///
///
[DisplayName("更新系统用户信息")]
- [UnitOfWork, HttpPut("edit")]
+ [UnitOfWork, HttpPut]
public async Task UpdateUser(UpdateSysUserInput dto)
{
var user = await _repository.GetByIdAsync(dto.Id);
- if (user == null) throw Oops.Bah("无效参数");
+ if (user == null) throw new InvalidOperationException("用户不存在");
+
+ // 校验账号是否重复(排除自己)
+ if (await _repository.IsAnyAsync(x => x.Account == dto.Account && x.Id != dto.Id))
+ throw new InvalidOperationException($"账号 {dto.Account} 已被使用");
dto.Adapt(user);
- var roles = dto.Roles.Select(x => new SysUserRole()
+
+ // 处理角色关联:先删后加
+ var roles = new List();
+ if (dto.Roles != null && dto.Roles.Any())
{
- RoleId = x,
- UserId = user.Id
- }).ToList();
+ roles = dto.Roles.Select(x => new SysUserRole()
+ {
+ RoleId = x,
+ UserId = user.Id
+ }).ToList();
+ }
+
await _repository.UpdateAsync(user);
await _userRoleRepository.DeleteAsync(x => x.UserId == user.Id);
- await _userRoleRepository.InsertRangeAsync(roles);
+ if (roles.Any())
+ {
+ await _userRoleRepository.InsertRangeAsync(roles);
+ }
+
+ await _easyCachingProvider.RemoveByPrefixAsync(CacheConst.PermissionKey);
+ }
+
+ ///
+ /// 删除系统用户
+ ///
+ ///
+ ///
+ [DisplayName("删除系统用户")]
+ [HttpDelete]
+ public override async Task Delete(KeyDto dto)
+ {
+ await base.Delete(dto);
+ await _easyCachingProvider.RemoveByPrefixAsync(CacheConst.PermissionKey);
+ }
+ [DisplayName("关联角色")]
+ [HttpPost("grantRole")]
+ public async Task GrantRole(GrantRoleInput input)
+ {
+ var user = await _repository.GetByIdAsync(input.UserId);
+ if (user == null) throw new InvalidOperationException("用户不存在");
+
+ var roles = input.RoleIds.Select(x => new SysUserRole()
+ {
+ RoleId = x,
+ UserId = input.UserId
+ }).ToList();
+
+ await _userRoleRepository.DeleteAsync(x => x.UserId == input.UserId);
+ if (roles.Any())
+ {
+ await _userRoleRepository.InsertRangeAsync(roles);
+ }
await _easyCachingProvider.RemoveByPrefixAsync(CacheConst.PermissionKey);
}
@@ -122,7 +206,7 @@ public class SysUserService : BaseService, ITransient
///
///
///
- [HttpGet]
+ [HttpGet("detail")]
public async Task Detail([FromQuery] long id)
{
return await _repository.AsQueryable().Where(x => x.Id == id)
@@ -131,14 +215,7 @@ public class SysUserService : BaseService, ITransient
Id = x.Id,
Name = x.Name,
Status = x.Status,
- OrgId = x.OrgId,
Account = x.Account,
- Mobile = x.Mobile,
- Remark = x.Remark,
- Birthday = x.Birthday,
- Email = x.Email,
- Gender = x.Gender,
- NickName = x.NickName,
Roles = SqlFunc.Subqueryable().Where(s => s.UserId == x.Id).ToList(s => s.RoleId)
}).FirstAsync();
}
@@ -148,7 +225,7 @@ public class SysUserService : BaseService, ITransient
///
///
[DisplayName("重置系统用户密码")]
- [HttpPatch]
+ [HttpPatch("reset")]
public async Task Reset(ResetPasswordInput dto)
{
string encrypt = MD5Encryption.Encrypt(_idGenerator.Encode(dto.Id) + dto.Password);
@@ -163,7 +240,7 @@ public class SysUserService : BaseService, ITransient
///
///
[DisplayName("获取登录用户的信息")]
- [HttpGet]
+ [HttpGet("currentUserInfo")]
public async Task CurrentUserInfo()
{
var userId = _authManager.UserId;
@@ -206,7 +283,7 @@ public class SysUserService : BaseService, ITransient
///
///
[DisplayName("用户修改账户密码")]
- [HttpPatch]
+ [HttpPatch("changePassword")]
public async Task ChangePassword(ChangePasswordOutput dto)
{
var userId = _authManager.UserId;
@@ -232,7 +309,7 @@ public class SysUserService : BaseService, ITransient
///
///
[DisplayName("用户修改头像")]
- [HttpPatch]
+ [HttpPatch("uploadAvatar")]
public async Task UploadAvatar([FromBody] string url)
{
long userId = _authManager.UserId;
@@ -261,4 +338,4 @@ public class SysUserService : BaseService, ITransient
NickName = dto.NickName
}, x => x.Id == userId);
}
-}
\ No newline at end of file
+}
diff --git a/YD_Event.Application/YD_Event.Application.xml b/YD_Event.Application/YD_Event.Application.xml
index fcf1020..29a5927 100644
--- a/YD_Event.Application/YD_Event.Application.xml
+++ b/YD_Event.Application/YD_Event.Application.xml
@@ -1794,29 +1794,29 @@
角色名称
-
-
- 状态
-
-
-
-
- 角色编码
-
-
-
-
- 排序值
-
-
备注
-
+
- 授权按钮菜单Id
+ 排序
+
+
+
+
+ 状态
+
+
+
+
+ 角色ID
+
+
+
+
+ 菜单ID集合
@@ -1861,7 +1861,7 @@
- 角色Id
+ 主键Id
@@ -1890,7 +1890,14 @@
-
+
+
+ 授权角色权限
+
+
+
+
+
获取角色可访问的菜单和按钮id
@@ -1986,59 +1993,24 @@
-
-
- 用户名
-
-
姓名
-
+
- 性别
-
-
-
-
- 组织机构id
-
-
-
-
- 昵称
-
-
-
-
- 生日
-
-
-
-
- 手机号码
-
-
-
-
- 可用状态
-
-
-
-
- 邮箱
-
-
-
-
- 备注
+ 账号
- 角色
+ 关联角色ID集合
+
+
+
+
+ 状态(默认启用)
@@ -2091,26 +2063,41 @@
新密码
+
+
+ 用户ID
+
+
+
+
+ 角色ID集合
+
+
账号
-
-
- 组织机构Id
-
-
-
-
- 手机号
-
-
姓名
+
+
+ 关联角色ID
+
+
+
+
+ 开始时间
+
+
+
+
+ 结束时间
+
+
密码
@@ -2191,34 +2178,14 @@
姓名
-
-
- 状态
-
-
账户名
-
+
- 生日
-
-
-
-
- 手机号码
-
-
-
-
- 性别
-
-
-
-
- 昵称
+ 关联角色名称(逗号分隔)
@@ -2226,9 +2193,9 @@
创建时间
-
+
- 邮箱
+ 状态
@@ -2292,6 +2259,13 @@
+
+
+ 删除系统用户
+
+
+
+
系统用户详情