package dao import "time" type LightCondition struct { ID int `gorm:"primary key" json:"id"` //编号 LightId int `gorm:"type:int" json:"lightId"` //照明策略id ScopeStart int `gorm:"type:int" json:"scopeStart"` //光照度范围开始值 ScopeEnd int `gorm:"type:int" json:"scopeEnd"` //光照度范围结束值 Luminance int `gorm:"type:int " json:"luminance"` //开灯亮度 Remark string `gorm:"type:varchar(255)" json:"remark"` //备注 CreateTime time.Time `gorm:"type:datetime" json:"createTime"` //新增时间 CreateUser int64 `gorm:"type:bigint" json:"createUser"` //新增记录操作用户ID UpdateTime time.Time `gorm:"type:datetime" json:"updateTime"` //修改时间 UpdateUser int64 `gorm:"type:bigint" json:"updateUser"` //修改用户 IsDeleted int `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除 } func (LightCondition) TableName() string { return "t_strategy_light_condition" } func (c *LightCondition) Get() error { return Db.Debug().Model(&c).Where("id = ?", c.ID).Find(&c).Error } func (c *LightCondition) BatchGet(ids []int) ([]LightCondition, error) { var conditions []LightCondition err := Db.Debug().Model(&c).Where("id in ?", ids).Find(&conditions).Error return conditions, err } func (c *LightCondition) Save(conditions []LightCondition) error { return Db.Debug().Model(&c).Save(&conditions).Error }