model.go 480 B

123456789101112131415161718192021
  1. package yb_index_tab
  2. import (
  3. "errors"
  4. "hongze/hongze_yb/global"
  5. "hongze/hongze_yb/utils"
  6. )
  7. // GetListByCondition 条件获取列表
  8. func GetListByCondition(where map[string]interface{}) (list []*YbIndexTab, err error) {
  9. cond, vals, e := utils.WhereBuild(where)
  10. if e != nil {
  11. err = errors.New("系统异常,生成查询语句失败")
  12. return
  13. }
  14. err = global.DEFAULT_MYSQL.Model(YbIndexTab{}).
  15. Where(cond, vals...).
  16. Order("sort ASC").
  17. Scan(&list).Error
  18. return
  19. }