SysRoleController.cs
2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
using Hh.Mes.Common.Request;
using Hh.Mes.Pojo.System;
using Hh.Mes.POJO.EnumEntitys;
using Hh.Mes.Service;
using Hh.Mes.Service.SystemAuth;
using Hh.Mes.Service.WebService.Base;
using Microsoft.AspNetCore.Mvc;
using System;
using WebMvc.Aop;
namespace WebMvc
{
[Area("base")]
public class SysRoleController : BaseController
{
private readonly SysRoleService service;
private readonly SysRelevanceService relevanceService;
public SysRoleController(IAuth authUtil, SysRoleService service, SysRelevanceService revelanceService) : base(authUtil)
{
this.service = service;
this.service.sysWebUser = authUtil.GetCurrentUser().User;
this.relevanceService = revelanceService;
this.relevanceService.sysWebUser = authUtil.GetCurrentUser().User;
}
//
// GET: /SysUser/
[Authenticate]
public ActionResult Index()
{
return View();
}
public ActionResult Assign()
{
return View();
}
//添加或修改组织
[HttpPost]
[XSSFilter]
public string Add(SysRoleView obj)
{
return Serialize(service.Ins(obj));
}
//添加或修改组织
[HttpPost]
[XSSFilter]
public string Update(SysRoleView obj)
{
return Serialize(service.Upd(obj));
}
[HttpPost]
public string Delete(int[] ids)
{
return Serialize(service.DelById(ids));
}
/// <summary>
/// 加载用户的角色
/// </summary>
public string LoadForUser(int userId)
{
var result = relevanceService.Get(Define.USERROLE, true, userId);
return Serialize(result);
}
/// <summary>
/// 加载组织下面的所有用户
/// </summary>
[HttpPost]
public string Load(PageReq pageRequest, int? orgId)
{
return Serialize(service.Load(pageRequest, orgId));
}
}
}