/
DepartmentController.cs
93 lines (84 loc) · 2.91 KB
/
DepartmentController.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNetCore.Mvc;
using YiSha.Admin.Web.Controllers;
using YiSha.Business.OrganizationManage;
using YiSha.Entity.OrganizationManage;
using YiSha.Model;
using YiSha.Model.Param.OrganizationManage;
using YiSha.Model.Result;
using YiSha.Util.Model;
namespace YiSha.Admin.Web.Areas.OrganizationManage.Controllers
{
[Area("OrganizationManage")]
public class DepartmentController : BaseController
{
private DepartmentBLL departmentBLL = new DepartmentBLL();
#region 视图功能
[AuthorizeFilter("organization:department:view")]
public IActionResult DepartmentIndex()
{
return View();
}
public IActionResult DepartmentForm()
{
return View();
}
#endregion
#region 获取数据
[HttpGet]
[AuthorizeFilter("organization:department:search,organization:user:search")]
public async Task<IActionResult> GetListJson(DepartmentListParam param)
{
TData<List<DepartmentEntity>> obj = await departmentBLL.GetList(param);
return Json(obj);
}
[HttpGet]
[AuthorizeFilter("organization:department:search,organization:user:search")]
public async Task<IActionResult> GetDepartmentTreeListJson(DepartmentListParam param)
{
TData<List<ZtreeInfo>> obj = await departmentBLL.GetZtreeDepartmentList(param);
return Json(obj);
}
[HttpGet]
[AuthorizeFilter("organization:department:view")]
public async Task<IActionResult> GetUserTreeListJson(DepartmentListParam param)
{
TData<List<ZtreeInfo>> obj = await departmentBLL.GetZtreeUserList(param);
return Json(obj);
}
[HttpGet]
[AuthorizeFilter("organization:department:view")]
public async Task<IActionResult> GetFormJson(long id)
{
TData<DepartmentEntity> obj = await departmentBLL.GetEntity(id);
return Json(obj);
}
[HttpGet]
public async Task<IActionResult> GetMaxSortJson()
{
TData<int> obj = await departmentBLL.GetMaxSort();
return Json(obj);
}
#endregion
#region 提交数据
[HttpPost]
[AuthorizeFilter("organization:department:add,organization:department:edit")]
public async Task<IActionResult> SaveFormJson(DepartmentEntity entity)
{
TData<string> obj = await departmentBLL.SaveForm(entity);
return Json(obj);
}
[HttpPost]
[AuthorizeFilter("organization:department:delete")]
public async Task<IActionResult> DeleteFormJson(string ids)
{
TData obj = await departmentBLL.DeleteForm(ids);
return Json(obj);
}
#endregion
}
}