model.go 499 B

123456789101112131415161718
  1. package variety_classify
  2. import "hongze/hongze_yb/global"
  3. func GetVarietyClassifyList() (list []*VarietyClassify, err error) {
  4. err = global.DEFAULT_MYSQL.Model(VarietyClassify{}).
  5. Where("state = 1").
  6. Order("sort ASC").
  7. Scan(&list).Error
  8. return
  9. }
  10. func GetVarietyClassifyById(varietyClassifyId int) (item *VarietyClassify, err error) {
  11. err = global.DEFAULT_MYSQL.Model(VarietyClassify{}).
  12. Where("variety_classify_id = ? AND state = 1", varietyClassifyId).
  13. First(&item).Error
  14. return
  15. }