SysDictDataApp.cs 2.09 KB
using Hh.Mes.Common.Infrastructure;
using Hh.Mes.Common.Request;
using Hh.Mes.POJO.Response;
using Microsoft.AspNetCore.Http;
using System;
using System.Linq;
using System.Linq.Expressions;
using WebRepository;


namespace WebApp
{
    /// <summary>
    /// 字典数据表
    /// </summary>

    public partial class SysDictDataApp
    {
        public IRepository<SysDictData> _app;
       

        public SysDictDataApp(IRepository<SysDictData> repository)
        {
            _app = repository;
        }
        
        public SysDictDataApp SetLoginInfo(LoginInfo loginInfo)
        {
            _app._loginInfo = loginInfo;
            return this;
        }
        
        public Response Load(PageReq pageRequest, SysDictData entity)
        {
            return _app.Load(pageRequest, entity);
        }

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

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

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

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

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

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

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

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

            return result;
        }

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