SysDeptController.cs 1.58 KB
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));
        }
    }
}