UserGroupController.cs 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. using Lottomat.Application.Busines.BaseManage;
  2. using Lottomat.Application.Cache;
  3. using Lottomat.Application.Code;
  4. using Lottomat.Application.Entity.BaseManage;
  5. using Lottomat.Util;
  6. using Lottomat.Util.WebControl;
  7. using System.Collections.Generic;
  8. using System.Web.Mvc;
  9. using Lottomat.Util.Extension;
  10. namespace Lottomat.Application.Admin.Areas.BaseManage.Controllers
  11. {
  12. /// <summary>
  13. /// 版 本
  14. /// Copyright (c) 2016-2017
  15. /// 创建人:赵轶
  16. /// 日 期:2015.11.4 14:31
  17. /// 描 述:用户组管理
  18. /// </summary>
  19. public class UserGroupController : MvcControllerBase
  20. {
  21. private UserGroupBLL userGroupBLL = new UserGroupBLL();
  22. private UserGroupCache userGroupCache = new UserGroupCache();
  23. #region 视图功能
  24. /// <summary>
  25. /// 用户组管理
  26. /// </summary>
  27. /// <returns></returns>
  28. [HttpGet]
  29. [HandlerAuthorize(PermissionMode.Enforce)]
  30. public ActionResult Index()
  31. {
  32. return View();
  33. }
  34. /// <summary>
  35. /// 用户组表单
  36. /// </summary>
  37. /// <returns></returns>
  38. [HttpGet]
  39. [HandlerAuthorize(PermissionMode.Enforce)]
  40. public ActionResult Form()
  41. {
  42. return View();
  43. }
  44. #endregion
  45. #region 获取数据
  46. /// <summary>
  47. /// 用户组列表
  48. /// </summary>
  49. /// <param name="organizeId">机构Id</param>
  50. /// <returns>返回列表Json</returns>
  51. [HttpGet]
  52. public ActionResult GetListJson(string organizeId)
  53. {
  54. var data = userGroupCache.GetList(organizeId);
  55. return Content(data.ToJson());
  56. }
  57. /// <summary>
  58. /// 用户组列表
  59. /// </summary>
  60. /// <param name="pagination">分页参数</param>
  61. /// <param name="queryJson">查询参数</param>
  62. /// <returns>返回分页列表Json</returns>
  63. [HttpGet]
  64. public ActionResult GetPageListJson(Pagination pagination, string queryJson)
  65. {
  66. var watch = CommonHelper.TimerStart();
  67. var data = userGroupBLL.GetPageList(pagination, queryJson);
  68. var JsonData = new
  69. {
  70. rows = data,
  71. total = pagination.total,
  72. page = pagination.page,
  73. records = pagination.records,
  74. costtime = CommonHelper.TimerEnd(watch)
  75. };
  76. return Content(JsonData.ToJson());
  77. }
  78. /// <summary>
  79. /// 用户组实体
  80. /// </summary>
  81. /// <param name="keyValue">主键值</param>
  82. /// <returns>返回对象Json</returns>
  83. [HttpGet]
  84. public ActionResult GetFormJson(string keyValue)
  85. {
  86. var data = userGroupBLL.GetEntity(keyValue);
  87. return Content(data.ToJson());
  88. }
  89. #endregion
  90. #region 验证数据
  91. /// <summary>
  92. /// 组编号不能重复
  93. /// </summary>
  94. /// <param name="enCode">编号</param>
  95. /// <param name="keyValue">主键</param>
  96. /// <returns></returns>
  97. [HttpGet]
  98. public ActionResult ExistEnCode(string EnCode, string keyValue)
  99. {
  100. bool IsOk = userGroupBLL.ExistEnCode(EnCode, keyValue);
  101. return Content(IsOk.ToString());
  102. }
  103. /// <summary>
  104. /// 组名称不能重复
  105. /// </summary>
  106. /// <param name="FullName">名称</param>
  107. /// <param name="keyValue">主键</param>
  108. /// <returns></returns>
  109. [HttpGet]
  110. public ActionResult ExistFullName(string FullName, string keyValue)
  111. {
  112. bool IsOk = userGroupBLL.ExistFullName(FullName, keyValue);
  113. return Content(IsOk.ToString());
  114. }
  115. #endregion
  116. #region 提交数据
  117. /// <summary>
  118. /// 删除用户组
  119. /// </summary>
  120. /// <param name="keyValue">主键值</param>
  121. /// <returns></returns>
  122. [HttpPost]
  123. [ValidateAntiForgeryToken]
  124. [AjaxOnly]
  125. [HandlerAuthorize(PermissionMode.Enforce)]
  126. public ActionResult RemoveForm(string keyValue)
  127. {
  128. userGroupBLL.RemoveForm(keyValue);
  129. return Success("删除成功。");
  130. }
  131. /// <summary>
  132. /// 保存用户组表单(新增、修改)
  133. /// </summary>
  134. /// <param name="keyValue">主键值</param>
  135. /// <param name="userGroupEntity">用户组实体</param>
  136. /// <returns></returns>
  137. [HttpPost]
  138. [ValidateAntiForgeryToken]
  139. [AjaxOnly]
  140. public ActionResult SaveForm(string keyValue, RoleEntity userGroupEntity)
  141. {
  142. userGroupBLL.SaveForm(keyValue, userGroupEntity);
  143. return Success("操作成功。");
  144. }
  145. #endregion
  146. }
  147. }