@@ -30,7 +30,6 @@ | |||
<Folder Include="Services\MaterialService\" /> | |||
<Folder Include="Services\RecipesService\" /> | |||
<Folder Include="Services\CustomCodeService\" /> | |||
<Folder Include="Services\SystemService\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -47,6 +47,11 @@ | |||
是否授权 | |||
</summary> | |||
</member> | |||
<member name="F:BPA.MES.Base.Application.ClaimConst.CLAINM_ROLEID"> | |||
<summary> | |||
角色Id | |||
</summary> | |||
</member> | |||
<member name="F:BPA.MES.Base.Application.ClaimConst.SESSION_KEY"> | |||
<summary> | |||
微信session_key | |||
@@ -1215,85 +1220,6 @@ | |||
员工表Id | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.AuthorizeTemplateEntity"> | |||
<summary> | |||
名 称 授权模板表 | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/1/4 17:31:11 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateEntity.Name"> | |||
<summary> | |||
名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateEntity.Remark"> | |||
<summary> | |||
描述 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateEntity.CreateAt"> | |||
<summary> | |||
创建时间 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateEntity.IsDeleted"> | |||
<summary> | |||
是否删除 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.AuthorizeTemplateItemEntity"> | |||
<summary> | |||
名 称 : 授权模板子项表 | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/1/4 17:31:27 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateItemEntity.TB_TemplateId"> | |||
<summary> | |||
模板编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateItemEntity.TB_ModuleId"> | |||
<summary> | |||
模块编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateItemEntity.IsDeleted"> | |||
<summary> | |||
是否删除 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.AuthorizeTemplateMapEntity"> | |||
<summary> | |||
名 称 :授权对象表 | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/1/4 17:31:39 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateMapEntity.TemplateId"> | |||
<summary> | |||
授权模板编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateMapEntity.ObjectId"> | |||
<summary> | |||
授权对象编号(用户编号,角色编号) | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateMapEntity.AuthorizeType"> | |||
<summary> | |||
授权类型 1:用户,2:角色 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.AuthorizeTemplateMapEntity.IsDeleted"> | |||
<summary> | |||
是否删除 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.EmployeeEntity"> | |||
<summary> | |||
名 称 :员工信息 | |||
@@ -1398,6 +1324,29 @@ | |||
是否删除 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Entitys.RoleModuleEntity"> | |||
<summary> | |||
名 称 :角色权限表 | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/8/31 15:56:02 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.RoleModuleEntity.RoleId"> | |||
<summary> | |||
角色Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.RoleModuleEntity.ModuleId"> | |||
<summary> | |||
模块Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.Entitys.RoleModuleEntity.ParentId"> | |||
<summary> | |||
父级模块 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.OperLogAttribute"> | |||
<summary> | |||
名 称 :接口AOP | |||
@@ -7793,360 +7742,6 @@ | |||
已授权 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateInput"> | |||
<summary> | |||
[授权模块]入参基础 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateInput.Name"> | |||
<summary> | |||
名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateInput.Remark"> | |||
<summary> | |||
描述 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateAddInput"> | |||
<summary> | |||
[授权模块]添加入参 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateUpdateInput"> | |||
<summary> | |||
[授权模块]修改入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateUpdateInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateDelInput"> | |||
<summary> | |||
[授权模块]删除入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateDelInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateQueryInput"> | |||
<summary> | |||
[授权模块]普通查询入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateQueryInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateQueryPageInput"> | |||
<summary> | |||
[授权模块]分页查询入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateQueryPageInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateQueryPageInput.Keyword"> | |||
<summary> | |||
关键字 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorizeTemplateOutput"> | |||
<summary> | |||
名 称 :授权模块输出 | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/1/4 9:48:24 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateOutput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateOutput.Name"> | |||
<summary> | |||
名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorizeTemplateOutput.Remark"> | |||
<summary> | |||
描述 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleInput"> | |||
<summary> | |||
[授权模块]入参基础 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Childrens"> | |||
<summary> | |||
子级列表 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.HasPermission"> | |||
<summary> | |||
拥有权限 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Id"> | |||
<summary> | |||
模块编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Category"> | |||
<summary> | |||
类别 1:菜单,2:视图,3:功能 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.OpenType"> | |||
<summary> | |||
菜单打开方式 0:框架内嵌,1:新开页面 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.ParentId"> | |||
<summary> | |||
父级编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Name"> | |||
<summary> | |||
名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Icon"> | |||
<summary> | |||
图标 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Url"> | |||
<summary> | |||
地址 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Sort"> | |||
<summary> | |||
排序码 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.IsDisabled"> | |||
<summary> | |||
启用禁用 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleInput.Children"> | |||
<summary> | |||
子集 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleAddInput"> | |||
<summary> | |||
[授权模块]添加入参 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModulesAddInput"> | |||
<summary> | |||
[授权模块]批量授权信息 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModulesAddInput.TemplateName"> | |||
<summary> | |||
模板名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModulesAddInput.ModuleIds"> | |||
<summary> | |||
授权模块 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleUpdateInput"> | |||
<summary> | |||
[授权模块]修改入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleUpdateInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleDelInput"> | |||
<summary> | |||
[授权模块]删除入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleDelInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleQueryInput"> | |||
<summary> | |||
[授权模块]普通查询入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleQueryInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleQueryPageInput"> | |||
<summary> | |||
[授权模块]分页查询入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleQueryPageInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemInput"> | |||
<summary> | |||
[账号信息]入参基础 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemInput.TB_TemplateId"> | |||
<summary> | |||
模板Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemInput.TB_ModuleIds"> | |||
<summary> | |||
模块Id | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemAddInput"> | |||
<summary> | |||
[账号信息]添加入参 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemUpdateInput"> | |||
<summary> | |||
[账号信息]修改入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemUpdateInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemDelInput"> | |||
<summary> | |||
[账号信息]删除入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemDelInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemQueryInput"> | |||
<summary> | |||
[账号信息]普通查询入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemQueryInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemQueryPageInput"> | |||
<summary> | |||
[账号信息]分页查询入参 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemQueryPageInput.Id"> | |||
<summary> | |||
主键 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleItemOutput"> | |||
<summary> | |||
名 称 : | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/1/4 17:20:51 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleItemOutput.Id"> | |||
<summary> | |||
模块编号 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.AuthorModuleOutput"> | |||
<summary> | |||
名 称 :授权模块输出 | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/1/4 17:18:24 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Childrens"> | |||
<summary> | |||
子级列表 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.HasPermission"> | |||
<summary> | |||
拥有权限 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Id"> | |||
<summary> | |||
模块编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Category"> | |||
<summary> | |||
类别 1:菜单,2:视图,3:功能 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.OpenType"> | |||
<summary> | |||
菜单打开方式 0:框架内嵌,1:新开页面 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.ParentId"> | |||
<summary> | |||
父级编号 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Name"> | |||
<summary> | |||
名称 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Icon"> | |||
<summary> | |||
图标 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Url"> | |||
<summary> | |||
地址 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Sort"> | |||
<summary> | |||
排序码 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.IsDisabled"> | |||
<summary> | |||
启用禁用 | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.AuthorModuleOutput.Children"> | |||
<summary> | |||
子集 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.EmployeeInput"> | |||
<summary> | |||
名 称 : | |||
@@ -8667,6 +8262,49 @@ | |||
关键字 | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.RoleModuleDto"> | |||
<summary> | |||
名 称 : | |||
创 建 人 :yangxiao | |||
创建时间 : 2023/8/31 15:58:31 | |||
描 述 : | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleDto.RoleId"> | |||
<summary> | |||
角色Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleDto.ModuleId"> | |||
<summary> | |||
模块Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleDto.ParentId"> | |||
<summary> | |||
父级Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleAddInput.RoleId"> | |||
<summary> | |||
角色Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleOutput.RoleId"> | |||
<summary> | |||
角色Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleOutput.ModuleId"> | |||
<summary> | |||
模块Id | |||
</summary> | |||
</member> | |||
<member name="P:BPA.MES.Base.Application.RoleModuleQuery.RoleId"> | |||
<summary> | |||
角色Id | |||
</summary> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.RoleOutput"> | |||
<summary> | |||
名 称 :角色信息 | |||
@@ -8775,14 +8413,6 @@ | |||
</summary> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.AuthorizeService.GetAuthorityModuleIdsAsync(System.String)"> | |||
<summary> | |||
获取权限模块编号 | |||
</summary> | |||
<param name="userId"></param> | |||
<returns></returns> | |||
<exception cref="T:System.NotImplementedException"></exception> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.AuthorizeService.AccountPageList(BPA.MES.Base.Application.AccountQueryPageInput)"> | |||
<summary> | |||
获取账户信息 | |||
@@ -8811,13 +8441,6 @@ | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.AuthorizeService.GetAuthorityModuleIdsAsync(System.Func{System.Int32,System.String})"> | |||
<summary> | |||
获取授权模块编号 | |||
</summary> | |||
<param name="getObjectId"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.AuthorizeService.EditEmployee(BPA.MES.Base.Application.EmployeeUpdateInput)"> | |||
<summary> | |||
编辑员工 | |||
@@ -8839,6 +8462,20 @@ | |||
<param name="employeeId"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.AuthorizeService.AddRoleModule(BPA.MES.Base.Application.RoleModuleAddInput)"> | |||
<summary> | |||
分配角色权限 | |||
</summary> | |||
<param name="input"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="M:BPA.MES.Base.Application.AuthorizeService.RoleModuleList(System.String)"> | |||
<summary> | |||
根据角色获取权限模块 | |||
</summary> | |||
<param name="RoleId"></param> | |||
<returns></returns> | |||
</member> | |||
<member name="T:BPA.MES.Base.Application.Subscriber.ToDoEventSubscriber"> | |||
<summary> | |||
名 称 : | |||
@@ -37,6 +37,10 @@ | |||
/// </summary> | |||
public const string CLAINM_ISAUTH = "0"; | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public const string CLAINM_ROLEID = ""; | |||
/// <summary> | |||
/// 微信session_key | |||
/// </summary> | |||
public const string SESSION_KEY = "session_key"; | |||
@@ -1,29 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 授权模板表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:31:11 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_authorizetemplate")] | |||
public class AuthorizeTemplateEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime? CreateAt { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public bool IsDeleted { get; set; } | |||
} | |||
} |
@@ -1,27 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 : 授权模板子项表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:31:27 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_authorizetemplate_item")] | |||
public class AuthorizeTemplateItemEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 模板编号 | |||
/// </summary> | |||
public string TB_TemplateId { get; set; } | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string TB_ModuleId { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public bool IsDeleted { get; set; } | |||
} | |||
} |
@@ -1,30 +0,0 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 :授权对象表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:31:39 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_authorizetemplatemap")] | |||
public class AuthorizeTemplateMapEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 授权模板编号 | |||
/// </summary> | |||
public string TemplateId { get; set; } | |||
/// <summary> | |||
/// 授权对象编号(用户编号,角色编号) | |||
/// </summary> | |||
public string ObjectId { get; set; } | |||
/// <summary> | |||
/// 授权类型 1:用户,2:角色 | |||
/// </summary> | |||
public int AuthorizeType { get; set; } | |||
/// <summary> | |||
/// 是否删除 | |||
/// </summary> | |||
public bool IsDeleted { get; set; } | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
namespace BPA.MES.Base.Application.Entitys | |||
{ | |||
/// <summary> | |||
/// 名 称 :角色权限表 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/8/31 15:56:02 | |||
/// 描 述 : | |||
/// </summary> | |||
[SugarTable("sys_role_module")] | |||
public class RoleModuleEntity : DEntityBase | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public string ModuleId { get; set; } | |||
/// <summary> | |||
/// 父级模块 | |||
/// </summary> | |||
[SugarColumn(IsNullable =true)] | |||
public string ParentId { get; set; } | |||
} | |||
} |
@@ -1,134 +0,0 @@ | |||
///<summary> | |||
/// 名 称 :[授权模块]实体基础 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/3 10:21:42 | |||
/// 描 述 | |||
/// </summary> | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// [授权模块]入参基础 | |||
/// </summary> | |||
public class AuthorModuleInput | |||
{ | |||
/// <summary> | |||
/// 子级列表 | |||
/// </summary> | |||
public List<AuthorModuleInput>? Childrens { get; set; } | |||
/// <summary> | |||
/// 拥有权限 | |||
/// </summary> | |||
public bool HasPermission { get; set; } | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 类别 1:菜单,2:视图,3:功能 | |||
/// </summary> | |||
public int Category { get; set; } | |||
/// <summary> | |||
/// 菜单打开方式 0:框架内嵌,1:新开页面 | |||
/// </summary> | |||
public int OpenType { get; set; } | |||
/// <summary> | |||
/// 父级编号 | |||
/// </summary> | |||
public string ParentId { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { set; get; } | |||
/// <summary> | |||
/// 图标 | |||
/// </summary> | |||
public string Icon { set; get; } | |||
/// <summary> | |||
/// 地址 | |||
/// </summary> | |||
public string Url { set; get; } | |||
/// <summary> | |||
/// 排序码 | |||
/// </summary> | |||
public int Sort { set; get; } | |||
/// <summary> | |||
/// 启用禁用 | |||
/// </summary> | |||
public bool IsDisabled { get; set; } | |||
/// <summary> | |||
/// 子集 | |||
/// </summary> | |||
public List<ModuleTreeInput>? Children { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]添加入参 | |||
/// </summary> | |||
public class AuthorModuleAddInput : AuthorModuleInput | |||
{ | |||
} | |||
/// <summary> | |||
/// [授权模块]批量授权信息 | |||
/// </summary> | |||
public class AuthorModulesAddInput | |||
{ | |||
/// <summary> | |||
/// 模板名称 | |||
/// </summary> | |||
public string TemplateName { set; get; } | |||
/// <summary> | |||
/// 授权模块 | |||
/// </summary> | |||
public List<string> ModuleIds { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]修改入参 | |||
/// </summary> | |||
public class AuthorModuleUpdateInput : AuthorModuleInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]删除入参 | |||
/// </summary> | |||
public class AuthorModuleDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]普通查询入参 | |||
/// </summary> | |||
public class AuthorModuleQueryInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]分页查询入参 | |||
/// </summary> | |||
public class AuthorModuleQueryPageInput : RequestPage | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
} |
@@ -1,70 +0,0 @@ | |||
///<summary> | |||
/// 名 称 :[账号信息]实体基础 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/3 10:21:42 | |||
/// 描 述 | |||
/// </summary> | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// [账号信息]入参基础 | |||
/// </summary> | |||
public class AuthorModuleItemInput | |||
{ | |||
/// <summary> | |||
/// 模板Id | |||
/// </summary> | |||
public string TB_TemplateId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public List<string> TB_ModuleIds { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]添加入参 | |||
/// </summary> | |||
public class AuthorModuleItemAddInput : AuthorModuleItemInput | |||
{ | |||
} | |||
/// <summary> | |||
/// [账号信息]修改入参 | |||
/// </summary> | |||
public class AuthorModuleItemUpdateInput : AuthorModuleItemInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]删除入参 | |||
/// </summary> | |||
public class AuthorModuleItemDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]普通查询入参 | |||
/// </summary> | |||
public class AuthorModuleItemQueryInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [账号信息]分页查询入参 | |||
/// </summary> | |||
public class AuthorModuleItemQueryPageInput : RequestPage | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
} |
@@ -1,17 +0,0 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 : | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:20:51 | |||
/// 描 述 : | |||
/// </summary> | |||
public class AuthorModuleItemOutput | |||
{ | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string Id { get; set; } | |||
} | |||
} |
@@ -1,68 +0,0 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 :授权模块输出 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 17:18:24 | |||
/// 描 述 : | |||
/// </summary> | |||
public class AuthorModuleOutput | |||
{ | |||
/// <summary> | |||
/// 子级列表 | |||
/// </summary> | |||
public List<AuthorModuleOutput>? Childrens { get; set; } | |||
/// <summary> | |||
/// 拥有权限 | |||
/// </summary> | |||
public bool HasPermission { get; set; } | |||
/// <summary> | |||
/// 模块编号 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 类别 1:菜单,2:视图,3:功能 | |||
/// </summary> | |||
public int Category { get; set; } | |||
/// <summary> | |||
/// 菜单打开方式 0:框架内嵌,1:新开页面 | |||
/// </summary> | |||
public int OpenType { get; set; } | |||
/// <summary> | |||
/// 父级编号 | |||
/// </summary> | |||
public string ParentId { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { set; get; } | |||
/// <summary> | |||
/// 图标 | |||
/// </summary> | |||
public string Icon { set; get; } | |||
/// <summary> | |||
/// 地址 | |||
/// </summary> | |||
public string Url { set; get; } | |||
/// <summary> | |||
/// 排序码 | |||
/// </summary> | |||
public int Sort { set; get; } | |||
/// <summary> | |||
/// 启用禁用 | |||
/// </summary> | |||
public bool IsDisabled { get; set; } | |||
/// <summary> | |||
/// 子集 | |||
/// </summary> | |||
public List<ModuleTreeInput>? Children { get; set; } | |||
} | |||
} |
@@ -1,74 +0,0 @@ | |||
///<summary> | |||
/// 名 称 :[授权模块]实体基础 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/3 10:21:42 | |||
/// 描 述 | |||
/// </summary> | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// [授权模块]入参基础 | |||
/// </summary> | |||
public class AuthorizeTemplateInput | |||
{ | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]添加入参 | |||
/// </summary> | |||
public class AuthorizeTemplateAddInput : AuthorizeTemplateInput | |||
{ | |||
} | |||
/// <summary> | |||
/// [授权模块]修改入参 | |||
/// </summary> | |||
public class AuthorizeTemplateUpdateInput : AuthorizeTemplateInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]删除入参 | |||
/// </summary> | |||
public class AuthorizeTemplateDelInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]普通查询入参 | |||
/// </summary> | |||
public class AuthorizeTemplateQueryInput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
} | |||
/// <summary> | |||
/// [授权模块]分页查询入参 | |||
/// </summary> | |||
public class AuthorizeTemplateQueryPageInput : RequestPage | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string? Id { get; set; } | |||
/// <summary> | |||
/// 关键字 | |||
/// </summary> | |||
public string Keyword { get; set; } | |||
} | |||
} |
@@ -1,24 +0,0 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 :授权模块输出 | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/1/4 9:48:24 | |||
/// 描 述 : | |||
/// </summary> | |||
public class AuthorizeTemplateOutput | |||
{ | |||
/// <summary> | |||
/// 主键 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 描述 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
namespace BPA.MES.Base.Application | |||
{ | |||
/// <summary> | |||
/// 名 称 : | |||
/// 创 建 人 :yangxiao | |||
/// 创建时间 : 2023/8/31 15:58:31 | |||
/// 描 述 : | |||
/// </summary> | |||
public class RoleModuleDto | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public string ModuleId { get; set; } | |||
/// <summary> | |||
/// 父级Id | |||
/// </summary> | |||
public string ParentId { get; set; } | |||
} | |||
public class RoleModuleAddInput | |||
{ | |||
public List<RoleModuleDto> ModuleIds { get; set; } | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
} | |||
public class RoleModuleOutput | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
/// <summary> | |||
/// 模块Id | |||
/// </summary> | |||
public string ModuleId { get; set; } | |||
} | |||
public class RoleModuleQuery | |||
{ | |||
/// <summary> | |||
/// 角色Id | |||
/// </summary> | |||
public string RoleId { get; set; } | |||
} | |||
} |
@@ -50,6 +50,7 @@ | |||
{ClaimConst.CLAINM_USERID, User.Id}, | |||
{ClaimConst.CLAINM_NAME,User.Name}, | |||
{ClaimConst.CLAINM_ISAUTH,User.IsAdmin}, | |||
{ClaimConst.CLAINM_ROLEID,User.RoleId } | |||
}, 43200); | |||
// 设置Swagger自动登录 | |||
_httpContextAccessor.HttpContext.SigninToSwagger(accessToken); | |||
@@ -104,71 +105,24 @@ | |||
async Task<UserRoleCacheDto> GetJurisdictionItemsAsync() | |||
{ | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
string roleId = App.User?.FindFirst(ClaimConst.CLAINM_ROLEID)?.Value; | |||
var result = new UserRoleCacheDto(); | |||
result.AuthorizationCodes = (await GetAuthorityModuleIdsAsync(userId)) ?? new List<string>(); | |||
//根据角色获取权限Id | |||
var rolemodules = await db.Queryable<RoleModuleEntity>().Where(x => x.RoleId == roleId).ToListAsync(); | |||
result.AuthorizationCodes = rolemodules.Select(t => t.ModuleId).ToList(); | |||
if (result.AuthorizationCodes.HasVal()) | |||
{ | |||
var temp = await db.Queryable<ModuleEntity>().Where(t => t.Category == 1 || t.Category == 2 || t.Category == 3) | |||
.Where(t => result.AuthorizationCodes.Contains(t.Id) && !t.IsDisabled).OrderBy(t => t.ParentId) | |||
var temp = await db.Queryable<ModuleEntity>().Where(t => result.AuthorizationCodes.Contains(t.Id) && !t.IsDisabled).OrderBy(t => t.ParentId) | |||
.ToListAsync(); | |||
result.Menus = temp.Adapt<List<UserMenu>>().BuildTree(); | |||
} | |||
result.Menus = result.Menus ?? new List<UserMenu>(); | |||
result.Menus ??= new List<UserMenu>(); | |||
return result; | |||
} | |||
/// <summary> | |||
/// 获取权限模块编号 | |||
/// </summary> | |||
/// <param name="userId"></param> | |||
/// <returns></returns> | |||
/// <exception cref="NotImplementedException"></exception> | |||
[HttpGet] | |||
async Task<List<string>> GetAuthorityModuleIdsAsync(string userId) | |||
{ | |||
List<string> moduleIds = null; | |||
var user = await db.Queryable<EmployeeEntity>().Where(m => m.Id == userId).FirstAsync(); | |||
if (user == null) | |||
{ | |||
return moduleIds; | |||
} | |||
//超管用户 | |||
if (user.IsAdmin) | |||
{ | |||
moduleIds = await db.Queryable<ModuleEntity>() | |||
.OrderBy(m => m.ParentId).OrderBy(m => m.Name) | |||
.ToListAsync(m => m.Id); | |||
} | |||
else | |||
{ | |||
moduleIds = await GetAuthorityModuleIdsAsync((category) => | |||
{ | |||
if (category == 1) | |||
{ | |||
return user.Id; | |||
} | |||
if (category == 2) | |||
{ | |||
return user.RoleId; | |||
} | |||
else | |||
{ | |||
throw new NotImplementedException("无效授权类别"); | |||
} | |||
}); | |||
} | |||
return moduleIds; | |||
} | |||
/// <summary> | |||
/// 获取账户信息 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
@@ -211,33 +165,7 @@ | |||
var entity = input.Adapt<AccountEntity>(); | |||
return await _dbContext.Deleteable(entity).Where(x=>x.Id==input.Id).ExecuteCommandHasChangeAsync(); | |||
} | |||
/// <summary> | |||
/// 获取授权模块编号 | |||
/// </summary> | |||
/// <param name="getObjectId"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
async Task<List<string>> GetAuthorityModuleIdsAsync(Func<int, string> getObjectId) | |||
{ | |||
for (int index = 1; index <= 2; index++) | |||
{ | |||
var objectId = getObjectId(index); | |||
var templateIds = await db.Queryable<AuthorizeTemplateMapEntity>().LeftJoin<AuthorizeTemplateEntity>((t, x) => t.TemplateId == x.Id) | |||
.Where((t, x) => t.AuthorizeType == index && t.ObjectId == objectId).ToListAsync(t => t.TemplateId); | |||
if (!templateIds.HasVal() || templateIds.Count == 0) | |||
{ | |||
continue; | |||
} | |||
return await db.Queryable<AuthorizeTemplateItemEntity>().LeftJoin<ModuleEntity>((t, x) => t.TB_ModuleId == x.Id) | |||
.Where((t, x) => templateIds.Contains(t.TB_TemplateId)) | |||
.GroupBy((t, x) => t.TB_ModuleId).ToListAsync(t => t.TB_ModuleId); | |||
} | |||
return null; | |||
} | |||
#endregion | |||
#region 角色 | |||
[HttpPost] | |||
public async Task<bool> AddRole(RoleAddInput input) | |||
@@ -349,174 +277,8 @@ | |||
} | |||
#endregion | |||
#region 授权模板 | |||
[HttpPost] | |||
public async Task<bool> AddAuthorTemp(AuthorizeTemplateAddInput input) | |||
{ | |||
if (await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Name == input.Name && it.IsDeleted == false).AnyAsync()) | |||
throw Oops.Bah("模板名称已经存在"); | |||
var data = await db.Insertable(input.Adapt<AuthorizeTemplateEntity>()).ExecuteCommandAsync(); | |||
return data > 0; | |||
} | |||
[HttpPost] | |||
public async Task<bool> EditAuthorTemp(AuthorizeTemplateUpdateInput input) | |||
{ | |||
if (!await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Id == input.Id && it.IsDeleted == false).AnyAsync()) | |||
throw Oops.Bah("模板不存在或已被删除"); | |||
if (await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Id != input.Id && it.Name == input.Name && it.IsDeleted == false).AnyAsync()) | |||
throw Oops.Bah("模板名称已经存在"); | |||
return await db.Updateable<AuthorizeTemplateEntity>(input).Where(a => a.Id == input.Id).ExecuteCommandHasChangeAsync(); | |||
} | |||
[HttpGet] | |||
public async Task<bool> RemoveAuthorTemp(string input) | |||
{ | |||
var f1 = await db.Updateable<AuthorizeTemplateEntity>().SetColumns(t => t.IsDeleted == true).Where(t => t.Id == input).ExecuteCommandHasChangeAsync(); | |||
var f2 = await db.Updateable<AuthorizeTemplateItemEntity>().SetColumns(T => T.IsDeleted == true).Where(t => t.TB_TemplateId == input).ExecuteCommandHasChangeAsync(); | |||
return f1 && f2; | |||
} | |||
[HttpPost] | |||
public async Task<SqlSugarPagedList<AuthorizeTemplateOutput>> QueryAuthorTemp(AuthorizeTemplateQueryPageInput input) | |||
{ | |||
RefAsync<int> Total = 0; | |||
var data = await db.Queryable<AuthorizeTemplateEntity>().Where(t => !t.IsDeleted) | |||
.WhereIF(!string.IsNullOrEmpty(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.OrderByDescending(t => t.CreateAt) | |||
.Select<AuthorizeTemplateOutput>() | |||
.ToPagedListAsync(input.PageIndex, input.PageSize); | |||
return data; | |||
} | |||
public async Task<AuthorizeTemplateOutput> GetAuthorTemp(string input) | |||
{ | |||
var data = await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Id == input && it.IsDeleted == false).FirstAsync(); | |||
return data.Adapt<AuthorizeTemplateOutput>(); | |||
} | |||
#endregion | |||
#region 授权模板详情 | |||
[HttpGet] | |||
public async Task<List<AuthorizeTemplateItemEntity>> GetModuleByTemplateId(string input) | |||
{ | |||
var entity =await db.Queryable<AuthorizeTemplateItemEntity>().Where(m => m.TB_TemplateId == input).ToListAsync(); | |||
return entity; | |||
} | |||
[HttpPost] | |||
public async Task<bool> EditTemplateItem(AuthorModuleItemUpdateInput input) | |||
{ | |||
var temp = await db.Queryable<AuthorizeTemplateEntity>().FirstAsync(t => t.Id == input.TB_TemplateId && t.IsDeleted == false); | |||
try | |||
{ | |||
db.Ado.BeginTran(); | |||
await db.Deleteable<AuthorizeTemplateItemEntity>() | |||
.Where(t => t.TB_TemplateId == input.TB_TemplateId).ExecuteCommandAsync(); | |||
var entity = input.TB_ModuleIds.Distinct().ToList().ConvertAll(t => new AuthorizeTemplateItemEntity | |||
{ | |||
TB_ModuleId = t, | |||
TB_TemplateId = input.TB_TemplateId | |||
}); | |||
await db.Insertable(entity).ExecuteCommandAsync(); | |||
db.Ado.CommitTran(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Bah(ex.Message); | |||
} | |||
} | |||
[HttpPost] | |||
public async Task<List<AuthorizeOutput>> GetAuthorizeObjects(AuthorizeInput input) | |||
{ | |||
List<AuthorizeOutput> result; | |||
if (input.Type == 2) | |||
{ | |||
var temp = await db.Queryable<RoleEntity>() | |||
.Where(t => t.RoleType != 1) | |||
.Where(t => t.IsDeleted == false) | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.OrderBy(t => t.RoleType) | |||
.OrderBy(t => t.Name) | |||
.ToListAsync(); | |||
result = temp.Adapt<List<AuthorizeOutput>>(); | |||
db.ThenMapper(result, item => | |||
{ | |||
item.IsAuthorized = db.Queryable<AuthorizeTemplateMapEntity>() | |||
.Where(m => m.TemplateId == input.TemplateId && m.AuthorizeType == input.Type && m.ObjectId == item.Id).Any(); | |||
}); | |||
} | |||
else | |||
{ | |||
var temp = await db.Queryable<EmployeeEntity>() | |||
.Where(t => t.IsAdmin == false) | |||
.WhereIF(!string.IsNullOrWhiteSpace(input.Keyword), t => t.Name.Contains(input.Keyword)) | |||
.OrderBy(t => t.Name) | |||
.ToListAsync(); | |||
result = temp.Adapt<List<AuthorizeOutput>>(); | |||
db.ThenMapper(result, item => | |||
{ | |||
item.IsAuthorized = db.Queryable<AuthorizeTemplateMapEntity>().Where(t => t.IsDeleted == false) | |||
.Where(m => m.TemplateId == input.TemplateId && m.AuthorizeType == input.Type && m.ObjectId == item.Id).Any(); | |||
}); | |||
} | |||
if (result.HasVal()) | |||
{ | |||
result = result.OrderByDescending(m => m.IsAuthorized).ThenBy(m => m.Name).ToList(); | |||
} | |||
return result; | |||
} | |||
[HttpPost] | |||
public async Task<bool> RemoveAuthorize(AuthorizeInput input) | |||
{ | |||
var objectIds = input.ObjectIds.Distinct().ToArray(); | |||
return await db.Updateable<AuthorizeTemplateMapEntity>().SetColumns(t => t.IsDeleted == true) | |||
.Where(it => it.TemplateId == input.TemplateId && it.AuthorizeType == input.Type && objectIds.Contains(it.ObjectId)) | |||
.ExecuteCommandHasChangeAsync(); | |||
} | |||
[HttpPost] | |||
public async Task AddAuthorize(AuthorMapAddInput input) | |||
{ | |||
foreach (var item in input.TemplateIds.Distinct()) | |||
{ | |||
if (!await _dbContext.Queryable<AuthorizeTemplateMapEntity>().AnyAsync(m => m.TemplateId == item && m.AuthorizeType == input.AuthorizeType && m.IsDeleted == false && m.ObjectId == input.ObjectId)) | |||
{ | |||
await _dbContext.Insertable(new AuthorizeTemplateMapEntity() | |||
{ | |||
TemplateId = item, | |||
ObjectId = input.ObjectId, | |||
AuthorizeType = input.AuthorizeType | |||
}).ExecuteCommandAsync(); | |||
} | |||
} | |||
} | |||
[HttpPost] | |||
public async Task<bool> SaveAuthorize(AuthorModulesAddInput input) | |||
{ | |||
if (await db.Queryable<AuthorizeTemplateEntity>().Where(it => it.Name == input.TemplateName && it.IsDeleted == false).AnyAsync()) | |||
{ | |||
throw Oops.Bah("模板名称已经存在"); | |||
} | |||
AuthorizeTemplateEntity Model = new AuthorizeTemplateEntity(); | |||
Model.Name = input.TemplateName; | |||
List<AuthorizeTemplateItemEntity> templateItems = input.ModuleIds.ConvertAll(m => new AuthorizeTemplateItemEntity | |||
{ | |||
TB_TemplateId = Model.Id, | |||
TB_ModuleId = m | |||
}); | |||
try | |||
{ | |||
db.Ado.BeginTran(); | |||
var f1 = (await db.Insertable(Model).ExecuteCommandAsync()) > 0; | |||
var f2 = (await _dbContext.Insertable(templateItems).ExecuteCommandAsync()) > 0; | |||
db.Ado.CommitTran(); | |||
return f1 && f2; | |||
} | |||
catch (Exception) | |||
{ | |||
db.Ado.RollbackTran(); | |||
return false; | |||
} | |||
} | |||
[HttpGet] | |||
public async Task<bool> RestoreAccountByUser(string input) | |||
{ | |||
var Demo = "123456".ToMD5Encrypt(); | |||
@@ -629,6 +391,50 @@ | |||
var data = await db.Queryable<EmployeeEntity>().Where(t => t.IsAdmin == false).ToListAsync(); | |||
return data.Adapt<List<EmployeeOutput>>(); | |||
} | |||
/// <summary> | |||
/// 分配角色权限 | |||
/// </summary> | |||
/// <param name="input"></param> | |||
/// <returns></returns> | |||
[HttpPost] | |||
public async Task<bool> AddRoleModule(RoleModuleAddInput input) | |||
{ | |||
List<RoleModuleEntity> entitys = new(); | |||
foreach (var item in input.ModuleIds) | |||
{ | |||
RoleModuleEntity entity = new() | |||
{ | |||
ModuleId = item.ModuleId, | |||
ParentId = item.ParentId, | |||
RoleId = input.RoleId | |||
}; | |||
entitys.Add(entity); | |||
} | |||
try | |||
{ | |||
_dbContext.Ado.BeginTran(); | |||
await _dbContext.Deleteable<RoleModuleEntity>().Where(x => x.RoleId == input.RoleId).ExecuteCommandAsync(); | |||
await _dbContext.Insertable(entitys).ExecuteCommandAsync(); | |||
_dbContext.Ado.CommitTran(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Bah(ex.Message); | |||
} | |||
} | |||
/// <summary> | |||
/// 根据角色获取权限模块 | |||
/// </summary> | |||
/// <param name="RoleId"></param> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public async Task<List<RoleModuleOutput>> RoleModuleList(string RoleId) | |||
{ | |||
var entitys = await _dbContext.Queryable<RoleModuleEntity>().Where(x => x.RoleId == RoleId).ToListAsync(); | |||
var output = entitys.Adapt<List<RoleModuleOutput>>(); | |||
return output; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -35,6 +35,8 @@ public interface IAuthorizeService | |||
Task<RoleOutput> GetRole(string input); | |||
Task<List<RoleOutput>> GetRoleList(); | |||
Task<SqlSugarPagedList<RoleOutput>> QueryRole(RoleQueryPageInput input); | |||
Task<bool> AddRoleModule(RoleModuleAddInput input); | |||
#endregion | |||
#region 模块 | |||
@@ -44,20 +46,5 @@ public interface IAuthorizeService | |||
Task<List<ModuleTreeOutput>> GetTreeGrid(ModuleTreeQueryInput input); | |||
#endregion | |||
#region 授权模板 | |||
Task<bool> AddAuthorTemp(AuthorizeTemplateAddInput input); | |||
Task<bool> EditAuthorTemp(AuthorizeTemplateUpdateInput input); | |||
Task<bool> RemoveAuthorTemp(string input); | |||
Task<SqlSugarPagedList<AuthorizeTemplateOutput>> QueryAuthorTemp(AuthorizeTemplateQueryPageInput input); | |||
Task<AuthorizeTemplateOutput> GetAuthorTemp(string input); | |||
#endregion | |||
#region 授权模板详情 | |||
Task<List<AuthorizeTemplateItemEntity>> GetModuleByTemplateId(string input); | |||
Task<bool> EditTemplateItem(AuthorModuleItemUpdateInput input); | |||
Task<List<AuthorizeOutput>> GetAuthorizeObjects(AuthorizeInput input); | |||
Task<bool> RemoveAuthorize(AuthorizeInput input); | |||
Task<bool> SaveAuthorize(AuthorModulesAddInput input); | |||
Task AddAuthorize(AuthorMapAddInput input); | |||
#endregion | |||
} |