去掉设备信息中的status字段

This commit is contained in:
2025-09-08 19:56:05 +08:00
parent 7819773562
commit 9d36ae6b00
5 changed files with 168 additions and 324 deletions

View File

@@ -119,7 +119,6 @@ func (c *Controller) Create(ctx *gin.Context) {
Name: req.Name,
Type: req.Type,
ParentID: req.ParentID,
Status: "active", // 默认设置为active状态
}
if err := c.deviceRepo.Create(device); err != nil {
@@ -176,9 +175,7 @@ func (c *Controller) Update(ctx *gin.Context) {
device.Name = req.Name
device.Type = req.Type
device.ParentID = req.ParentID
// TODO: 设备状态应该由系统自动获取,而不是由用户指定
// 这里保持设备原有状态,后续需要实现自动状态检测
// device.Status = req.Status
// 设备状态现在只在内存中维护,不持久化到数据库
if err := c.deviceRepo.Update(device); err != nil {
c.logger.Error("更新设备失败: " + err.Error())

View File

@@ -42,9 +42,6 @@ type Device struct {
// ParentID 上级设备ID(用于设备层级关系,指向区域主控设备)
ParentID *uint `gorm:"column:parent_id;index" json:"parent_id"`
// Status 设备状态
Status string `gorm:"not null;column:status" json:"status"`
// CreatedAt 创建时间
CreatedAt time.Time `gorm:"column:created_at" json:"created_at"`