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.

UserRelationController.cs 2.9 KiB

4 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System.Linq;
  2. using Learun.Application.Base.AuthorizeModule;
  3. using Learun.Application.Organization;
  4. using System.Web.Mvc;
  5. namespace Learun.Application.Web.Areas.LR_AuthorizeModule.Controllers
  6. {
  7. /// <summary>
  8. /// 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园
  9. /// Copyright (c) 2013-2018 北京泉江科技有限公司
  10. /// 创建人:陈彬彬
  11. /// 日 期:2017.04.17
  12. /// 描 述:用户对应对象
  13. /// </summary>
  14. public class UserRelationController : MvcControllerBase
  15. {
  16. private UserRelationIBLL userRelationIBLL = new UserRelationBLL();
  17. private UserIBLL userIBLL = new UserBLL();
  18. #region 获取视图
  19. /// <summary>
  20. /// 人员选择
  21. /// </summary>
  22. /// <returns></returns>
  23. [HttpGet]
  24. public ActionResult SelectForm()
  25. {
  26. return View();
  27. }
  28. /// <summary>
  29. /// 人员选择
  30. /// </summary>
  31. /// <returns></returns>
  32. [HttpGet]
  33. public ActionResult LookForm()
  34. {
  35. return View();
  36. }
  37. #endregion
  38. #region 获取数据
  39. /// <summary>
  40. /// 获取用户主键列表信息
  41. /// </summary>
  42. /// <param name="objectId">用户主键</param>
  43. /// <returns></returns>
  44. [HttpGet]
  45. [AjaxOnly]
  46. public ActionResult GetUserIdList(string objectId)
  47. {
  48. var data = userRelationIBLL.GetUserIdList(objectId);
  49. string userIds = "";
  50. foreach (var item in data)
  51. {
  52. if (userIds != "")
  53. {
  54. userIds += ",";
  55. }
  56. userIds += item.F_UserId;
  57. }
  58. var userList = userIBLL.GetListByUserIds(userIds);
  59. var datajson = new
  60. {
  61. userIds = userIds,
  62. userInfoList = userList
  63. };
  64. return JsonResult(datajson);
  65. }
  66. [HttpGet]
  67. [AjaxOnly]
  68. public ActionResult GetEntityNameByUserId(string keyValue)
  69. {
  70. var data = userRelationIBLL.GetEntityNameByUserId(keyValue);
  71. return JsonResult(string.Join(",", data.Select(m=>m.F_Name)));
  72. }
  73. #endregion
  74. #region 提交数据
  75. /// <summary>
  76. /// 保存表单数据
  77. /// </summary>
  78. /// <param name="objectId">对象主键</param>
  79. /// <param name="category">分类:1-角色2-岗位</param>
  80. /// <param name="userIds">对用户主键列表</param>
  81. /// <returns></returns>
  82. [HttpPost]
  83. [ValidateAntiForgeryToken]
  84. [AjaxOnly]
  85. public ActionResult SaveForm(string objectId, int category, string userIds)
  86. {
  87. userRelationIBLL.SaveEntityList(objectId, category, userIds);
  88. return Success("保存成功!");
  89. }
  90. #endregion
  91. }
  92. }