timeConditionDao.go 1.2 KB

12345678910111213141516171819202122232425
  1. package dao
  2. import "time"
  3. type TimeCondition struct {
  4. ID int `gorm:"primary key" json:"id"` //编号
  5. LightId int `gorm:"type: int" json:"lightId"` //照明策略id
  6. StartTime string `gorm:"type:time" json:"startTime"` //开始时间
  7. EndTime string `gorm:"type: time" json:"endTime"` //结束时间
  8. Luminance int `gorm:"type:int " json:"luminance"` //开灯亮度
  9. Remark string `gorm:"type:varchar(255)" json:"remark"` //备注
  10. CreateTime time.Time `gorm:"type: datetime" json:"createTime"` //新增时间
  11. CreateUser string `gorm:"type:varchar(60)" json:"createUser"` //新增记录操作用户ID
  12. UpdateTime time.Time `gorm:"type: datetime" json:"updateTime"` //修改时间
  13. UpdateUser string `gorm:"type:varchar(60)" json:"updateUser"` //修改用户
  14. IsDeleted int `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
  15. Sunshine int `gorm:"type:int;default 1" json:"sunshine"` //日出日落 设置 2=开启,1=不开启
  16. }
  17. func (TimeCondition) TableName() string {
  18. return "t_strategy_time_condition"
  19. }
  20. func (c *TimeCondition) Get() error {
  21. return Db.Model(&c).Where("id = ?", c.ID).Find(&c).Error
  22. }