Blame view

web/WebMvc/Areas/base/Controllers/SysDeptController.cs 1.58 KB
赖素文 authored
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
using Hh.Mes.POJO.Entity;
using Hh.Mes.Service.SystemAuth;
using Hh.Mes.Service.WebService.Base;
using Microsoft.AspNetCore.Mvc;
using WebMvc.Aop;

namespace WebMvc
{
    [Area("base")]
    public class SysDeptController : BaseController
    {
        private readonly SysDeptService service;
        public SysDeptController(IAuth authUtil, SysDeptService service) : base(authUtil)
        {
            this.service = service;
            this.service.sysWebUser = authUtil.GetCurrentUser().User;
        }

        //
        // GET: /SysDept/
        [Authenticate]
        public ActionResult Index()
        {
            return View();
        }

        //添加
        [HttpPost]
        [XSSFilter]
        [ServiceFilter(typeof(OperLogFilter))]
        public string Add(SysDept sysDept)
        {
            return Serialize(service.Ins(sysDept));
        }

        //编辑
        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        [XSSFilter]
        public string Update(SysDept sysDept)
        {
            return Serialize(service.Upd(sysDept));
        }

        /// <summary>
        /// 删除指定ID的组织
        /// </summary>
        /// <returns>System.String.</returns>
        [HttpPost]
        public string Delete(int[] ids)
        {
            return Serialize(service.DelByIds(ids));
        }

        public string LoadForUser(int firstId)
        {
            return Serialize(service.LoadForUser(firstId));
        }

        public string LoadForRole(int firstId)
        {
            return Serialize(service.LoadForRole(firstId));
        }
    }
}