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

namespace WebApp
{
    /// <summary>
    /// 系统信息
    /// </summary>

    public partial class SysInfoApp
    {
        private IUnitWork _unitWork;
        public IRepository<SysInfo> _app;
        private static IHostingEnvironment _hostingEnvironment;
        

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

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

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

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

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

        public Response ImportIn(IFormFile excelfile)
        {
            return null;
        }

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

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

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

            return result;
        }

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