package dao

import (
	"time"
)

type IntelligentLighting struct {
	ID           int       `gorm:"primary key" json:"id"`               //编号
	LightID      int       `gorm:"type: int" json:"lightID"`            //照明策略id
	RelationType int       `gorm:"type: int" json:"relationType"`       //关联类型1=灯控,2=灯杆分组
	Rid          int       `gorm:"type:int" json:"rid"`                 //关联外键ID 根据type类型关联至其表
	CreateTime   time.Time `gorm:"type:timestamp" json:"createTime"`    //新增时间
	CreateUser   string    `gorm:"type:varchar(60)" json:"createUser"`  //新增记录操作用户ID
	UpdateTime   time.Time `gorm:"type:timestamp" json:"updateTime"`    //修改时间
	UpdateUser   string    `gorm:"type:varchar(60)" json:"updateUser"`  //修改用户
	IsDeleted    int       `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
	TenantID     string    `gorm:"type:varchar(12)" json:"tenantID"`    //租户id
}

func (IntelligentLighting) Table() string {
	return "t_str_intelligent_lighting"
}

func (c *IntelligentLighting) BatchGet(ids []int) ([]IntelligentLighting, error) {
	var intelligentLightings []IntelligentLighting
	err := Db.Model(&c).Where("light_id in ?", ids).Find(&intelligentLightings).Error
	return intelligentLightings, err
}