forked from wenjy/HighWayIot
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.
92 lines
2.5 KiB
C#
92 lines
2.5 KiB
C#
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
|
|
{
|
|
public class Zx_rfid_settingService
|
|
{
|
|
private static readonly Lazy<Zx_rfid_settingService> lazy = new Lazy<Zx_rfid_settingService>(() => new Zx_rfid_settingService());
|
|
|
|
public static Zx_rfid_settingService Instance
|
|
{
|
|
get
|
|
{
|
|
return lazy.Value;
|
|
}
|
|
}
|
|
|
|
private LogHelper log = LogHelper.Instance;
|
|
Repository<Zx_rfid_setting> _repository => new Repository<Zx_rfid_setting>("sqlserver");
|
|
|
|
/// <summary>
|
|
/// 查询所有RFID设备信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public List<Zx_rfid_setting> GetRfidInfos(Expression<Func<Zx_rfid_setting, bool>> expression = null)
|
|
{
|
|
try
|
|
{
|
|
List<Zx_rfid_setting> entity;
|
|
if (expression != null)
|
|
{
|
|
entity = _repository.GetList(expression);
|
|
}
|
|
else
|
|
{
|
|
entity = _repository.GetList();
|
|
}
|
|
return entity;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("RFID设备信息获取异常", ex);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查询指定RFID设备信息
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public Zx_rfid_setting GetRfidInfoById(int id)
|
|
{
|
|
try
|
|
{
|
|
Zx_rfid_setting entity;
|
|
entity = _repository.GetById(id);
|
|
|
|
return entity;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("RFID设备信息获取异常", ex);
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 修改信息
|
|
/// </summary>
|
|
/// <param name="entity"></param>
|
|
/// <returns></returns>
|
|
public bool UpdateRfidInfo(Zx_rfid_setting entity)
|
|
{
|
|
try
|
|
{
|
|
return _repository.Update(entity);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
log.Error("RFID信息修改异常", ex);
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|