Browse Source

新增获取按钮

Dun.Jason 2 years ago
parent
commit
eca4b9a1aa

+ 16 - 0
src/Hotline.Api/Controllers/SysController.cs

@@ -241,6 +241,22 @@ namespace Hotline.Api.Controllers
             await _systemButtonRepository.RemoveAsync(id, true, HttpContext.RequestAborted);
             await _systemButtonRepository.RemoveAsync(id, true, HttpContext.RequestAborted);
         }
         }
 
 
+        /// <summary>
+        /// 获取按钮对象
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        [Permission(EPermission.GetButton)]
+        [HttpGet("button/{id}")]
+        public async Task<SystemButton> GetButton(string id)
+        {
+            var button = await _systemButtonRepository.GetAsync(id, HttpContext.RequestAborted);
+            if (button is null)
+                throw UserFriendlyException.SameMessage("无效按钮");
+            return button;
+        }
+
+
         #endregion
         #endregion
         #endregion
         #endregion
     }
     }

+ 11 - 7
src/Hotline.Api/Permissions/EPermission.cs

@@ -11,7 +11,11 @@ namespace Hotline.Permissions
         NotSet = 0, //error condition
         NotSet = 0, //error condition
 
 
         //Here is an example of very detailed control over something
         //Here is an example of very detailed control over something
-
+        /// <summary>
+        /// 首页
+        /// </summary>
+        [Display(GroupName ="首页",Name ="首页",Description ="首页")]
+        Home = 000000,
 
 
         #region 系统管理相关接口(100)
         #region 系统管理相关接口(100)
 
 
@@ -26,7 +30,6 @@ namespace Hotline.Permissions
         /// </summary>
         /// </summary>
         [Display(GroupName ="系统管理",Name ="机构用户",Description ="机构用户")]
         [Display(GroupName ="系统管理",Name ="机构用户",Description ="机构用户")]
         UserManage = 100100,
         UserManage = 100100,
-
         #region 用户管理
         #region 用户管理
         /// <summary>
         /// <summary>
         /// 分页查询用户
         /// 分页查询用户
@@ -64,7 +67,6 @@ namespace Hotline.Permissions
         [Display(GroupName ="用户管理",Name = "查询密码更改状态",Description = "查询密码更改状态")]
         [Display(GroupName ="用户管理",Name = "查询密码更改状态",Description = "查询密码更改状态")]
         GetPasswordChangeStatus=100107,
         GetPasswordChangeStatus=100107,
         #endregion
         #endregion
-
         #region 角色管理
         #region 角色管理
         /// <summary>
         /// <summary>
         /// 分页查询角色
         /// 分页查询角色
@@ -122,7 +124,6 @@ namespace Hotline.Permissions
         GetDataAuthorityByRole = 100209,
         GetDataAuthorityByRole = 100209,
         #endregion
         #endregion
         #endregion
         #endregion
-
         #region 系统参数
         #region 系统参数
 
 
         /// <summary>
         /// <summary>
@@ -137,7 +138,6 @@ namespace Hotline.Permissions
         ModifySettings = 100301,
         ModifySettings = 100301,
 
 
         #endregion
         #endregion
-
         #region 菜单管理
         #region 菜单管理
         /// <summary>
         /// <summary>
         /// 菜单管理
         /// 菜单管理
@@ -164,6 +164,7 @@ namespace Hotline.Permissions
         /// </summary>
         /// </summary>
         [Display(GroupName ="系统设置",Name ="获取菜单对象",Description ="获取菜单对象")]
         [Display(GroupName ="系统设置",Name ="获取菜单对象",Description ="获取菜单对象")]
         GetMenu = 100408,
         GetMenu = 100408,
+        #endregion
         #region 按钮管理
         #region 按钮管理
         /// <summary>
         /// <summary>
         /// 获取菜单按钮
         /// 获取菜单按钮
@@ -185,8 +186,11 @@ namespace Hotline.Permissions
         /// </summary>
         /// </summary>
         [Display(GroupName ="系统设置",Name ="删除按钮",Description ="删除按钮")]
         [Display(GroupName ="系统设置",Name ="删除按钮",Description ="删除按钮")]
         RemoveButton = 100407,
         RemoveButton = 100407,
-        #endregion
-
+        /// <summary>
+        /// 获取按钮对象
+        /// </summary>
+        [Display(GroupName ="系统设置",Name ="获取按钮对象",Description ="获取按钮对象")]
+        GetButton = 100409,
         #endregion
         #endregion
 
 
         #endregion
         #endregion