using HighWayIot.Log4net;
using HighWayIot.Repository.domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace HighWayIot.Repository.service.Impl
{
    public class BaseStateServiceImpl : IStateService
    {
        private LogHelper log = LogHelper.Instance;
        Repository<RFIDState> _repository => new Repository<RFIDState>("mysql");

        public List<RFIDState> GetStateInfos()
        {
            try
            {
                List<RFIDState> deviceInfo = _repository.GetList();
                return deviceInfo;
            }catch (Exception ex)
            {
                log.Error("RFID状态信息获取异常", ex);
                return null;
            }
        }

        public void AddStateInfo(RFIDState state)
        {
            try
            {
                _repository.Insert(state);
            }
            catch (Exception ex)
            {
                log.Error("RFID状态信息插入异常", ex);
            }
        }
    }
}
