/
RoleController.cs
95 lines (85 loc) · 2.75 KB
/
RoleController.cs
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using YiSha.Admin.Web.Controllers;
using YiSha.Business.SystemManage;
using YiSha.Entity.SystemManage;
using YiSha.Model.Param.SystemManage;
using YiSha.Util.Model;
namespace YiSha.Admin.Web.Areas.SystemManage.Controllers
{
[Area("SystemManage")]
public class RoleController : BaseController
{
private RoleBLL roleBLL = new RoleBLL();
#region 视图功能
[AuthorizeFilter("system:role:view")]
public IActionResult RoleIndex()
{
return View();
}
public IActionResult RoleForm()
{
return View();
}
#endregion
#region 获取数据
[HttpGet]
[AuthorizeFilter("system:role:search,organization:user:search")]
public async Task<IActionResult> GetListJson(RoleListParam param)
{
TData<List<RoleEntity>> obj = await roleBLL.GetList(param);
return Json(obj);
}
[HttpGet]
[AuthorizeFilter("system:role:search,organization:user:search")]
public async Task<IActionResult> GetPageListJson(RoleListParam param, Pagination pagination)
{
TData<List<RoleEntity>> obj = await roleBLL.GetPageList(param, pagination);
return Json(obj);
}
[HttpGet]
[AuthorizeFilter("system:role:view")]
public async Task<IActionResult> GetFormJson(long id)
{
TData<RoleEntity> obj = await roleBLL.GetEntity(id);
return Json(obj);
}
[HttpGet]
public async Task<IActionResult> GetRoleName(RoleListParam param)
{
TData<string> obj = new TData<string>();
var list = await roleBLL.GetList(param);
if (list.Tag == 1)
{
obj.Data = string.Join(",", list.Data.Select(p => p.RoleName));
obj.Tag = 1;
}
return Json(obj);
}
[HttpGet]
public async Task<IActionResult> GetMaxSortJson()
{
TData<int> obj = await roleBLL.GetMaxSort();
return Json(obj);
}
#endregion
#region 提交数据
[HttpPost]
[AuthorizeFilter("system:role:add,system:role:edit")]
public async Task<IActionResult> SaveFormJson(RoleEntity entity)
{
TData<string> obj = await roleBLL.SaveForm(entity);
return Json(obj);
}
[HttpPost]
[AuthorizeFilter("system:role:delete")]
public async Task<IActionResult> DeleteFormJson(string ids)
{
TData obj = await roleBLL.DeleteForm(ids);
return Json(obj);
}
#endregion
}
}