You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
105 lines
2.9 KiB
C#
105 lines
2.9 KiB
C#
using HighWayIot.Log4net;
|
|
using HighWayIot.Repository.domain;
|
|
using Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Linq.Expressions;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace HighWayIot.Repository.service
|
|
{
|
|
/// <summary>
|
|
/// 报表服务类
|
|
/// </summary>
|
|
public class ZxDailyReportService
|
|
{
|
|
private static readonly Lazy<ZxDailyReportService> lazy = new Lazy<ZxDailyReportService>(() => new ZxDailyReportService());
|
|
|
|
public static ZxDailyReportService Instance
|
|
{
|
|
get
|
|
{
|
|
return lazy.Value;
|
|
}
|
|
}
|
|
|
|
private LogHelper log = LogHelper.Instance;
|
|
Repository<ZxDailyReportEntity> _repository => new Repository<ZxDailyReportEntity>("sqlserver");
|
|
|
|
/// <summary>
|
|
/// 查询报表信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<ZxDailyReportEntity> Get50DailyReportInfos()
|
|
{
|
|
try
|
|
{
|
|
List<ZxDailyReportEntity> entity = _repository.GetList().Take(50).ToList();
|
|
return entity;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("配方信息获取异常", ex);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 根据条件查询报表信息
|
|
/// </summary>
|
|
/// <param name="whereExpression"></param>
|
|
/// <returns></returns>
|
|
public List<ZxDailyReportEntity> GetDailyReportInfos(Expression<Func<ZxDailyReportEntity, bool>> whereExpression)
|
|
{
|
|
try
|
|
{
|
|
List<ZxDailyReportEntity> entity = _repository.GetList(whereExpression);
|
|
return entity;
|
|
}
|
|
catch(Exception ex)
|
|
{
|
|
log.Error("配发信息获取异常", ex);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 新增报表信息
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public bool InsertDailyReportInfo(ZxDailyReportEntity entity)
|
|
{
|
|
try
|
|
{
|
|
return _repository.Insert(entity);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("报表信息添加异常", ex);
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 删除报表信息
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateDailyReportInfo(ZxDailyReportEntity entity)
|
|
{
|
|
try
|
|
{
|
|
return _repository.Update(entity);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("报表信息修改异常", ex);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|