operationDao.go 582 B

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