1234567891011121314151617 |
- package dao
- type Operation struct {
- TenantId string `gorm:"type:varchar(12)" json:"tenantId"` //租户ID
- Sn string `gorm:"type:varchar(60)" json:"sn"` //设备序列号
- IsDeleted int `gorm:"type:int;default 0" json:"isDeleted"` //是否删除 0=未删除,1=删除
- }
- func (Operation) TableName() string {
- return "device_light_control"
- }
- func (c Operation) GetSnList() ([]string, error) {
- var sns []string
- err := Db.Debug().Model(&c).Select("sn").Where(" tenant_id = ? and is_deleted = ? ", c.TenantId, c.IsDeleted).Scan(&sns).Error
- return sns, err
- }
|