39 lines
1.0 KiB
C#
39 lines
1.0 KiB
C#
using JY.DAL.Repository;
|
|||
|
|
using JY.Model;
|
||
|
|
using System;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using System.Linq.Expressions;
|
||
|
|
|
||
|
|
namespace JY.DAL.Service
|
||
|
|
{
|
||
|
|
public interface IAlarmDataService : IService<AlarmData>
|
||
|
|
{
|
||
|
|
List<AlarmData> GetAlarmDataByTime(string startTime, string endTime);
|
||
|
|
|
||
|
|
List<AlarmData> GetAlarmCacheData();
|
||
|
|
|
||
|
|
int DeleteAlarmCacheData();
|
||
|
|
}
|
||
|
|
|
||
|
|
public class AlarmDataService : Service<AlarmData>, IAlarmDataService
|
||
|
|
{
|
||
|
|
public AlarmDataService(IRepository<AlarmData> repository) : base(repository)
|
||
|
|
{
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<AlarmData> GetAlarmDataByTime(string startTime, string endTime)
|
||
|
|
{
|
||
|
|
return _repository.GetList(x => x.StartTime >= Convert.ToDateTime(startTime) && x.StartTime <= Convert.ToDateTime(endTime));
|
||
|
|
}
|
||
|
|
|
||
|
|
public List<AlarmData> GetAlarmCacheData()
|
||
|
|
{
|
||
|
|
return _repository.GetList(x => x.Flag == 0);
|
||
|
|
}
|
||
|
|
|
||
|
|
public int DeleteAlarmCacheData()
|
||
|
|
{
|
||
|
|
return _repository.Delete(x => x.Flag == 0);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|