sql.go 410 B

12345678910111213141516171819
  1. package mqtt
  2. import (
  3. pasturePb "gitee.com/xuyiping_admin/go_proto/proto/go/backend/cow"
  4. )
  5. // NeckRingIsBind 脖环是否绑定
  6. func (e *Entry) NeckRingIsBind(number string) bool {
  7. var count int64 = 0
  8. if err := e.DB.Where("number = ?", number).
  9. Where("status != ?", pasturePb.NeckRingStatus_Unbind).
  10. Count(&count).Error; err != nil {
  11. return false
  12. }
  13. if count > 0 {
  14. return true
  15. }
  16. return false
  17. }