EquipmentStatusApp.cs 2.3 KB
using Hh.Mes.Common.Infrastructure;
using Hh.Mes.Common.Request;
using Hh.Mes.POJO.Response;
using Microsoft.AspNetCore.Hosting;
using System;
using System.Linq;
using System.Linq.Expressions;
using WebRepository;


namespace WebApp
{
    /// <summary>
    /// 设备状态表
    /// </summary>

    public partial class EquipmentStatusApp
    {
        private IUnitWork _unitWork;
        public IRepository<EquipmentStatus> _app;
        private static IHostingEnvironment _hostingEnvironment;
        

        public EquipmentStatusApp(IUnitWork unitWork, IRepository<EquipmentStatus> repository, IHostingEnvironment hostingEnvironment)
        {
            _unitWork = unitWork;
            _app = repository;
            _hostingEnvironment = hostingEnvironment;
        }
        
        public EquipmentStatusApp SetLoginInfo(LoginInfo loginInfo)
        {
            _app._loginInfo = loginInfo;
            return this;
        }
        
        public Response Load(PageReq pageRequest, EquipmentStatus entity)
        {
            return _app.Load(pageRequest, entity);
        }

        public void Ins(EquipmentStatus entity)
        {
            _app.Add(entity);
        }

        public void Upd(EquipmentStatus entity)
        {
            _app.Update(entity);
        }

        public void DelByIds(int[] ids)
        {
            _app.Delete(u => ids.Contains(u.Id.Value));
        }
        
        public EquipmentStatus FindSingle(Expression<Func<EquipmentStatus, bool>> exp)
        {
            return _app.FindSingle(exp);
        }

        public IQueryable<EquipmentStatus> Find(Expression<Func<EquipmentStatus, bool>> exp)
        {
            return _app.Find(exp);
        }


        public Response ExportData(EquipmentStatus entity)
        {
            return _app.ExportData(entity);
        }

        public Response Query(EquipmentStatus entity)
        {
            var result = new Response();
            var data = _app.Find(EntityToExpression<EquipmentStatus>.GetExpressions(entity));

            GetData(data, result);
            result.Count = data.Count();

            return result;
        }

        public void GetData(IQueryable<EquipmentStatus> data, Response result, PageReq pageRequest = null)
        {
            _app.GetData(data, result, pageRequest);
        }
    }
}