1. 前端改为vue单体程序

2. 增加设备管理相关接口
This commit is contained in:
2025-09-08 18:16:40 +08:00
parent e5383ce268
commit 7112a16ca8
853 changed files with 546690 additions and 620 deletions

View File

@@ -31,6 +31,9 @@ type DeviceRepo interface {
// Delete 删除设备
Delete(id uint) error
// ListAll 获取所有设备列表
ListAll() ([]model.Device, error)
}
// DeviceControlRepo 设备控制仓库接口
@@ -103,6 +106,15 @@ func (r *deviceRepo) FindByIDString(id string) (*model.Device, error) {
return &device, nil
}
// ListAll 获取所有设备列表
func (r *deviceRepo) ListAll() ([]model.Device, error) {
var devices []model.Device
if err := r.db.Find(&devices).Error; err != nil {
return nil, err
}
return devices, nil
}
// FindByParentID 根据上级设备ID查找设备
func (r *deviceRepo) FindByParentID(parentID uint) ([]*model.Device, error) {
var devices []*model.Device