feat:基于furion搭建
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
global using Yi.Framework.Core.Attributes;
|
||||
global using Yi.Framework.Core.Helper;
|
||||
global using Yi.Framework.Core.Model;
|
||||
global using Yi.Framework.Core.Exceptions;
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class CaptchaImageDto
|
||||
{
|
||||
public string Code { get; set; } = string.Empty;
|
||||
public Guid Uuid { get; set; } = Guid.Empty;
|
||||
public byte[] Img { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class LoginInputVo
|
||||
{
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
public string Uuid { get; set; }
|
||||
|
||||
public string Code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class PhoneCaptchaImageDto
|
||||
{
|
||||
public string Phone { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class RegisterDto
|
||||
{
|
||||
|
||||
//电话号码,根据code的表示来获取
|
||||
|
||||
/// <summary>
|
||||
/// 账号
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 唯一标识码
|
||||
/// </summary>
|
||||
public string? Uuid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
public long Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 验证码
|
||||
/// </summary>
|
||||
public string? Code { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class RestPasswordDto
|
||||
{
|
||||
public string Password = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class UpdateIconDto
|
||||
{
|
||||
public string? Icon { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.Account
|
||||
{
|
||||
public class UpdatePasswordDto
|
||||
{
|
||||
public string NewPassword { get; set; } = string.Empty;
|
||||
public string OldPassword { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept输入创建对象
|
||||
/// </summary>
|
||||
public class DeptCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Enums;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
[QueryParameter]
|
||||
public class DeptGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
[QueryParameter(QueryOperatorEnum.Equal)]
|
||||
public long Id { get; set; }
|
||||
[QueryParameter(QueryOperatorEnum.Equal, ColumnType = ColumnTypeEnum.@bool)]
|
||||
public bool? State { get; set; }
|
||||
[QueryParameter(QueryOperatorEnum.Like)]
|
||||
public string? DeptName { get; set; }
|
||||
[QueryParameter(QueryOperatorEnum.Equal)]
|
||||
public string? DeptCode { get; set; }
|
||||
[QueryParameter(QueryOperatorEnum.Equal)]
|
||||
public string? Leader { get; set; }
|
||||
|
||||
[QueryParameter(QueryOperatorEnum.GreaterThanOrEqual, ColumnName = "CreationTime",ColumnType =ColumnTypeEnum.datetime)]
|
||||
public DateTime? StartTime { get; set; }
|
||||
[QueryParameter(QueryOperatorEnum.LessThanOrEqual, ColumnName = "CreationTime", ColumnType = ColumnTypeEnum.datetime)]
|
||||
public DateTime? EndTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public long? deptId { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
public long ParentId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class DeptUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
public string? Leader { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu输入创建对象
|
||||
/// </summary>
|
||||
public class MenuCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
|
||||
public bool? State { get; set; }
|
||||
public string? MenuName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
//public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
//public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class MenuUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
public string? PermissionCode { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public string? MenuIcon { get; set; }
|
||||
public string? Router { get; set; }
|
||||
public bool IsLink { get; set; }
|
||||
public bool IsCache { get; set; }
|
||||
public bool IsShow { get; set; } = true;
|
||||
public string? Remark { get; set; }
|
||||
public string? Component { get; set; }
|
||||
public string? Query { get; set; }
|
||||
//public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Post输入创建对象
|
||||
/// </summary>
|
||||
public class PostCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostGetListInputVo : PagedAndSortedResultRequestDto
|
||||
{
|
||||
public bool? State { get; set; }
|
||||
//public string? PostCode { get; set; }=string.Empty;
|
||||
public string? PostName { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class PostUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public bool State { get; set; }
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Role输入创建对象
|
||||
/// </summary>
|
||||
public class RoleCreateInputVo
|
||||
{
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
public List<long> DeptIds { get; set; }
|
||||
|
||||
public List<long> MenuIds { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public bool? State { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class RoleUpdateInputVo
|
||||
{
|
||||
public string? RoleName { get; set; }
|
||||
public string? RoleCode { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
public bool State { get; set; }
|
||||
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
public List<long> DeptIds { get; set; }
|
||||
|
||||
public List<long> MenuIds { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos.User
|
||||
{
|
||||
public class ProfileUpdateInputVo
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum? Sex { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// User输入创建对象
|
||||
/// </summary>
|
||||
public class UserCreateInputVo
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string Password { get; set; } = string.Empty;
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public List<long>? RoleIds { get; set; }
|
||||
public List<long>? PostIds { get; set; }
|
||||
public long? DeptId { get; set; }
|
||||
public bool State { get; set; } = true;
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class UserGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public string? UserName { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
|
||||
public bool? State { get; set; }
|
||||
|
||||
public long? DeptId { get; set; }
|
||||
|
||||
public string? Ids { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class UserGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Ip { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public long? DeptId { get; set; }
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public bool State { get; set; }
|
||||
|
||||
|
||||
public string DeptName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class UserGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Ip { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
public bool State { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public long DeptId { get; set; }
|
||||
|
||||
public DeptGetOutputDto Dept { get; set; }
|
||||
|
||||
public List<PostGetListOutputDto> Posts { get; set; }
|
||||
|
||||
public List<RoleGetListOutputDto> Roles { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
|
||||
{
|
||||
public class UserUpdateInputVo
|
||||
{
|
||||
public string? Name { get; set; }
|
||||
public int? Age { get; set; }
|
||||
public string? UserName { get; set; }
|
||||
|
||||
[AdaptIgnore]
|
||||
public string? Password { get; set; }
|
||||
public string? Icon { get; set; }
|
||||
public string? Nick { get; set; }
|
||||
public string? Email { get; set; }
|
||||
public string? Ip { get; set; }
|
||||
public string? Address { get; set; }
|
||||
public long? Phone { get; set; }
|
||||
public string? Introduction { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public SexEnum? Sex { get; set; }
|
||||
public long? DeptId { get; set; }
|
||||
public List<long>? PostIds { get; set; }
|
||||
|
||||
public List<long>? RoleIds { get; set; }
|
||||
public bool? State { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept服务抽象
|
||||
/// </summary>
|
||||
public interface IDeptService : ICrudAppService<DeptGetOutputDto, DeptGetListOutputDto, long, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu服务抽象
|
||||
/// </summary>
|
||||
public interface IMenuService : ICrudAppService<MenuGetOutputDto, MenuGetListOutputDto, long, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Post服务抽象
|
||||
/// </summary>
|
||||
public interface IPostService : ICrudAppService<PostGetOutputDto, PostGetListOutputDto, long, PostGetListInputVo, PostCreateInputVo, PostUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Role服务抽象
|
||||
/// </summary>
|
||||
public interface IRoleService : ICrudAppService<RoleGetOutputDto, RoleGetListOutputDto, long, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// User服务抽象
|
||||
/// </summary>
|
||||
public interface IUserService : ICrudAppService<UserGetOutputDto, UserGetListOutputDto, long, UserGetListInputVo, UserCreateInputVo, UserUpdateInputVo>
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog
|
||||
{
|
||||
public class LoginLogGetListInputVo: PagedAllResultRequestDto
|
||||
{
|
||||
public string? LoginUser { get; set; }
|
||||
|
||||
public string? LoginIp { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog
|
||||
{
|
||||
public class LoginLogGetListOutputDto:EntityDto<long>
|
||||
{
|
||||
public DateTime CreationTime { get; }
|
||||
|
||||
|
||||
public string? LoginUser { get; set; }
|
||||
|
||||
public string? LoginLocation { get; set; }
|
||||
/// <summary>
|
||||
/// 登录Ip
|
||||
///</summary>
|
||||
public string? LoginIp { get; set; }
|
||||
/// <summary>
|
||||
/// 浏览器
|
||||
///</summary>
|
||||
public string? Browser { get; set; }
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
///</summary>
|
||||
public string? Os { get; set; }
|
||||
/// <summary>
|
||||
/// 登录信息
|
||||
///</summary>
|
||||
public string? LogMsg { get; set; }
|
||||
|
||||
public long? CreatorId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// Config输入创建对象
|
||||
/// </summary>
|
||||
public class ConfigCreateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ConfigName { get; set; } = string.Empty;
|
||||
public string ConfigKey { get; set; } = string.Empty;
|
||||
public string ConfigValue { get; set; } = string.Empty;
|
||||
public string? ConfigType { get; set; }
|
||||
public int OrderNum { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ò<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public class ConfigGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string? ConfigName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD>ü<EFBFBD>
|
||||
/// </summary>
|
||||
public string? ConfigKey { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
{
|
||||
public class ConfigGetListOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string ConfigName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string ConfigKey { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>ֵ
|
||||
/// </summary>
|
||||
public string ConfigValue { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
/// </summary>
|
||||
public string? ConfigType { get; set; }
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD><EFBFBD>ֶ<EFBFBD>
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><>ע
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
{
|
||||
public class ConfigGetOutputDto : IEntityDto<long>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ConfigName { get; set; } = string.Empty;
|
||||
public string ConfigKey { get; set; } = string.Empty;
|
||||
public string ConfigValue { get; set; } = string.Empty;
|
||||
public string? ConfigType { get; set; }
|
||||
public int OrderNum { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting.Dtos
|
||||
{
|
||||
public class ConfigUpdateInputVo
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public string ConfigName { get; set; } = string.Empty;
|
||||
public string ConfigKey { get; set; } = string.Empty;
|
||||
public string ConfigValue { get; set; } = string.Empty;
|
||||
public string? ConfigType { get; set; }
|
||||
public int OrderNum { get; set; }
|
||||
public string? Remark { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts.Setting.Dtos;
|
||||
using Yi.Framework.Ddd.Services.Abstract;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts.Setting
|
||||
{
|
||||
/// <summary>
|
||||
/// Config服务抽象
|
||||
/// </summary>
|
||||
public interface IConfigService : ICrudAppService<ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DocumentationFile>./$(AssemblyName)SwaggerDoc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Yi.RBAC.Domain.Shared\Yi.RBAC.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Yi.RBAC.Application.ContractsSwaggerDoc.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
@@ -1,163 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Yi.RBAC.Application.Contracts</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto.UserName">
|
||||
<summary>
|
||||
账号
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto.Password">
|
||||
<summary>
|
||||
密码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto.Uuid">
|
||||
<summary>
|
||||
唯一标识码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto.Phone">
|
||||
<summary>
|
||||
电话
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto.Code">
|
||||
<summary>
|
||||
验证码
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.DeptCreateInputVo">
|
||||
<summary>
|
||||
Dept输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.MenuCreateInputVo">
|
||||
<summary>
|
||||
Menu输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.PostCreateInputVo">
|
||||
<summary>
|
||||
Post输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.RoleCreateInputVo">
|
||||
<summary>
|
||||
Role输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.Dtos.UserCreateInputVo">
|
||||
<summary>
|
||||
User输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IDeptService">
|
||||
<summary>
|
||||
Dept服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IMenuService">
|
||||
<summary>
|
||||
Menu服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IPostService">
|
||||
<summary>
|
||||
Post服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IRoleService">
|
||||
<summary>
|
||||
Role服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Identity.IUserService">
|
||||
<summary>
|
||||
User服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog.LoginLogGetListOutputDto.LoginIp">
|
||||
<summary>
|
||||
登录Ip
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog.LoginLogGetListOutputDto.Browser">
|
||||
<summary>
|
||||
浏览器
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog.LoginLogGetListOutputDto.Os">
|
||||
<summary>
|
||||
操作系统
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog.LoginLogGetListOutputDto.LogMsg">
|
||||
<summary>
|
||||
登录信息
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigCreateInputVo">
|
||||
<summary>
|
||||
Config输入创建对象
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo">
|
||||
<summary>
|
||||
配置查询参数
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo.ConfigName">
|
||||
<summary>
|
||||
配置名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo.ConfigKey">
|
||||
<summary>
|
||||
配置键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigName">
|
||||
<summary>
|
||||
配置名称
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigKey">
|
||||
<summary>
|
||||
配置主键
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigValue">
|
||||
<summary>
|
||||
配置值
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.ConfigType">
|
||||
<summary>
|
||||
配置类型
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.OrderNum">
|
||||
<summary>
|
||||
排序字段
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.Remark">
|
||||
<summary>
|
||||
备注
|
||||
</summary>
|
||||
</member>
|
||||
<member name="P:Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListOutputDto.CreationTime">
|
||||
<summary>
|
||||
创建时间
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Contracts.Setting.IConfigService">
|
||||
<summary>
|
||||
Config服务抽象
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -1,27 +0,0 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StartupModules;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.RBAC.Domain.Shared;
|
||||
|
||||
namespace Yi.RBAC.Application.Contracts
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(YiRBACDomainSharedModule)
|
||||
)]
|
||||
public class YiRBACApplicationContractsModule : IStartupModule
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,383 +0,0 @@
|
||||
using Cike.EventBus.DistributedEvent;
|
||||
using Hei.Captcha;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Auth.JwtBearer.Authentication;
|
||||
using Yi.Framework.Auth.JwtBearer.Authorization;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Core.Enums;
|
||||
using Yi.Framework.Core.Exceptions;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos.Account;
|
||||
using Yi.RBAC.Domain.Identity;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Identity.Repositories;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Etos;
|
||||
using System.Net.WebSockets;
|
||||
using Yi.Framework.Uow;
|
||||
using Yi.Framework.Caching;
|
||||
using Yi.Framework.Sms.Aliyun;
|
||||
using Microsoft.Extensions.Options;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
[AppService]
|
||||
public class AccountService : ApplicationService, IAutoApiService
|
||||
{
|
||||
[Autowired]
|
||||
private JwtTokenManager _jwtTokenManager { get; set; }
|
||||
[Autowired]
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
[Autowired]
|
||||
private ICurrentUser _currentUser { get; set; }
|
||||
[Autowired]
|
||||
private AccountManager _accountManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IRepository<MenuEntity> _menuRepository { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private SecurityCodeHelper _securityCode { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IDistributedEventBus _distributedEventBus { get; set; }
|
||||
|
||||
|
||||
[Autowired]
|
||||
private IUserService _userService { get; set; }
|
||||
|
||||
|
||||
[Autowired]
|
||||
private UserManager _userManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IRepository<RoleEntity> _roleRepository { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private CacheManager _cacheManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private SmsAliyunManager _smsAliyunManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IOptions<SmsAliyunOptions> _smsAliyunManagerOptions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 效验图片登录验证码,无需和账号绑定
|
||||
/// </summary>
|
||||
private void ValidationImageCaptcha(LoginInputVo input)
|
||||
{
|
||||
//登录不想要验证码 ,不效验
|
||||
return;
|
||||
var value = _cacheManager.Get<string>($"Yi:Captcha:{input.Code}");
|
||||
if (value is not null && value.Equals(input.Uuid))
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new UserFriendlyException("验证码错误");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 效验电话验证码,需要与电话号码绑定
|
||||
/// </summary>
|
||||
private void ValidationPhoneCaptcha(RegisterDto input)
|
||||
{
|
||||
var value = _cacheManager.Get<string>($"Yi:Phone:{input.Phone}");
|
||||
if (value is not null && value.Equals($"{input.Code}"))
|
||||
{
|
||||
//成功,需要清空
|
||||
_cacheManager.Del($"Yi:Phone:{input.Phone}");
|
||||
return;
|
||||
}
|
||||
throw new UserFriendlyException("验证码错误");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<object> PostLoginAsync(LoginInputVo input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.Password) || string.IsNullOrEmpty(input.UserName))
|
||||
{
|
||||
throw new UserFriendlyException("请输入合理数据!");
|
||||
}
|
||||
|
||||
//效验验证码
|
||||
ValidationImageCaptcha(input);
|
||||
|
||||
UserEntity user = new();
|
||||
//登录成功
|
||||
await _accountManager.LoginValidationAsync(input.UserName, input.Password, x => user = x);
|
||||
|
||||
//获取用户信息
|
||||
var userInfo = await _userRepository.GetUserAllInfoAsync(user.Id);
|
||||
|
||||
if (userInfo.RoleCodes.Count == 0)
|
||||
{
|
||||
throw new UserFriendlyException(UserConst.用户无角色分配);
|
||||
}
|
||||
//这里抛出一个登录的事件
|
||||
|
||||
//不阻碍执行,无需等待
|
||||
#pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
|
||||
_distributedEventBus.PublishAsync(new LoginEventArgs
|
||||
{
|
||||
UserId = userInfo.User.Id,
|
||||
UserName = user.UserName
|
||||
});
|
||||
#pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法
|
||||
|
||||
//创建token
|
||||
var token = _jwtTokenManager.CreateToken(_accountManager.UserInfoToClaim(userInfo));
|
||||
return new { Token = token };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 生成验证码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
|
||||
[AllowAnonymous]
|
||||
public CaptchaImageDto GetCaptchaImage()
|
||||
{
|
||||
var uuid = Guid.NewGuid();
|
||||
var code = _securityCode.GetRandomEnDigitalText(4);
|
||||
//将uuid与code,Redis缓存中心化保存起来,登录根据uuid比对即可
|
||||
//10分钟过期
|
||||
_cacheManager.Set($"Yi:Captcha:{code}", uuid, new TimeSpan(0, 10, 0));
|
||||
var imgbyte = _securityCode.GetEnDigitalCodeByte(code);
|
||||
return new CaptchaImageDto { Img = imgbyte, Code = code, Uuid = uuid };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 验证电话号码
|
||||
/// </summary>
|
||||
/// <param name="str_handset"></param>
|
||||
private async Task ValidationPhone(string str_handset)
|
||||
{
|
||||
var res= Regex.IsMatch(str_handset, "^(0\\d{2,3}-?\\d{7,8}(-\\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(14[0-9]))\\d{8})$");
|
||||
if (res == false)
|
||||
{
|
||||
throw new UserFriendlyException("手机号码格式错误!请检查");
|
||||
}
|
||||
if (await _userRepository.IsAnyAsync(x => x.Phone.ToString() == str_handset))
|
||||
{
|
||||
throw new UserFriendlyException("该手机号已被注册!");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 注册 手机验证码
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<object> PostCaptchaPhone(PhoneCaptchaImageDto input)
|
||||
{
|
||||
await ValidationPhone(input.Phone);
|
||||
var value = _cacheManager.Get<string>($"Yi:Phone:{input.Phone}");
|
||||
|
||||
//防止暴刷
|
||||
if (value is not null)
|
||||
{
|
||||
throw new UserFriendlyException($"{input.Phone}已发送过验证码,10分钟后可重试");
|
||||
}
|
||||
//生成一个4位数的验证码
|
||||
//发送短信,同时生成uuid
|
||||
//key: 电话号码 value:验证码+uuid
|
||||
var code = _securityCode.GetRandomEnDigitalText(4);
|
||||
var uuid = Guid.NewGuid();
|
||||
|
||||
//未开启短信验证,默认8888
|
||||
if (_smsAliyunManagerOptions.Value.EnableFeature)
|
||||
{
|
||||
await _smsAliyunManager.Send(input.Phone, code);
|
||||
}
|
||||
else
|
||||
{
|
||||
code = "8888";
|
||||
}
|
||||
_cacheManager.Set($"Yi:Phone:{input.Phone}", $"{code}", new TimeSpan(0, 10, 0));
|
||||
|
||||
|
||||
return new { Uuid = uuid };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册,需要验证码通过
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
public async Task<object> PostRegisterAsync(RegisterDto input)
|
||||
{
|
||||
if (input.UserName == UserConst.Admin)
|
||||
{
|
||||
throw new UserFriendlyException("用户名无效注册!");
|
||||
}
|
||||
|
||||
if (input.UserName.Length < 2)
|
||||
{
|
||||
throw new UserFriendlyException("账号名需大于等于2位!");
|
||||
}
|
||||
if (input.Password.Length < 6)
|
||||
{
|
||||
throw new UserFriendlyException("密码需大于等于6位!");
|
||||
}
|
||||
//效验验证码,根据电话号码获取 value,比对验证码已经uuid
|
||||
ValidationPhoneCaptcha(input);
|
||||
|
||||
|
||||
|
||||
//输入的用户名与电话号码都不能在数据库中存在
|
||||
UserEntity user = new();
|
||||
var isExist = await _userRepository.IsAnyAsync(x =>
|
||||
x.UserName == input.UserName
|
||||
|| x.Phone == input.Phone);
|
||||
if (isExist)
|
||||
{
|
||||
throw new UserFriendlyException("用户已存在,注册失败");
|
||||
}
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var newUser = new UserEntity(input.UserName, input.Password, input.Phone);
|
||||
|
||||
var entity = await _userRepository.InsertReturnEntityAsync(newUser);
|
||||
//赋上一个初始角色
|
||||
var roleRepository = _roleRepository;
|
||||
var role = await roleRepository.GetFirstAsync(x => x.RoleCode == UserConst.GuestRoleCode);
|
||||
if (role is not null)
|
||||
{
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { entity.Id }, new List<long> { role.Id });
|
||||
}
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询已登录的账户信息
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="AuthException"></exception>
|
||||
[Route("/api/account")]
|
||||
[Authorize]
|
||||
public async Task<UserRoleMenuDto> Get()
|
||||
{
|
||||
//通过鉴权jwt获取到用户的id
|
||||
var userId = _currentUser.Id;
|
||||
//此处从缓存中获取即可
|
||||
//var data = _cacheManager.Get<UserRoleMenuDto>($"Yi:UserInfo:{userId}");
|
||||
var data = await _userRepository.GetUserAllInfoAsync(userId);
|
||||
//系统用户数据被重置,老前端访问重新授权
|
||||
if (data is null)
|
||||
{
|
||||
throw new AuthException();
|
||||
}
|
||||
|
||||
data.Menus.Clear();
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前登录用户的前端路由
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
public async Task<List<Vue3RouterDto>> GetVue3Router()
|
||||
{
|
||||
var userId = _currentUser.Id;
|
||||
var data = await _userRepository.GetUserAllInfoAsync(userId);
|
||||
var menus = data.Menus.ToList();
|
||||
|
||||
//为超级管理员直接给全部路由
|
||||
if (UserConst.Admin.Equals(data.User.UserName))
|
||||
{
|
||||
menus = await _menuRepository.GetListAsync();
|
||||
}
|
||||
//将后端菜单转换成前端路由,组件级别需要过滤
|
||||
List<Vue3RouterDto> routers = menus.Vue3RouterBuild();
|
||||
return routers;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 退出登录
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Task<bool> PostLogout()
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新密码
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> UpdatePasswordAsync(UpdatePasswordDto input)
|
||||
{
|
||||
if (input.OldPassword.Equals(input.NewPassword))
|
||||
{
|
||||
throw new UserFriendlyException("无效更新!输入的数据,新密码不能与老密码相同");
|
||||
}
|
||||
await _accountManager.UpdatePasswordAsync(_currentUser.Id, input.NewPassword, input.OldPassword);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
public async Task<bool> RestPasswordAsync(long userId, RestPasswordDto input)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(input.Password))
|
||||
{
|
||||
throw new UserFriendlyException("重置密码不能为空!");
|
||||
}
|
||||
await _accountManager.RestPasswordAsync(userId, input.Password);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新头像
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> UpdateIconAsync(UpdateIconDto input)
|
||||
{
|
||||
var entity = await _userRepository.GetByIdAsync(_currentUser.Id);
|
||||
entity.Icon = input.Icon;
|
||||
await _userRepository.UpdateAsync(entity);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using SqlSugar;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class DeptService : CrudAppService<DeptEntity, DeptGetOutputDto, DeptGetListOutputDto, long, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>,
|
||||
IDeptService, IAutoApiService
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 通过角色id查询该角色全部部门
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//[Route("{roleId}")]
|
||||
public async Task<List<DeptGetListOutputDto>> GetListRoleIdAsync([FromRoute]long roleId)
|
||||
{
|
||||
var entities= await _DbQueryable.Where(d => SqlFunc.Subqueryable<RoleDeptEntity>().Where(rd => rd.RoleId == roleId && d.Id==rd.DeptId).Any()).ToListAsync();
|
||||
return await MapToGetListOutputDtosAsync(entities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多查
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<PagedResultDto<DeptGetListOutputDto>> GetListAsync(DeptGetListInputVo input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var entities = await _DbQueryable
|
||||
.WhereIF(!string.IsNullOrEmpty(input.DeptName), u => u.DeptName.Contains(input.DeptName!))
|
||||
.WhereIF(input.State is not null, u => u.State == input.State)
|
||||
.OrderBy(u => u.OrderNum, OrderByType.Asc)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<DeptGetListOutputDto>
|
||||
{
|
||||
Items = await MapToGetListOutputDtosAsync(entities),
|
||||
Total = total
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class MenuService : CrudAppService<MenuEntity, MenuGetOutputDto, MenuGetListOutputDto, long, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>,
|
||||
IMenuService, IAutoApiService
|
||||
{
|
||||
|
||||
public override async Task<PagedResultDto<MenuGetListOutputDto>> GetListAsync(MenuGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.MenuName), x => x.MenuName.Contains(input.MenuName!))
|
||||
.WhereIF(input.State is not null, x => x.State == input.State)
|
||||
.OrderByDescending(x=>x.OrderNum)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<MenuGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询当前角色的菜单
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MenuGetListOutputDto>> GetListRoleIdAsync(long roleId)
|
||||
{
|
||||
var entities = await _DbQueryable.Where(m => SqlFunc.Subqueryable<RoleMenuEntity>().Where(rm => rm.RoleId == roleId && rm.MenuId == m.Id).Any()).ToListAsync();
|
||||
|
||||
return await MapToGetListOutputDtosAsync(entities);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using SqlSugar;
|
||||
using Yi.RBAC.Application.Contracts.Setting.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Post服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class PostService : CrudAppService<PostEntity, PostGetOutputDto, PostGetListOutputDto, long, PostGetListInputVo, PostCreateInputVo, PostUpdateInputVo>,
|
||||
IPostService, IAutoApiService
|
||||
{
|
||||
public override async Task<PagedResultDto<PostGetListOutputDto>> GetListAsync(PostGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.PostName), x => x.PostName.Contains(input.PostName!))
|
||||
.WhereIF(input.State is not null, x => x.State == input.State)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<PostGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.RBAC.Domain.Identity;
|
||||
using Microsoft.AspNetCore.Identity;
|
||||
using Yi.Framework.Uow;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using SqlSugar;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// Role服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class RoleService : CrudAppService<RoleEntity, RoleGetOutputDto, RoleGetListOutputDto, long, RoleGetListInputVo, RoleCreateInputVo, RoleUpdateInputVo>,
|
||||
IRoleService, IAutoApiService
|
||||
{
|
||||
[Autowired]
|
||||
private RoleManager _roleManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
|
||||
|
||||
public override async Task<PagedResultDto<RoleGetListOutputDto>> GetListAsync(RoleGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.RoleCode), x => x.RoleCode.Contains(input.RoleCode!))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.RoleName), x => x.RoleName.Contains(input.RoleName!))
|
||||
.WhereIF(input.State is not null, x => x.State == input.State)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<RoleGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加角色
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<RoleGetOutputDto> CreateAsync(RoleCreateInputVo input)
|
||||
{
|
||||
RoleGetOutputDto outputDto;
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
await _repository.InsertAsync(entity);
|
||||
outputDto = await MapToGetOutputDtoAsync(entity);
|
||||
await _roleManager.GiveRoleSetMenuAsync(new List<long> { entity.Id }, input.MenuIds);
|
||||
uow.Commit();
|
||||
}
|
||||
|
||||
return outputDto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 修改角色
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<RoleGetOutputDto> UpdateAsync(long id, RoleUpdateInputVo input)
|
||||
{
|
||||
var dto = new RoleGetOutputDto();
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
await MapToEntityAsync(input, entity);
|
||||
await _repository.UpdateAsync(entity);
|
||||
|
||||
await _roleManager.GiveRoleSetMenuAsync(new List<long> { id }, input.MenuIds);
|
||||
|
||||
dto = await MapToGetOutputDtoAsync(entity);
|
||||
uow.Commit();
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新状态
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
[Route("/api/role/{id}/{state}")]
|
||||
public async Task<RoleGetOutputDto> UpdateStateAsync([FromRoute] long id, [FromRoute] bool state)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
if (entity is null)
|
||||
{
|
||||
throw new ApplicationException("角色未存在");
|
||||
}
|
||||
|
||||
entity.State = state;
|
||||
await _repository.UpdateAsync(entity);
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.Identity;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
using Yi.RBAC.Domain.Identity;
|
||||
using Yi.Framework.Uow;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Repositories;
|
||||
using SqlSugar;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Auth.JwtBearer.Authorization;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos.User;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.OperLogManager;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
/// <summary>
|
||||
/// User服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class UserService : CrudAppService<UserEntity, UserGetOutputDto, UserGetListOutputDto, long, UserGetListInputVo, UserCreateInputVo, UserUpdateInputVo>,
|
||||
IUserService, IAutoApiService
|
||||
{
|
||||
[Autowired]
|
||||
private UserManager _userManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private IUserRepository _userRepository { get; set; }
|
||||
|
||||
[Autowired]
|
||||
private ICurrentUser _currentUser { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 查询用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<PagedResultDto<UserGetListOutputDto>> GetListAsync(UserGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
|
||||
List<long>? ids = input.Ids?.Split(",").Select(x=>long.Parse(x)).ToList();
|
||||
var outPut = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.UserName), x => x.UserName.Contains(input.UserName!))
|
||||
.WhereIF(input.Phone is not null, x => x.Phone.ToString()!.Contains(input.Phone.ToString()!))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.Name), x => x.Name!.Contains(input.Name!))
|
||||
.WhereIF(input.State is not null, x => x.State == input.State)
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
|
||||
//这个为过滤当前部门,加入数据权限后,将由数据权限控制
|
||||
.WhereIF(input.DeptId is not null, x => x.DeptId == input.DeptId)
|
||||
|
||||
.WhereIF(ids is not null,x=> ids.Contains(x.Id))
|
||||
|
||||
|
||||
.LeftJoin<DeptEntity>((user, dept) => user.DeptId == dept.Id)
|
||||
.Select((user, dept) => new UserGetListOutputDto(), true)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
|
||||
var result = new PagedResultDto<UserGetListOutputDto>();
|
||||
result.Items = outPut;
|
||||
result.Total = total;
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加用户
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
[OperLog("添加用户", OperEnum.Insert)]
|
||||
public async override Task<UserGetOutputDto> CreateAsync(UserCreateInputVo input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.Password))
|
||||
{
|
||||
throw new UserFriendlyException(UserConst.添加失败_密码为空);
|
||||
}
|
||||
if (await _repository.IsAnyAsync(u => input.UserName.Equals(u.UserName)))
|
||||
{
|
||||
throw new UserFriendlyException(UserConst.添加失败_用户存在);
|
||||
}
|
||||
var entities = await MapToEntityAsync(input);
|
||||
|
||||
entities.BuildPassword();
|
||||
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var returnEntity = await _repository.InsertReturnEntityAsync(entities);
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { returnEntity.Id }, input.RoleIds);
|
||||
await _userManager.GiveUserSetPostAsync(new List<long> { returnEntity.Id }, input.PostIds);
|
||||
uow.Commit();
|
||||
|
||||
var result = await MapToGetOutputDtoAsync(returnEntity);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 单查
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<UserGetOutputDto> GetAsync(long id)
|
||||
{
|
||||
//使用导航树形查询
|
||||
var entity = await _DbQueryable.Includes(u => u.Roles).Includes(u => u.Posts).Includes(u => u.Dept).InSingleAsync(id);
|
||||
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新用户
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[OperLog("更新用户", OperEnum.Update)]
|
||||
public async override Task<UserGetOutputDto> UpdateAsync(long id, UserUpdateInputVo input)
|
||||
{
|
||||
if (await _repository.IsAnyAsync(u => input.UserName!.Equals(u.UserName) && !id.Equals(u.Id)))
|
||||
{
|
||||
throw new UserFriendlyException("用户已经在,更新失败");
|
||||
}
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
//更新密码,特殊处理
|
||||
if (input.Password is not null)
|
||||
{
|
||||
entity.Password = input.Password;
|
||||
entity.BuildPassword();
|
||||
}
|
||||
await MapToEntityAsync(input, entity);
|
||||
using (var uow = _unitOfWorkManager.CreateContext())
|
||||
{
|
||||
var res1 = await _repository.UpdateAsync(entity);
|
||||
await _userManager.GiveUserSetRoleAsync(new List<long> { id }, input.RoleIds);
|
||||
await _userManager.GiveUserSetPostAsync(new List<long> { id }, input.PostIds);
|
||||
uow.Commit();
|
||||
}
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新个人中心
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[OperLog("更新个人信息", OperEnum.Update)]
|
||||
public async Task<UserGetOutputDto> UpdateProfileAsync(ProfileUpdateInputVo input)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(_currentUser.Id);
|
||||
_mapper.Map(input, entity);
|
||||
await _repository.UpdateAsync(entity);
|
||||
var dto = _mapper.Map<UserGetOutputDto>(entity);
|
||||
return dto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新状态
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
[Route("/api/user/{id}/{state}")]
|
||||
[OperLog("更新用户状态", OperEnum.Update)]
|
||||
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id, [FromRoute] bool state)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
if (entity is null)
|
||||
{
|
||||
throw new ApplicationException("用户未存在");
|
||||
}
|
||||
|
||||
entity.State = state;
|
||||
await _repository.UpdateAsync(entity);
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
[OperLog("删除用户", OperEnum.Delete)]
|
||||
public override Task<bool> DeleteAsync(string id)
|
||||
{
|
||||
return base.DeleteAsync(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog;
|
||||
using Yi.RBAC.Application.Contracts.Setting.Dtos;
|
||||
using Yi.RBAC.Domain.Logs.Entities;
|
||||
|
||||
namespace Yi.RBAC.Application.Logs
|
||||
{
|
||||
[AppService]
|
||||
public class LoginLogService : CrudAppService<LoginLogEntity, LoginLogGetListOutputDto, long, LoginLogGetListInputVo>, IAutoApiService
|
||||
{
|
||||
public override async Task<PagedResultDto<LoginLogGetListOutputDto>> GetListAsync(LoginLogGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.LoginIp), x => x.LoginIp.Contains(input.LoginIp!))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.LoginUser), x => x.LoginUser!.Contains(input.LoginUser!))
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<LoginLogGetListOutputDto> UpdateAsync(long id, LoginLogGetListOutputDto input)
|
||||
{
|
||||
return base.UpdateAsync(id, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
using Yi.RBAC.Application.Contracts.Setting;
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using Yi.RBAC.Application.Contracts.Setting.Dtos;
|
||||
using Yi.RBAC.Domain.Setting.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using SqlSugar;
|
||||
using Yi.RBAC.Application.Contracts.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yi.RBAC.Application.Setting
|
||||
{
|
||||
/// <summary>
|
||||
/// Config服务实现
|
||||
/// </summary>
|
||||
[AppService]
|
||||
|
||||
public class ConfigService : CrudAppService<ConfigEntity, ConfigGetOutputDto, ConfigGetListOutputDto, long, ConfigGetListInputVo, ConfigCreateInputVo, ConfigUpdateInputVo>,
|
||||
IConfigService, IAutoApiService
|
||||
{
|
||||
/// <summary>
|
||||
/// 多查
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<PagedResultDto<ConfigGetListOutputDto>> GetListAsync(ConfigGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.ConfigKey), x => x.ConfigKey.Contains(input.ConfigKey!))
|
||||
.WhereIF(!string.IsNullOrEmpty(input.ConfigName), x => x.ConfigName!.Contains(input.ConfigName!))
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<ConfigGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using Cike.AutoWebApi.Setting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
|
||||
namespace Yi.RBAC.Application
|
||||
{
|
||||
class Test01
|
||||
{
|
||||
|
||||
public string Name { get; set; }
|
||||
public bool State { get; set; }
|
||||
}
|
||||
|
||||
class Test02
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
|
||||
public class TestService : ApplicationService, IAutoApiService
|
||||
{
|
||||
|
||||
public void Test()
|
||||
{
|
||||
var t001 = new Test02 { Name = "121233" };
|
||||
var t002 = new Test01 { Name = "123", State = true };
|
||||
|
||||
var entity= _mapper.Map(t001, t002);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DocumentationFile>./$(AssemblyName)SwaggerDoc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Auth.JwtBearer\Yi.Framework.Auth.JwtBearer.csproj" />
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Uow\Yi.Framework.Uow.csproj" />
|
||||
<ProjectReference Include="..\Yi.RBAC.Application.Contracts\Yi.RBAC.Application.Contracts.csproj" />
|
||||
<ProjectReference Include="..\Yi.RBAC.Domain\Yi.RBAC.Domain.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Yi.RBAC.ApplicationSwaggerDoc.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,216 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>Yi.RBAC.Application</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.ValidationImageCaptcha(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.LoginInputVo)">
|
||||
<summary>
|
||||
效验图片登录验证码,无需和账号绑定
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.ValidationPhoneCaptcha(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto)">
|
||||
<summary>
|
||||
效验电话验证码,需要与电话号码绑定
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.PostLoginAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.LoginInputVo)">
|
||||
<summary>
|
||||
登录
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.GetCaptchaImage">
|
||||
<summary>
|
||||
生成验证码
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.ValidationPhone(System.String)">
|
||||
<summary>
|
||||
验证电话号码
|
||||
</summary>
|
||||
<param name="str_handset"></param>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.PostCaptchaPhone(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.PhoneCaptchaImageDto)">
|
||||
<summary>
|
||||
注册 手机验证码
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.PostRegisterAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RegisterDto)">
|
||||
<summary>
|
||||
注册,需要验证码通过
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.Get">
|
||||
<summary>
|
||||
查询已登录的账户信息
|
||||
</summary>
|
||||
<returns></returns>
|
||||
<exception cref="T:Yi.Framework.Core.Exceptions.AuthException"></exception>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.GetVue3Router">
|
||||
<summary>
|
||||
获取当前登录用户的前端路由
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.PostLogout">
|
||||
<summary>
|
||||
退出登录
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.UpdatePasswordAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.UpdatePasswordDto)">
|
||||
<summary>
|
||||
更新密码
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.RestPasswordAsync(System.Int64,Yi.RBAC.Application.Contracts.Identity.Dtos.Account.RestPasswordDto)">
|
||||
<summary>
|
||||
重置密码
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.AccountService.UpdateIconAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.Account.UpdateIconDto)">
|
||||
<summary>
|
||||
更新头像
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.DeptService">
|
||||
<summary>
|
||||
Dept服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.DeptService.GetListRoleIdAsync(System.Int64)">
|
||||
<summary>
|
||||
通过角色id查询该角色全部部门
|
||||
</summary>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.DeptService.GetListAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.DeptGetListInputVo)">
|
||||
<summary>
|
||||
多查
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.MenuService">
|
||||
<summary>
|
||||
Menu服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.MenuService.GetListRoleIdAsync(System.Int64)">
|
||||
<summary>
|
||||
查询当前角色的菜单
|
||||
</summary>
|
||||
<param name="roleId"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.PostService">
|
||||
<summary>
|
||||
Post服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.RoleService">
|
||||
<summary>
|
||||
Role服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.RoleService.CreateAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.RoleCreateInputVo)">
|
||||
<summary>
|
||||
添加角色
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.RoleService.UpdateAsync(System.Int64,Yi.RBAC.Application.Contracts.Identity.Dtos.RoleUpdateInputVo)">
|
||||
<summary>
|
||||
修改角色
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.RoleService.UpdateStateAsync(System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
更新状态
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="state"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.UserService">
|
||||
<summary>
|
||||
User服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.GetListAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.UserGetListInputVo)">
|
||||
<summary>
|
||||
查询用户
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.CreateAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.UserCreateInputVo)">
|
||||
<summary>
|
||||
添加用户
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
<exception cref="T:Yi.Framework.Core.Exceptions.UserFriendlyException"></exception>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.GetAsync(System.Int64)">
|
||||
<summary>
|
||||
单查
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateAsync(System.Int64,Yi.RBAC.Application.Contracts.Identity.Dtos.UserUpdateInputVo)">
|
||||
<summary>
|
||||
更新用户
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateProfileAsync(Yi.RBAC.Application.Contracts.Identity.Dtos.User.ProfileUpdateInputVo)">
|
||||
<summary>
|
||||
更新个人中心
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateStateAsync(System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
更新状态
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="state"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Setting.ConfigService">
|
||||
<summary>
|
||||
Config服务实现
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Setting.ConfigService.GetListAsync(Yi.RBAC.Application.Contracts.Setting.Dtos.ConfigGetListInputVo)">
|
||||
<summary>
|
||||
多查
|
||||
</summary>
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -1,33 +0,0 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StartupModules;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Application.Contracts;
|
||||
using Yi.Framework.Auth.JwtBearer;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Data;
|
||||
using Yi.Framework.Ddd;
|
||||
using Yi.RBAC.Domain;
|
||||
|
||||
namespace Yi.RBAC.Application
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(YiRBACApplicationContractsModule),
|
||||
typeof(YiRBACDomainModule),
|
||||
typeof(YiFrameworkAuthJwtBearerModule)
|
||||
)]
|
||||
public class YiRBACApplicationModule : IStartupModule
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class DeptConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class MenuConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class PostConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class RoleConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class UserConst
|
||||
{
|
||||
public const string 登录失败_错误 = "登录失败!用户名或密码错误!";
|
||||
public const string 登录失败_不存在 = "登录失败!用户名不存在!";
|
||||
public const string 添加失败_密码为空 = "密码为空,添加失败!";
|
||||
public const string 添加失败_用户存在 = "用户已经存在,添加失败!";
|
||||
public const string 用户无权限分配 = "登录禁用!该用户分配无任何权限,无意义登录!";
|
||||
public const string 用户无角色分配 = "登录禁用!该用户分配无任何角色,无意义登录!";
|
||||
|
||||
public const string Admin = "cc";
|
||||
public const string AdminRolesCode = "admin";
|
||||
public const string AdminPermissionCode = "*:*:*";
|
||||
|
||||
public const string GuestRoleCode = "guest";
|
||||
public const string CommonRoleName = "common";
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static Yi.Framework.Core.Helper.TreeHelper;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.Dtos
|
||||
{
|
||||
public class Vue3RouterDto : ITreeModel<Vue3RouterDto>
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long ParentId { get; set; }
|
||||
public int OrderNum { get; set; }
|
||||
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Path { get; set; } = string.Empty;
|
||||
public bool Hidden { get; set; }
|
||||
public string Redirect { get; set; } = string.Empty;
|
||||
public string Component { get; set; } = string.Empty;
|
||||
public bool AlwaysShow { get; set; }
|
||||
public Meta Meta { get; set; } = new Meta();
|
||||
public List<Vue3RouterDto>? Children { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class Meta
|
||||
{
|
||||
public string Title { get; set; } = string.Empty;
|
||||
public string Icon { get; set; } = string.Empty;
|
||||
public bool NoCache { get; set; }
|
||||
public string link { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.EnumClasses
|
||||
{
|
||||
public enum DataScopeEnum
|
||||
{
|
||||
ALL = 0,
|
||||
CUSTOM = 1,
|
||||
DEPT = 2,
|
||||
DEPT_FOLLOW = 3,
|
||||
USER = 4
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.EnumClasses
|
||||
{
|
||||
public enum MenuTypeEnum
|
||||
{
|
||||
Catalogue = 0, //目录
|
||||
Menu = 1, //菜单
|
||||
Component = 2//组件
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.EnumClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public enum SexEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// 男性
|
||||
/// </summary>
|
||||
Male = 0,
|
||||
/// <summary>
|
||||
/// 女性
|
||||
/// </summary>
|
||||
Woman = 1,
|
||||
/// <summary>
|
||||
/// 未知
|
||||
/// </summary>
|
||||
Unknown = 2
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Identity.Etos
|
||||
{
|
||||
public class LoginEventArgs
|
||||
{
|
||||
public long UserId { get; set; }
|
||||
public string UserName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared.Setting.ConstClasses
|
||||
{
|
||||
/// <summary>
|
||||
/// 常量定义
|
||||
/// </summary>
|
||||
|
||||
public class ConfigConst
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Ddd\Yi.Framework.Ddd.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,27 +0,0 @@
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StartupModules;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Attributes;
|
||||
using Yi.Framework.Ddd;
|
||||
|
||||
namespace Yi.RBAC.Domain.Shared
|
||||
{
|
||||
[DependsOn(
|
||||
typeof(YiFrameworkDddModule)
|
||||
)]
|
||||
public class YiRBACDomainSharedModule : IStartupModule
|
||||
{
|
||||
public void Configure(IApplicationBuilder app, ConfigureMiddlewareContext context)
|
||||
{
|
||||
}
|
||||
|
||||
public void ConfigureServices(IServiceCollection services, ConfigureServicesContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class DeptDataSeed : AbstractDataSeed<DeptEntity>
|
||||
{
|
||||
public DeptDataSeed(IRepository<DeptEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<DeptEntity> GetSeedData()
|
||||
{
|
||||
var entities =new List<DeptEntity>();
|
||||
|
||||
DeptEntity chengziDept = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "橙子科技",
|
||||
DeptCode = "Yi",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = 0,
|
||||
Leader = "橙子",
|
||||
Remark = "如名所指"
|
||||
};
|
||||
entities.Add(chengziDept);
|
||||
|
||||
|
||||
DeptEntity shenzhenDept = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "深圳总公司",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = chengziDept.Id
|
||||
};
|
||||
entities.Add(shenzhenDept);
|
||||
|
||||
|
||||
DeptEntity jiangxiDept = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "江西总公司",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = chengziDept.Id
|
||||
};
|
||||
entities.Add(jiangxiDept);
|
||||
|
||||
|
||||
|
||||
DeptEntity szDept1 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "研发部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept1);
|
||||
|
||||
DeptEntity szDept2 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "市场部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept2);
|
||||
|
||||
DeptEntity szDept3 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "测试部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept3);
|
||||
|
||||
DeptEntity szDept4 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "财务部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept4);
|
||||
|
||||
DeptEntity szDept5 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "运维部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = shenzhenDept.Id
|
||||
};
|
||||
entities.Add(szDept5);
|
||||
|
||||
|
||||
DeptEntity jxDept1 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "市场部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = jiangxiDept.Id
|
||||
};
|
||||
entities.Add(jxDept1);
|
||||
|
||||
|
||||
DeptEntity jxDept2 = new DeptEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
DeptName = "财务部门",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false,
|
||||
ParentId = jiangxiDept.Id
|
||||
};
|
||||
entities.Add(jxDept2);
|
||||
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,369 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.Framework.DictionaryManager.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class DictionaryDataSeed : AbstractDataSeed<DictionaryEntity>
|
||||
{
|
||||
public DictionaryDataSeed(IRepository<DictionaryEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<DictionaryEntity> GetSeedData()
|
||||
{
|
||||
List<DictionaryEntity> entities= new List<DictionaryEntity>();
|
||||
DictionaryEntity dictInfo1 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "男",
|
||||
DictValue = "0",
|
||||
DictType = "sys_user_sex",
|
||||
OrderNum = 100,
|
||||
Remark = "性别男",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo1);
|
||||
|
||||
DictionaryEntity dictInfo2 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "女",
|
||||
DictValue = "1",
|
||||
DictType = "sys_user_sex",
|
||||
OrderNum = 99,
|
||||
Remark = "性别女",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo2);
|
||||
|
||||
DictionaryEntity dictInfo3 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "未知",
|
||||
DictValue = "2",
|
||||
DictType = "sys_user_sex",
|
||||
OrderNum = 98,
|
||||
Remark = "性别未知",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo3);
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo4 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "显示",
|
||||
DictValue = "true",
|
||||
DictType = "sys_show_hide",
|
||||
OrderNum = 100,
|
||||
Remark = "显示菜单",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo4);
|
||||
|
||||
DictionaryEntity dictInfo5 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "隐藏",
|
||||
DictValue = "false",
|
||||
DictType = "sys_show_hide",
|
||||
OrderNum = 99,
|
||||
Remark = "隐藏菜单",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo5);
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo6 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "正常",
|
||||
DictValue = "true",
|
||||
DictType = "sys_normal_disable",
|
||||
OrderNum = 100,
|
||||
Remark = "正常状态",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo6);
|
||||
DictionaryEntity dictInfo7 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "停用",
|
||||
DictValue = "false",
|
||||
DictType = "sys_normal_disable",
|
||||
OrderNum = 99,
|
||||
Remark = "停用状态",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo7);
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo8 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "正常",
|
||||
DictValue = "0",
|
||||
DictType = "sys_job_status",
|
||||
OrderNum = 100,
|
||||
Remark = "正常状态",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo8);
|
||||
DictionaryEntity dictInfo9 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "暂停",
|
||||
DictValue = "1",
|
||||
DictType = "sys_job_status",
|
||||
OrderNum = 99,
|
||||
Remark = "停用状态",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo9);
|
||||
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo10 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "默认",
|
||||
DictValue = "DEFAULT",
|
||||
DictType = "sys_job_group",
|
||||
OrderNum = 100,
|
||||
Remark = "默认分组",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo10);
|
||||
DictionaryEntity dictInfo11 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "系统",
|
||||
DictValue = "SYSTEM",
|
||||
DictType = "sys_job_group",
|
||||
OrderNum = 99,
|
||||
Remark = "系统分组",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo11);
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo12 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "是",
|
||||
DictValue = "Y",
|
||||
DictType = "sys_yes_no",
|
||||
OrderNum = 100,
|
||||
Remark = "系统默认是",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo12);
|
||||
DictionaryEntity dictInfo13 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "否",
|
||||
DictValue = "N",
|
||||
DictType = "sys_yes_no",
|
||||
OrderNum = 99,
|
||||
Remark = "系统默认否",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo13);
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo14 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "通知",
|
||||
DictValue = "1",
|
||||
DictType = "sys_notice_type",
|
||||
OrderNum = 100,
|
||||
Remark = "通知",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo14);
|
||||
DictionaryEntity dictInfo15 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "公告",
|
||||
DictValue = "2",
|
||||
DictType = "sys_notice_type",
|
||||
OrderNum = 99,
|
||||
Remark = "公告",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo15);
|
||||
|
||||
DictionaryEntity dictInfo16 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "正常",
|
||||
DictValue = "0",
|
||||
DictType = "sys_notice_status",
|
||||
OrderNum = 100,
|
||||
Remark = "正常状态",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo16);
|
||||
DictionaryEntity dictInfo17 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "关闭",
|
||||
DictValue = "1",
|
||||
DictType = "sys_notice_status",
|
||||
OrderNum = 99,
|
||||
Remark = "关闭状态",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo17);
|
||||
|
||||
DictionaryEntity dictInfo18 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "新增",
|
||||
DictValue = "1",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 100,
|
||||
Remark = "新增操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo18);
|
||||
DictionaryEntity dictInfo19 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "修改",
|
||||
DictValue = "2",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 99,
|
||||
Remark = "修改操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo19);
|
||||
DictionaryEntity dictInfo22 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "删除",
|
||||
DictValue = "3",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 98,
|
||||
Remark = "删除操作",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo22);
|
||||
DictionaryEntity dictInfo23 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "授权",
|
||||
DictValue = "4",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 97,
|
||||
Remark = "授权操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo23);
|
||||
DictionaryEntity dictInfo24 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "导出",
|
||||
DictValue = "5",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 96,
|
||||
Remark = "导出操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo24);
|
||||
DictionaryEntity dictInfo25 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "导入",
|
||||
DictValue = "6",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 95,
|
||||
Remark = "导入操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo25);
|
||||
DictionaryEntity dictInfo26 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "强退",
|
||||
DictValue = "7",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 94,
|
||||
Remark = "强退操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo26);
|
||||
DictionaryEntity dictInfo27 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "生成代码",
|
||||
DictValue = "8",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 93,
|
||||
Remark = "生成代码操作",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo27);
|
||||
DictionaryEntity dictInfo28 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "清空数据",
|
||||
DictValue = "9",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 92,
|
||||
Remark = "清空数据操作",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo28);
|
||||
|
||||
|
||||
|
||||
DictionaryEntity dictInfo20 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "成功",
|
||||
DictValue = "false",
|
||||
DictType = "sys_common_status",
|
||||
OrderNum = 100,
|
||||
Remark = "正常状态",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dictInfo20);
|
||||
DictionaryEntity dictInfo21 = new DictionaryEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictLabel = "失败",
|
||||
DictValue = "true",
|
||||
DictType = "sys_common_status",
|
||||
OrderNum = 99,
|
||||
Remark = "失败状态",
|
||||
IsDeleted = false,
|
||||
ListClass = "danger"
|
||||
};
|
||||
entities.Add(dictInfo21);
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.Framework.DictionaryManager.Entities;
|
||||
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class DictionaryTypeDataSeed : AbstractDataSeed<DictionaryTypeEntity>
|
||||
{
|
||||
public DictionaryTypeDataSeed(IRepository<DictionaryTypeEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<DictionaryTypeEntity> GetSeedData()
|
||||
{
|
||||
List<DictionaryTypeEntity> entities= new List<DictionaryTypeEntity>();
|
||||
DictionaryTypeEntity dict1 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "用户性别",
|
||||
DictType = "sys_user_sex",
|
||||
OrderNum = 100,
|
||||
Remark = "用户性别列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict1);
|
||||
|
||||
DictionaryTypeEntity dict2 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "菜单状态",
|
||||
DictType = "sys_show_hide",
|
||||
OrderNum = 100,
|
||||
Remark = "菜单状态列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict2);
|
||||
|
||||
DictionaryTypeEntity dict3 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "系统开关",
|
||||
DictType = "sys_normal_disable",
|
||||
OrderNum = 100,
|
||||
Remark = "系统开关列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict3);
|
||||
|
||||
DictionaryTypeEntity dict4 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "任务状态",
|
||||
DictType = "sys_job_status",
|
||||
OrderNum = 100,
|
||||
Remark = "任务状态列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict4);
|
||||
|
||||
DictionaryTypeEntity dict5 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "任务分组",
|
||||
DictType = "sys_job_group",
|
||||
OrderNum = 100,
|
||||
Remark = "任务分组列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict5);
|
||||
|
||||
DictionaryTypeEntity dict6 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "系统是否",
|
||||
DictType = "sys_yes_no",
|
||||
OrderNum = 100,
|
||||
Remark = "系统是否列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict6);
|
||||
|
||||
DictionaryTypeEntity dict7 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "通知类型",
|
||||
DictType = "sys_notice_type",
|
||||
OrderNum = 100,
|
||||
Remark = "通知类型列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict7);
|
||||
DictionaryTypeEntity dict8 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "通知状态",
|
||||
DictType = "sys_notice_status",
|
||||
OrderNum = 100,
|
||||
Remark = "通知状态列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict8);
|
||||
|
||||
DictionaryTypeEntity dict9 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "操作类型",
|
||||
DictType = "sys_oper_type",
|
||||
OrderNum = 100,
|
||||
Remark = "操作类型列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict9);
|
||||
|
||||
|
||||
DictionaryTypeEntity dict10 = new DictionaryTypeEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
DictName = "系统状态",
|
||||
DictType = "sys_common_status",
|
||||
OrderNum = 100,
|
||||
Remark = "登录状态列表",
|
||||
IsDeleted = false,
|
||||
};
|
||||
entities.Add(dict10);
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,69 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class PostDataSeed : AbstractDataSeed<PostEntity>
|
||||
{
|
||||
public PostDataSeed(IRepository<PostEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<PostEntity> GetSeedData()
|
||||
{
|
||||
var entites=new List<PostEntity>();
|
||||
|
||||
PostEntity Post1 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "董事长",
|
||||
PostCode = "ceo",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
entites.Add(Post1);
|
||||
|
||||
PostEntity Post2 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "项目经理",
|
||||
PostCode = "se",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
entites.Add(Post2);
|
||||
|
||||
PostEntity Post3 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "人力资源",
|
||||
PostCode = "hr",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
entites.Add(Post3);
|
||||
|
||||
PostEntity Post4 = new PostEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
PostName = "普通员工",
|
||||
PostCode = "user",
|
||||
OrderNum = 100,
|
||||
IsDeleted = false
|
||||
};
|
||||
|
||||
entites.Add(Post4);
|
||||
return entites;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class RoleDataSeed : AbstractDataSeed<RoleEntity>
|
||||
{
|
||||
public RoleDataSeed(IRepository<RoleEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<RoleEntity> GetSeedData()
|
||||
{
|
||||
var entities = new List<RoleEntity>();
|
||||
RoleEntity role1 = new RoleEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
RoleName = "管理员",
|
||||
RoleCode = "admin",
|
||||
DataScope = DataScopeEnum.ALL,
|
||||
OrderNum = 999,
|
||||
Remark = "管理员",
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(role1);
|
||||
|
||||
RoleEntity role2 = new RoleEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
RoleName = "测试角色",
|
||||
RoleCode = "test",
|
||||
DataScope = DataScopeEnum.ALL,
|
||||
OrderNum = 1,
|
||||
Remark = "测试用的角色",
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(role2);
|
||||
|
||||
RoleEntity role3 = new RoleEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
RoleName = "普通用户",
|
||||
RoleCode = "common",
|
||||
DataScope = DataScopeEnum.ALL,
|
||||
OrderNum = 1,
|
||||
Remark = "正常用户",
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(role3);
|
||||
|
||||
RoleEntity role4 = new RoleEntity()
|
||||
{
|
||||
Id = SnowflakeHelper.NextId,
|
||||
RoleName = "游客用户",
|
||||
RoleCode = "guest",
|
||||
DataScope = DataScopeEnum.ALL,
|
||||
OrderNum = 1,
|
||||
Remark = "可简单浏览",
|
||||
IsDeleted = false
|
||||
};
|
||||
entities.Add(role4);
|
||||
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.DataSeeds;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.DataSeeds
|
||||
{
|
||||
//支持依赖注入执行
|
||||
[AppService(typeof(IDataSeed<UserEntity>))]
|
||||
|
||||
//支持启动时执行
|
||||
[AppService(typeof(IDataSeed))]
|
||||
public class UserDataSeed : AbstractDataSeed<UserEntity>
|
||||
{
|
||||
public UserDataSeed(IRepository<UserEntity> repository) : base(repository)
|
||||
{
|
||||
}
|
||||
|
||||
public override List<UserEntity> GetSeedData()
|
||||
{
|
||||
var entities=new List<UserEntity>();
|
||||
UserEntity user1 = new UserEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
Name = "大橙子",
|
||||
UserName = "cc",
|
||||
Nick = "橙子",
|
||||
Password = "123456",
|
||||
Email = "454313500@qq.com",
|
||||
Phone = 13800000000,
|
||||
Sex = SexEnum.Male,
|
||||
Address = "深圳",
|
||||
Age = 20,
|
||||
Introduction = "还有谁?",
|
||||
OrderNum = 999,
|
||||
Remark = "描述是什么呢?",
|
||||
State = true
|
||||
};
|
||||
user1.BuildPassword();
|
||||
entities.Add(user1);
|
||||
|
||||
UserEntity user2 = new UserEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
Name = "大测试",
|
||||
UserName = "test",
|
||||
Nick = "测试",
|
||||
Password = "123456",
|
||||
Email = "454313500@qq.com",
|
||||
Phone = 15900000000,
|
||||
Sex = SexEnum.Woman,
|
||||
Address = "深圳",
|
||||
Age = 18,
|
||||
Introduction = "还有我!",
|
||||
OrderNum = 1,
|
||||
Remark = "我没有描述!",
|
||||
State = true
|
||||
|
||||
};
|
||||
user2.BuildPassword();
|
||||
entities.Add(user2);
|
||||
|
||||
UserEntity user3 = new UserEntity()
|
||||
{
|
||||
Id = SnowFlakeSingle.Instance.NextId(),
|
||||
Name = "游客",
|
||||
UserName = "guest",
|
||||
Nick = "测试",
|
||||
Password = "123456",
|
||||
Email = "454313500@qq.com",
|
||||
Phone = 15900000000,
|
||||
Sex = SexEnum.Woman,
|
||||
Address = "深圳",
|
||||
Age = 18,
|
||||
Introduction = "临时游客",
|
||||
OrderNum = 1,
|
||||
Remark = "懒得创账号",
|
||||
State = true
|
||||
|
||||
};
|
||||
user3.BuildPassword();
|
||||
entities.Add(user3);
|
||||
|
||||
return entities;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,149 +0,0 @@
|
||||
using Mapster;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Core.Const;
|
||||
using Yi.Framework.Core.CurrentUsers;
|
||||
using Yi.Framework.Core.Exceptions;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.ConstClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 用户领域服务
|
||||
/// </summary>
|
||||
[AppService]
|
||||
public class AccountManager
|
||||
{
|
||||
private readonly IRepository<UserEntity> _repository;
|
||||
public AccountManager(IRepository<UserEntity> repository)
|
||||
{
|
||||
_repository = repository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 登录效验
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task LoginValidationAsync(string userName, string password, Action<UserEntity>? userAction = null)
|
||||
{
|
||||
var user = new UserEntity();
|
||||
if (await ExistAsync(userName, o => user = o))
|
||||
{
|
||||
if (userAction is not null)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
}
|
||||
if (user.Password == MD5Helper.SHA2Encode(password, user.Salt))
|
||||
{
|
||||
return;
|
||||
}
|
||||
throw new UserFriendlyException(UserConst.登录失败_错误);
|
||||
}
|
||||
throw new UserFriendlyException(UserConst.登录失败_不存在);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断账户合法存在
|
||||
/// </summary>
|
||||
/// <param name="userName"></param>
|
||||
/// <param name="userAction"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ExistAsync(string userName, Action<UserEntity>? userAction = null)
|
||||
{
|
||||
var user = await _repository.GetFirstAsync(u => u.UserName == userName && u.State == true);
|
||||
if (userAction is not null)
|
||||
{
|
||||
userAction.Invoke(user);
|
||||
}
|
||||
if (user == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 令牌转换
|
||||
/// </summary>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
public Dictionary<string, object> UserInfoToClaim(UserRoleMenuDto dto)
|
||||
{
|
||||
var claims = new Dictionary<string, object>();
|
||||
claims.Add(TokenTypeConst.Id, dto.User.Id);
|
||||
claims.Add(TokenTypeConst.UserName, dto.User.UserName);
|
||||
if (dto.User.Email is not null)
|
||||
{
|
||||
claims.Add(TokenTypeConst.Email, dto.User.Email);
|
||||
}
|
||||
if (dto.User.Phone is not null)
|
||||
{
|
||||
claims.Add(TokenTypeConst.PhoneNumber, dto.User.Phone);
|
||||
}
|
||||
if (UserConst.Admin.Equals(dto.User.UserName))
|
||||
{
|
||||
claims.Add(TokenTypeConst.Permission, UserConst.AdminPermissionCode);
|
||||
claims.Add(TokenTypeConst.Roles, UserConst.AdminRolesCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
claims.Add(TokenTypeConst.Permission, dto.PermissionCodes.Where(x => !string.IsNullOrEmpty(x)));
|
||||
claims.Add(TokenTypeConst.Roles, dto.RoleCodes.Where(x => !string.IsNullOrEmpty(x)));
|
||||
}
|
||||
|
||||
return claims;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 更新密码
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="newPassword"></param>
|
||||
/// <param name="oldPassword"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
public async Task UpdatePasswordAsync(long userId, string newPassword, string oldPassword)
|
||||
{
|
||||
var user = await _repository.GetByIdAsync(userId);
|
||||
|
||||
if (!user.JudgePassword(oldPassword))
|
||||
{
|
||||
throw new UserFriendlyException("无效更新!原密码错误!");
|
||||
}
|
||||
user.Password = newPassword;
|
||||
user.BuildPassword();
|
||||
await _repository.UpdateAsync(user);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置密码
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> RestPasswordAsync(long userId, string password)
|
||||
{
|
||||
var user = await _repository.GetByIdAsync(userId);
|
||||
user.Id = userId;
|
||||
user.Password = password;
|
||||
user.BuildPassword();
|
||||
return await _repository.UpdateAsync(user);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Dtos
|
||||
{
|
||||
public class UserRoleMenuDto
|
||||
{
|
||||
public UserEntity User { get; set; } = new();
|
||||
public HashSet<RoleEntity> Roles { get; set; } = new();
|
||||
public HashSet<MenuEntity> Menus { get; set; } = new();
|
||||
|
||||
public List<string> RoleCodes { get; set; } = new();
|
||||
public List<string> PermissionCodes { get; set; } = new();
|
||||
}
|
||||
}
|
||||
@@ -1,85 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 部门表
|
||||
///</summary>
|
||||
[SugarTable("Dept")]
|
||||
public partial class DeptEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 部门名称
|
||||
///</summary>
|
||||
public string DeptName { get; set; }=string.Empty;
|
||||
/// <summary>
|
||||
/// 部门编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "DeptCode")]
|
||||
public string DeptCode { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 负责人
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Leader")]
|
||||
public string? Leader { get; set; }
|
||||
/// <summary>
|
||||
/// 父级id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ParentId")]
|
||||
public long ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 菜单表
|
||||
///</summary>
|
||||
[SugarTable("Menu")]
|
||||
public partial class MenuEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单名
|
||||
/// </summary>
|
||||
public string MenuName { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuType")]
|
||||
public MenuTypeEnum MenuType { get; set; } = MenuTypeEnum.Menu;
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PermissionCode")]
|
||||
public string? PermissionCode { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ParentId")]
|
||||
public long ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 菜单图标
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuIcon")]
|
||||
public string? MenuIcon { get; set; }
|
||||
/// <summary>
|
||||
/// 菜单组件路由
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Router")]
|
||||
public string? Router { get; set; }
|
||||
/// <summary>
|
||||
/// 是否为外部链接
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "IsLink")]
|
||||
public bool IsLink { get; set; }
|
||||
/// <summary>
|
||||
/// 是否缓存
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "IsCache")]
|
||||
public bool IsCache { get; set; }
|
||||
/// <summary>
|
||||
/// 是否显示
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "IsShow")]
|
||||
public bool IsShow { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 组件路径
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Component")]
|
||||
public string? Component { get; set; }
|
||||
/// <summary>
|
||||
/// 路由参数
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Query")]
|
||||
public string? Query { get; set; }
|
||||
|
||||
[SugarColumn(IsIgnore = true)]
|
||||
public List<MenuEntity>? Children { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 实体扩展
|
||||
/// </summary>
|
||||
public static class MenuEntityExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// 构建vue3路由
|
||||
/// </summary>
|
||||
/// <param name="menus"></param>
|
||||
/// <returns></returns>
|
||||
public static List<Vue3RouterDto> Vue3RouterBuild(this List<MenuEntity> menus)
|
||||
{
|
||||
menus = menus.Where(m => m.MenuType != MenuTypeEnum.Component).ToList();
|
||||
List<Vue3RouterDto> routers = new();
|
||||
foreach (var m in menus)
|
||||
{
|
||||
|
||||
var r = new Vue3RouterDto();
|
||||
r.OrderNum = m.OrderNum;
|
||||
var routerName = m.Router?.Split("/").LastOrDefault();
|
||||
r.Id = m.Id;
|
||||
r.ParentId = m.ParentId;
|
||||
|
||||
//开头大写
|
||||
r.Name = routerName?.First().ToString().ToUpper() + routerName?.Substring(1);
|
||||
r.Path = m.Router!;
|
||||
r.Hidden = !m.IsShow;
|
||||
|
||||
|
||||
if (m.MenuType == MenuTypeEnum.Catalogue)
|
||||
{
|
||||
r.Redirect = "noRedirect";
|
||||
r.AlwaysShow = true;
|
||||
|
||||
//判断是否为最顶层的路由
|
||||
if (0 == m.ParentId)
|
||||
{
|
||||
r.Component = "Layout";
|
||||
}
|
||||
else
|
||||
{
|
||||
r.Component = "ParentView";
|
||||
}
|
||||
}
|
||||
if (m.MenuType == MenuTypeEnum.Menu)
|
||||
{
|
||||
r.Redirect = "noRedirect";
|
||||
r.AlwaysShow = true;
|
||||
r.Component = m.Component!;
|
||||
r.AlwaysShow = false;
|
||||
}
|
||||
r.Meta = new Meta
|
||||
{
|
||||
Title = m.MenuName!,
|
||||
Icon = m.MenuIcon!,
|
||||
NoCache = !m.IsCache
|
||||
};
|
||||
if (m.IsLink)
|
||||
{
|
||||
r.Meta.link = m.Router!;
|
||||
r.AlwaysShow = false;
|
||||
}
|
||||
|
||||
routers.Add(r);
|
||||
}
|
||||
return TreeHelper.SetTree(routers);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 岗位表
|
||||
///</summary>
|
||||
[SugarTable("Post")]
|
||||
public partial class PostEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }=true;
|
||||
|
||||
/// <summary>
|
||||
/// 岗位编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PostCode")]
|
||||
public string PostCode { get; set; }=string.Empty;
|
||||
/// <summary>
|
||||
/// 岗位名称
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PostName")]
|
||||
public string PostName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
/// <summary>
|
||||
/// 角色部门关系表
|
||||
///</summary>
|
||||
[SugarTable("RoleDept")]
|
||||
public partial class RoleDeptEntity : IEntity<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RoleId")]
|
||||
public long? RoleId { get; set; }
|
||||
/// <summary>
|
||||
/// 部门id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "DeptId")]
|
||||
public long? DeptId { get; set; }
|
||||
|
||||
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 角色表
|
||||
/// </summary>
|
||||
[SugarTable("Role")]
|
||||
public class RoleEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum, IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色名
|
||||
/// </summary>
|
||||
public string RoleName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 角色编码
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RoleCode")]
|
||||
public string RoleCode { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
/// <summary>
|
||||
/// 角色数据范围
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "DataScope")]
|
||||
public DataScopeEnum DataScope { get; set; } = DataScopeEnum.ALL;
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; }=true;
|
||||
|
||||
|
||||
[Navigate(typeof(RoleMenuEntity), nameof(RoleMenuEntity.RoleId), nameof(RoleMenuEntity.MenuId))]
|
||||
public List<MenuEntity> Menus { get; set; }
|
||||
|
||||
[Navigate(typeof(RoleDeptEntity), nameof(RoleDeptEntity.RoleId), nameof(RoleDeptEntity.DeptId))]
|
||||
public List<DeptEntity> Depts { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities;
|
||||
/// <summary>
|
||||
/// 角色菜单关系表
|
||||
///</summary>
|
||||
[SugarTable("RoleMenu")]
|
||||
public partial class RoleMenuEntity : IEntity<long>
|
||||
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "RoleId")]
|
||||
public long RoleId { get; set; }
|
||||
/// <summary>
|
||||
///
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "MenuId")]
|
||||
public long MenuId { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,213 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.EnumClasses;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户表
|
||||
/// </summary>
|
||||
[SugarTable("User")]
|
||||
public class UserEntity : IEntity<long>, ISoftDelete, IAuditedObject, IOrderNum,IState
|
||||
{
|
||||
public UserEntity( )
|
||||
{
|
||||
|
||||
}
|
||||
public UserEntity(string userName,string password,long phone,string nick="萌新" )
|
||||
{
|
||||
Id = SnowflakeHelper.NextId;
|
||||
UserName=userName;
|
||||
Password=password;
|
||||
Phone = phone;
|
||||
Nick = nick;
|
||||
BuildPassword();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 逻辑删除
|
||||
/// </summary>
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 年龄
|
||||
/// </summary>
|
||||
public int? Age { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户名
|
||||
/// </summary>
|
||||
public string UserName { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 密码
|
||||
/// </summary>
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 加密盐值
|
||||
/// </summary>
|
||||
public string Salt { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 头像
|
||||
/// </summary>
|
||||
public string? Icon { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 昵称
|
||||
/// </summary>
|
||||
public string? Nick { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 邮箱
|
||||
/// </summary>
|
||||
public string? Email { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ip
|
||||
/// </summary>
|
||||
public string? Ip { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 地址
|
||||
/// </summary>
|
||||
|
||||
public string? Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 电话
|
||||
/// </summary>
|
||||
public long? Phone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 简介
|
||||
/// </summary>
|
||||
public string? Introduction { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string? Remark { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 性别
|
||||
/// </summary>
|
||||
public SexEnum Sex { get; set; } = SexEnum.Unknown;
|
||||
|
||||
/// <summary>
|
||||
/// 部门id
|
||||
/// </summary>
|
||||
public long? DeptId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 创建时间
|
||||
/// </summary>
|
||||
public DateTime CreationTime { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// 创建者
|
||||
/// </summary>
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改者
|
||||
/// </summary>
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 最后修改时间
|
||||
/// </summary>
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
public int OrderNum { get; set; } = 0;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 状态
|
||||
/// </summary>
|
||||
public bool State { get; set; } = true;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 角色
|
||||
/// </summary>
|
||||
[Navigate(typeof(UserRoleEntity), nameof(UserRoleEntity.UserId), nameof(UserRoleEntity.RoleId))]
|
||||
public List<RoleEntity> Roles { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 岗位
|
||||
/// </summary>
|
||||
|
||||
[Navigate(typeof(UserPostEntity), nameof(UserPostEntity.UserId), nameof(UserPostEntity.PostId))]
|
||||
public List<PostEntity> Posts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 部门
|
||||
/// </summary>
|
||||
|
||||
[Navigate(NavigateType.OneToOne, nameof(DeptId))]
|
||||
public DeptEntity? Dept { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 构建密码,MD5盐值加密
|
||||
/// </summary>
|
||||
public UserEntity BuildPassword(string? password = null)
|
||||
{
|
||||
//如果不传值,那就把自己的password当作传进来的password
|
||||
if (password == null)
|
||||
{
|
||||
if (Password == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(Password));
|
||||
}
|
||||
password = Password;
|
||||
}
|
||||
Salt = MD5Helper.GenerateSalt();
|
||||
Password = MD5Helper.SHA2Encode(password, Salt);
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断密码和加密后的密码是否相同
|
||||
/// </summary>
|
||||
/// <param name="password"></param>
|
||||
/// <returns></returns>
|
||||
public bool JudgePassword(string password)
|
||||
{
|
||||
if (this.Salt is null)
|
||||
{
|
||||
throw new ArgumentNullException(this.Salt);
|
||||
}
|
||||
var p = MD5Helper.SHA2Encode(password, Salt);
|
||||
if (Password == MD5Helper.SHA2Encode(password, Salt))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json.Serialization;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities;
|
||||
/// <summary>
|
||||
/// 用户岗位表
|
||||
///</summary>
|
||||
[SugarTable("UserPost")]
|
||||
public partial class UserPostEntity : IEntity<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "UserId")]
|
||||
public long UserId { get; set; }
|
||||
/// <summary>
|
||||
/// 岗位id
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "PostId")]
|
||||
public long PostId { get; set; }
|
||||
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 用户角色关系表
|
||||
///</summary>
|
||||
[SugarTable("UserRole")]
|
||||
public partial class UserRoleEntity : IEntity<long>
|
||||
{
|
||||
/// <summary>
|
||||
/// 主键
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 角色id
|
||||
/// </summary>
|
||||
public long RoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 用户id
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using Yi.Framework.Ddd.Dtos.Abstract;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Dtos;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Dtos;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity.Repositories
|
||||
{
|
||||
public interface IUserRepository:IRepository<UserEntity>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取当前登录用户的所有信息
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <returns></returns>
|
||||
Task<UserRoleMenuDto> GetUserAllInfoAsync(long userId);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity
|
||||
{
|
||||
[AppService]
|
||||
public class RoleManager
|
||||
{
|
||||
private IRepository<RoleEntity> _repository;
|
||||
private IRepository<RoleMenuEntity> _roleMenuRepository;
|
||||
public RoleManager(IRepository<RoleEntity> repository, IRepository<RoleMenuEntity> roleMenuRepository)
|
||||
{
|
||||
_repository = repository;
|
||||
_roleMenuRepository = roleMenuRepository;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 给角色设置菜单
|
||||
/// </summary>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <param name="menuIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task GiveRoleSetMenuAsync(List<long> roleIds, List<long> menuIds)
|
||||
{
|
||||
//这个是需要事务的,在service中进行工作单元
|
||||
await _roleMenuRepository.DeleteAsync(u => roleIds.Contains(u.RoleId));
|
||||
//遍历用户
|
||||
foreach (var roleId in roleIds)
|
||||
{
|
||||
//添加新的关系
|
||||
List<RoleMenuEntity> roleMenuEntity = new();
|
||||
foreach (var menu in menuIds)
|
||||
{
|
||||
roleMenuEntity.Add(new RoleMenuEntity() {Id=SnowflakeHelper.NextId, RoleId = roleId, MenuId = menu });
|
||||
}
|
||||
//一次性批量添加
|
||||
await _roleMenuRepository.InsertRangeAsync(roleMenuEntity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Identity.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Identity
|
||||
{
|
||||
[AppService]
|
||||
public class UserManager
|
||||
{
|
||||
private readonly IRepository<UserEntity> _repository;
|
||||
private readonly IRepository<UserRoleEntity> _repositoryUserRole;
|
||||
private readonly IRepository<UserPostEntity> _repositoryUserPost;
|
||||
public UserManager(IRepository<UserEntity> repository, IRepository<UserRoleEntity> repositoryUserRole, IRepository<UserPostEntity> repositoryUserPost) =>
|
||||
(_repository, _repositoryUserRole, _repositoryUserPost) =
|
||||
(repository, repositoryUserRole, repositoryUserPost);
|
||||
|
||||
/// <summary>
|
||||
/// 给用户设置角色
|
||||
/// </summary>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="roleIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task GiveUserSetRoleAsync(List<long> userIds, List<long>? roleIds)
|
||||
{
|
||||
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||
await _repositoryUserRole.DeleteAsync(u => userIds.Contains(u.UserId));
|
||||
|
||||
if (roleIds is not null)
|
||||
{
|
||||
//遍历用户
|
||||
foreach (var userId in userIds)
|
||||
{
|
||||
//添加新的关系
|
||||
List<UserRoleEntity> userRoleEntities = new();
|
||||
|
||||
foreach (var roleId in roleIds)
|
||||
{
|
||||
userRoleEntities.Add(new UserRoleEntity() { Id = SnowflakeHelper.NextId, UserId = userId, RoleId = roleId });
|
||||
}
|
||||
//一次性批量添加
|
||||
await _repositoryUserRole.InsertRangeAsync(userRoleEntities);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 给用户设置岗位
|
||||
/// </summary>
|
||||
/// <param name="userIds"></param>
|
||||
/// <param name="postIds"></param>
|
||||
/// <returns></returns>
|
||||
public async Task GiveUserSetPostAsync(List<long> userIds, List<long>? postIds)
|
||||
{
|
||||
//删除用户之前所有的用户角色关系(物理删除,没有恢复的必要)
|
||||
await _repositoryUserPost.DeleteAsync(u => userIds.Contains(u.UserId));
|
||||
if (postIds is not null)
|
||||
{
|
||||
//遍历用户
|
||||
foreach (var userId in userIds)
|
||||
{
|
||||
//添加新的关系
|
||||
List<UserPostEntity> userPostEntities = new();
|
||||
foreach (var post in postIds)
|
||||
{
|
||||
userPostEntities.Add(new UserPostEntity() { Id = SnowflakeHelper.NextId, UserId = userId, PostId = post });
|
||||
}
|
||||
|
||||
//一次性批量添加
|
||||
await _repositoryUserPost.InsertRangeAsync(userPostEntities);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Logs.Entities
|
||||
{
|
||||
[SugarTable("LoginLog")]
|
||||
public class LoginLogEntity : IEntity<long>, ICreationAuditedObject
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 登录用户
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LoginUser")]
|
||||
public string? LoginUser { get; set; }
|
||||
/// <summary>
|
||||
/// 登录地点
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LoginLocation")]
|
||||
public string? LoginLocation { get; set; }
|
||||
/// <summary>
|
||||
/// 登录Ip
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LoginIp")]
|
||||
public string? LoginIp { get; set; }
|
||||
/// <summary>
|
||||
/// 浏览器
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Browser")]
|
||||
public string? Browser { get; set; }
|
||||
/// <summary>
|
||||
/// 操作系统
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Os")]
|
||||
public string? Os { get; set; }
|
||||
/// <summary>
|
||||
/// 登录信息
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "LogMsg")]
|
||||
public string? LogMsg { get; set; }
|
||||
|
||||
public long? CreatorId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
using Cike.EventBus.EventHandlerAbstracts;
|
||||
using IPTools.Core;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UAParser;
|
||||
using Yi.Framework.AspNetCore.Extensions;
|
||||
using Yi.Framework.Ddd.Repositories;
|
||||
using Yi.RBAC.Domain.Logs.Entities;
|
||||
using Yi.RBAC.Domain.Shared.Identity.Etos;
|
||||
|
||||
namespace Yi.RBAC.Domain.Logs.Event
|
||||
{
|
||||
public class LoginEventHandler : IDistributedEventHandler<LoginEventArgs>
|
||||
{
|
||||
private readonly IRepository<LoginLogEntity> _loginLogRepository;
|
||||
private readonly HttpContext _httpContext;
|
||||
public LoginEventHandler(IRepository<LoginLogEntity> loginLogRepository, IHttpContextAccessor httpContextAccessor)
|
||||
{
|
||||
_loginLogRepository = loginLogRepository;
|
||||
_httpContext = httpContextAccessor.HttpContext;
|
||||
}
|
||||
public Task HandlerAsync(LoginEventArgs eventData)
|
||||
{
|
||||
var loginLogEntity = GetLoginLogInfo(_httpContext);
|
||||
loginLogEntity.Id = SnowflakeHelper.NextId;
|
||||
loginLogEntity.LogMsg = eventData.UserName + "登录系统";
|
||||
loginLogEntity.LoginUser = eventData.UserName;
|
||||
loginLogEntity.LoginIp = _httpContext.GetClientIp();
|
||||
|
||||
_loginLogRepository.InsertAsync(loginLogEntity);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取客户端信息
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
private static ClientInfo GetClientInfo(HttpContext context)
|
||||
{
|
||||
var str = context.GetUserAgent();
|
||||
var uaParser = Parser.GetDefault();
|
||||
ClientInfo c = uaParser.Parse(str);
|
||||
return c;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 记录用户登陆信息
|
||||
/// </summary>
|
||||
/// <param name="context"></param>
|
||||
/// <returns></returns>
|
||||
private static LoginLogEntity GetLoginLogInfo(HttpContext context)
|
||||
{
|
||||
var ipAddr = context.GetClientIp();
|
||||
IpInfo location;
|
||||
if (ipAddr == "127.0.0.1")
|
||||
{
|
||||
location = new IpInfo() { Province = "本地", City = "本机" };
|
||||
}
|
||||
else
|
||||
{
|
||||
location = IpTool.Search(ipAddr);
|
||||
}
|
||||
ClientInfo clientInfo = GetClientInfo(context);
|
||||
LoginLogEntity entity = new()
|
||||
{
|
||||
Browser = clientInfo.Device.Family,
|
||||
Os = clientInfo.OS.ToString(),
|
||||
LoginIp = ipAddr,
|
||||
LoginLocation = location.Province + "-" + location.City
|
||||
};
|
||||
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Yi.Framework.Data.Auditing;
|
||||
using Yi.Framework.Data.Entities;
|
||||
using Yi.Framework.Ddd.Entities;
|
||||
|
||||
namespace Yi.RBAC.Domain.Setting.Entities
|
||||
{
|
||||
/// <summary>
|
||||
/// 配置表
|
||||
/// </summary>
|
||||
[SugarTable("Config")]
|
||||
public class ConfigEntity : IEntity<long>, IAuditedObject, IOrderNum, ISoftDelete
|
||||
{
|
||||
[SugarColumn(ColumnName = "Id", IsPrimaryKey = true)]
|
||||
public long Id { get; set; }
|
||||
/// <summary>
|
||||
/// 配置名称
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ConfigName")]
|
||||
public string ConfigName { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 配置键
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ConfigKey")]
|
||||
public string ConfigKey { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 配置值
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ConfigValue")]
|
||||
public string ConfigValue { get; set; } = string.Empty;
|
||||
/// <summary>
|
||||
/// 配置类别
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "ConfigType")]
|
||||
public string? ConfigType { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 排序字段
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "OrderNum")]
|
||||
public int OrderNum { get; set; }
|
||||
/// <summary>
|
||||
/// 描述
|
||||
///</summary>
|
||||
[SugarColumn(ColumnName = "Remark")]
|
||||
public string? Remark { get; set; }
|
||||
public bool IsDeleted { get; set; }
|
||||
|
||||
public DateTime CreationTime { get; set; }
|
||||
|
||||
public long? CreatorId { get; set; }
|
||||
|
||||
public long? LastModifierId { get; set; }
|
||||
|
||||
public DateTime? LastModificationTime { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
<DocumentationFile>./$(AssemblyName)SwaggerDoc.xml</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\GlobalUsings.cs" Link="Properties\GlobalUsings.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="UAParser" Version="3.1.47" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\framework\Yi.Framework.Data\Yi.Framework.Data.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.Caching.MemoryCache\Yi.Framework.Caching.MemoryCache.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.DictionaryManager\Yi.Framework.DictionaryManager.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.EventBus\Yi.Framework.EventBus.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.FileManager\Yi.Framework.FileManager.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.OperLogManager\Yi.Framework.OperLogManager.csproj" />
|
||||
<ProjectReference Include="..\..\..\module\Yi.Framework.Sms.Aliyun\Yi.Framework.Sms.Aliyun.csproj" />
|
||||
<ProjectReference Include="..\Yi.RBAC.Domain.Shared\Yi.RBAC.Domain.Shared.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Yi.RBAC.DomainSwaggerDoc.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
</Project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user