Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

149 rader
4.3 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. #region 扩展数据
  41. /// <summary>
  42. /// 获取树形数据
  43. /// </summary>
  44. /// <param name="companyId">公司主键</param>
  45. /// <returns></returns>
  46. [HttpGet]
  47. [AjaxOnly]
  48. public ActionResult GetTree(string companyId)
  49. {
  50. var data = roleIBLL.GetTree(companyId);
  51. return JsonResult(data);
  52. }
  53. #endregion
  54. /// <summary>
  55. /// 获取角色列表信息
  56. /// </summary>
  57. /// <param name="keyWord">查询关键字</param>
  58. /// <returns></returns>
  59. [HttpGet]
  60. [AjaxOnly]
  61. public ActionResult GetList(string keyword)
  62. {
  63. var data = roleIBLL.GetList(keyword);
  64. return JsonResult(data);
  65. }
  66. /// <summary>
  67. /// 获取分页数据
  68. /// </summary>
  69. /// <param name="pagination">分页参数</param>
  70. /// <param name="keyword">关键字</param>
  71. /// <returns></returns>
  72. [HttpGet]
  73. [AjaxOnly]
  74. public ActionResult GetPageList(string pagination, string keyword)
  75. {
  76. Pagination paginationobj = pagination.ToObject<Pagination>();
  77. var data = roleIBLL.GetPageList(paginationobj, keyword);
  78. foreach (var item in data)
  79. {
  80. item.UserNum = userRelationIBLL.GetUserIdList(item.F_RoleId).Count().ToString();
  81. }
  82. var jsonData = new
  83. {
  84. rows = data,
  85. total = paginationobj.total,
  86. page = paginationobj.page,
  87. records = paginationobj.records,
  88. };
  89. return JsonResult(jsonData);
  90. }
  91. /// <summary>
  92. /// 根据角色名获取角色
  93. /// </summary>
  94. /// <param name="roleName">角色名</param>
  95. /// <returns></returns>
  96. public ActionResult GetRoleByRoleName(string roleName)
  97. {
  98. var data = roleIBLL.GetRoleByRoleName(roleName);
  99. return Success(data);
  100. }
  101. /// <summary>
  102. /// 获取角色列表(所有)
  103. /// </summary>
  104. /// <returns></returns>
  105. [HttpGet]
  106. [AjaxOnly]
  107. public ActionResult GetRoleList()
  108. {
  109. var data = roleIBLL.GetList();
  110. return Success(data);
  111. }
  112. #endregion
  113. #region 提交数据
  114. /// <summary>
  115. /// 保存表单数据
  116. /// </summary>
  117. /// <param name="keyValue">主键</param>
  118. /// <param name="entity">实体</param>
  119. /// <returns></returns>
  120. [HttpPost]
  121. [ValidateAntiForgeryToken]
  122. [AjaxOnly]
  123. public ActionResult SaveForm(string keyValue, RoleEntity entity)
  124. {
  125. roleIBLL.SaveEntity(keyValue, entity);
  126. return Success("保存成功!");
  127. }
  128. /// <summary>
  129. /// 删除表单数据
  130. /// </summary>
  131. /// <param name="keyValue">主键</param>
  132. /// <returns></returns>
  133. [HttpPost]
  134. [AjaxOnly]
  135. public ActionResult DeleteForm(string keyValue)
  136. {
  137. roleIBLL.VirtualDelete(keyValue);
  138. return Success("删除成功!");
  139. }
  140. #endregion
  141. }
  142. }