You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

134 lines
3.9 KiB

  1. using Learun.Application.Base.AuthorizeModule;
  2. using Learun.Application.Organization;
  3. using Learun.Util;
  4. using System.Linq;
  5. using System.Web.Mvc;
  6. namespace Learun.Application.Web.Areas.LR_OrganizationModule.Controllers
  7. {
  8. /// <summary>
  9. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  10. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  11. /// 创建人:陈彬彬
  12. /// 日 期:2017.03.09
  13. /// 描 述:角色管理
  14. /// </summary>
  15. public class RoleController : MvcControllerBase
  16. {
  17. private RoleIBLL roleIBLL = new RoleBLL();
  18. private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
  19. #region 获取视图
  20. /// <summary>
  21. /// 主页
  22. /// </summary>
  23. /// <returns></returns>
  24. [HttpGet]
  25. public ActionResult Index()
  26. {
  27. return View();
  28. }
  29. /// <summary>
  30. /// 表单
  31. /// </summary>
  32. /// <returns></returns>
  33. [HttpGet]
  34. public ActionResult Form()
  35. {
  36. return View();
  37. }
  38. #endregion
  39. #region 获取数据
  40. /// <summary>
  41. /// 获取角色列表信息
  42. /// </summary>
  43. /// <param name="keyWord">查询关键字</param>
  44. /// <returns></returns>
  45. [HttpGet]
  46. [AjaxOnly]
  47. public ActionResult GetList(string keyword)
  48. {
  49. var data = roleIBLL.GetList(keyword);
  50. return JsonResult(data);
  51. }
  52. /// <summary>
  53. /// 获取分页数据
  54. /// </summary>
  55. /// <param name="pagination">分页参数</param>
  56. /// <param name="keyword">关键字</param>
  57. /// <returns></returns>
  58. [HttpGet]
  59. [AjaxOnly]
  60. public ActionResult GetPageList(string pagination, string keyword)
  61. {
  62. Pagination paginationobj = pagination.ToObject<Pagination>();
  63. var data = roleIBLL.GetPageList(paginationobj, keyword);
  64. foreach (var item in data)
  65. {
  66. item.UserNum = userRelationIBLL.GetUserIdList(item.F_RoleId).Count().ToString();
  67. }
  68. var jsonData = new
  69. {
  70. rows = data,
  71. total = paginationobj.total,
  72. page = paginationobj.page,
  73. records = paginationobj.records,
  74. };
  75. return JsonResult(jsonData);
  76. }
  77. /// <summary>
  78. /// 根据角色名获取角色
  79. /// </summary>
  80. /// <param name="roleName">角色名</param>
  81. /// <returns></returns>
  82. public ActionResult GetRoleByRoleName(string roleName)
  83. {
  84. var data = roleIBLL.GetRoleByRoleName(roleName);
  85. return Success(data);
  86. }
  87. /// <summary>
  88. /// 获取角色列表(所有)
  89. /// </summary>
  90. /// <returns></returns>
  91. [HttpGet]
  92. [AjaxOnly]
  93. public ActionResult GetRoleList()
  94. {
  95. var data = roleIBLL.GetList();
  96. return Success(data);
  97. }
  98. #endregion
  99. #region 提交数据
  100. /// <summary>
  101. /// 保存表单数据
  102. /// </summary>
  103. /// <param name="keyValue">主键</param>
  104. /// <param name="entity">实体</param>
  105. /// <returns></returns>
  106. [HttpPost]
  107. [ValidateAntiForgeryToken]
  108. [AjaxOnly]
  109. public ActionResult SaveForm(string keyValue, RoleEntity entity)
  110. {
  111. roleIBLL.SaveEntity(keyValue, entity);
  112. return Success("保存成功!");
  113. }
  114. /// <summary>
  115. /// 删除表单数据
  116. /// </summary>
  117. /// <param name="keyValue">主键</param>
  118. /// <returns></returns>
  119. [HttpPost]
  120. [AjaxOnly]
  121. public ActionResult DeleteForm(string keyValue)
  122. {
  123. roleIBLL.VirtualDelete(keyValue);
  124. return Success("删除成功!");
  125. }
  126. #endregion
  127. }
  128. }