44 lines
1.0 KiB
C#
44 lines
1.0 KiB
C#
|
using DispenserCommon.DB;
|
|||
|
using DispenserCommon.Ioc;
|
|||
|
using DispenserCommon.Utils;
|
|||
|
using DispenserCore.Model.Entity;
|
|||
|
|
|||
|
namespace DispenserCore.Service;
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 日志参数业务接口
|
|||
|
/// </summary>
|
|||
|
[Component]
|
|||
|
public class LogParamsService
|
|||
|
{
|
|||
|
private readonly SqliteHelper _db = ServiceLocator.GetService<SqliteHelper>();
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 获取算法参数
|
|||
|
/// </summary>
|
|||
|
/// <returns></returns>
|
|||
|
public LogParams? GetLogParams()
|
|||
|
{
|
|||
|
return _db.Query<LogParams>("select * from log_params limit 1")
|
|||
|
.FirstOrDefault();
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 保存或者更新系统参数
|
|||
|
/// </summary>
|
|||
|
/// <param name="params"></param>
|
|||
|
/// <returns></returns>
|
|||
|
public LogParams SaveOrUpdate(LogParams @params)
|
|||
|
{
|
|||
|
return _db.SaveOrUpdate(@params);
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 清除历史纪录
|
|||
|
/// </summary>
|
|||
|
/// <param name="id"></param>
|
|||
|
public void Delete(string id)
|
|||
|
{
|
|||
|
_db.DeleteById<CameraParams>(id);
|
|||
|
}
|
|||
|
}
|