This commit is contained in:
zimoyin
2026-04-06 20:48:32 +08:00
parent 76e9f24aa7
commit 13fd9c5f0a
77 changed files with 6034 additions and 42 deletions
@@ -0,0 +1,32 @@
<?php
namespace plugin\admin\app\repository;
use plugin\admin\app\model\OpmDsSensor;
use plugin\admin\app\repository\exception\EntityNotFoundException;
class SensorRepository extends BaseRepository
{
public function __construct()
{
$this->model = new OpmDsSensor;
}
public static function new(): SensorRepository
{
return new self();
}
/**
* 根据ID查找传感器
* @throws EntityNotFoundException
*/
public function findOrFail(int $id): OpmDsSensor
{
$sensor = $this->scopedQuery()->find($id);
if (!$sensor) {
throw new EntityNotFoundException('传感器不存在');
}
return $sensor;
}
}