query.go 1.1 KB

123456789101112131415161718192021222324252627
  1. package future_good_edb_info
  2. import "hongze/hongze_yb/global"
  3. // GetFutureGoodEdbInfoListByParentId 根据父级ID获取指标数据列表
  4. func GetFutureGoodEdbInfoListByParentId(parentId int) (list []*FutureGoodEdbInfo, err error) {
  5. sql := `SELECT * FROM future_good_edb_info WHERE parent_id = ? or future_good_edb_info_id = ? ORDER BY future_good_edb_info_id ASC `
  6. err = global.MYSQL["data"].Raw(sql, parentId, parentId).Scan(&list).Error
  7. return
  8. }
  9. // GetFutureGoodEdbInfoByCode 根据期货code获取 期货指标信息
  10. func GetFutureGoodEdbInfoByCode(futureGoodEdbCode string) (item *FutureGoodEdbInfo, err error) {
  11. sql := `SELECT * FROM future_good_edb_info WHERE future_good_edb_code = ? ORDER BY future_good_edb_info_id ASC `
  12. err = global.MYSQL["data"].Raw(sql, futureGoodEdbCode).First(&item).Error
  13. return
  14. }
  15. // GetFutureGoodEdbInfo 期货指标
  16. func GetFutureGoodEdbInfo(edbInfoId int) (item *FutureGoodEdbInfo, err error) {
  17. sql := `SELECT * FROM future_good_edb_info WHERE future_good_edb_info_id = ? ORDER BY future_good_edb_info_id ASC `
  18. err = global.MYSQL["data"].Raw(sql, edbInfoId).First(&item).Error
  19. return
  20. }