diff --git a/src/admin/Bootstrap.Admin/Pages/Components/RolesBase.cs b/src/admin/Bootstrap.Admin/Pages/Components/RolesBase.cs
new file mode 100644
index 00000000..5e60a9d2
--- /dev/null
+++ b/src/admin/Bootstrap.Admin/Pages/Components/RolesBase.cs
@@ -0,0 +1,39 @@
+using Bootstrap.Admin.Components;
+using Bootstrap.DataAccess;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace Bootstrap.Pages.Admin.Components
+{
+ ///
+ /// 部门维护组件
+ ///
+ public class RolesBase : QueryPageBase
+ {
+ ///
+ /// 查询方法
+ ///
+ /// 页码
+ /// 每页显示数据条目数量
+ protected override QueryData Query(int pageIndex, int pageItems)
+ {
+ var data = RoleHelper.Retrieves();
+ if (!string.IsNullOrEmpty(QueryModel.RoleName)) data = data.Where(d => d.RoleName.Contains(QueryModel.RoleName, StringComparison.OrdinalIgnoreCase));
+ if (!string.IsNullOrEmpty(QueryModel.Description)) data = data.Where(d => d.Description != null && d.Description.Contains(QueryModel.Description, StringComparison.OrdinalIgnoreCase));
+ var totalCount = data.Count();
+ var items = data.Skip((pageIndex - 1) * pageItems).Take(pageItems);
+ return new QueryData() { Items = items, TotalCount = totalCount, PageIndex = pageIndex, PageItems = pageItems };
+ }
+
+ ///
+ /// 保存方法
+ ///
+ protected override bool Save(Role item) => RoleHelper.Save(item);
+
+ ///
+ /// 删除方法
+ ///
+ protected override bool Delete(IEnumerable items) => RoleHelper.Delete(items.Select(item => item.Id ?? ""));
+ }
+}
diff --git a/src/admin/Bootstrap.Admin/Views/Admin/Roles.cshtml b/src/admin/Bootstrap.Admin/Views/Admin/Roles.cshtml
index b4ca6f5c..fe78fd5d 100644
--- a/src/admin/Bootstrap.Admin/Views/Admin/Roles.cshtml
+++ b/src/admin/Bootstrap.Admin/Views/Admin/Roles.cshtml
@@ -78,7 +78,7 @@
-
+
diff --git a/src/admin/Bootstrap.DataAccess/Role.cs b/src/admin/Bootstrap.DataAccess/Role.cs
index ee0e5df3..e73c1ab4 100644
--- a/src/admin/Bootstrap.DataAccess/Role.cs
+++ b/src/admin/Bootstrap.DataAccess/Role.cs
@@ -2,12 +2,13 @@
using PetaPoco;
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Linq;
namespace Bootstrap.DataAccess
{
///
- ///
+ /// 角色实体类
///
[TableName("Roles")]
public class Role
@@ -20,11 +21,13 @@ namespace Bootstrap.DataAccess
///
/// 获得/设置 角色名称
///
+ [DisplayName("角色名称")]
public string RoleName { get; set; } = "";
///
/// 获得/设置 角色描述
///
+ [DisplayName("角色描述")]
public string Description { get; set; } = "";
///
@@ -213,7 +216,7 @@ namespace Bootstrap.DataAccess
}
///
- ///
+ /// 通过指定登录用户名获得角色列表
///
///
///