BaseEquipmentGroupController.cs 2.11 KB
using Hh.Mes.Common.Request;
using Hh.Mes.POJO.WebEntity;
using Hh.Mes.Service.SystemAuth;
using Hh.Mes.Service.WebService.Equipment;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using WebMvc.Aop;

namespace WebMvc.Areas.equipment.Controllers
{
    [Area("Equipment")]
    public class BaseEquipmentGroupController : BaseController
    {
        private readonly BaseEquipmentGroupService _service;

        public BaseEquipmentGroupController(IAuth authUtil, BaseEquipmentGroupService service) : base(authUtil)
        {
            _service = service;
        }

        [Authenticate]
        public ActionResult Index()
        {
            return View();
        }

        [HttpGet]
        public List<BaseEquipmentGroup> Load()
        {
            return _service.LoadAll();
        }

        /// <summary>
        /// 加载及分页查询
        /// </summary>
        /// <param name="pageRequest">表单请求信息</param>
        /// <param name="entity">请求条件实例</param>
        /// <returns></returns>
        [HttpPost]
        public string Load(PageReq pageRequest, BaseEquipmentGroup entity)
        {
            return Serialize(_service.Load(pageRequest, entity));
        }

        //添加
        [HttpPost]
        [XSSFilter]
        [ServiceFilter(typeof(OperLogFilter))]
        public string Add(BaseEquipmentGroup baseEquipmentGroup)
        {
            return Serialize(_service.Ins(baseEquipmentGroup));
        }

        //编辑
        [HttpPost]
        [ServiceFilter(typeof(OperLogFilter))]
        [XSSFilter]
        public string Update(BaseEquipmentGroup baseEquipmentGroup)
        {
            return Serialize(_service.Upd(baseEquipmentGroup));
        }

        [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));
        //}
    }
}