query.go 544 B

1234567891011121314151617181920212223
  1. package chart_variety
  2. import (
  3. "hongze/hongze_yb/global"
  4. )
  5. // GetVarietyListByIdList
  6. // @Description: 根据ID列表获取品种列表
  7. // @author: Roc
  8. // @datetime 2023-11-23 17:56:39
  9. // @param idList []int
  10. // @return items []*ChartVariety
  11. // @return err error
  12. func GetVarietyListByIdList(idList []int) (items []*ChartVariety, err error) {
  13. num := len(idList)
  14. if num <= 0 {
  15. return
  16. }
  17. sql := ` SELECT * FROM chart_variety WHERE 1 = 1 AND chart_variety_id in (?)`
  18. err = global.MYSQL["data"].Raw(sql, idList).Find(&items).Error
  19. return
  20. }