cygx_yanxuan_special_company.go 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package models
  2. import "github.com/beego/beego/v2/client/orm"
  3. type CygxYanxuanSpecialCompany struct {
  4. Id int `orm:"column(id);pk"`
  5. TradeCode string `json:"trade_code"` // 交易代码
  6. SecName string `json:"sec_name"` // 公司名
  7. PyName string `json:"py_name"` // 拼音名
  8. Region string `json:"region"` // 地区
  9. }
  10. type VmpStocks struct {
  11. Code int
  12. Msg string
  13. Data []CygxYanxuanSpecialCompany
  14. }
  15. // 批量添加
  16. func AddCygxYanxuanSpecialCompanyMulti(items []*CygxYanxuanSpecialCompany) (err error) {
  17. o := orm.NewOrm()
  18. if len(items) > 0 {
  19. //批量添加
  20. _, err = o.InsertMulti(len(items), items)
  21. }
  22. return
  23. }
  24. func GetYanxuanSpecialCompany(keyword string) (IndustryNames []string, err error) {
  25. o := orm.NewOrm()
  26. sql := ``
  27. sql = `SELECT sec_name FROM cygx_yanxuan_special_company WHERE sec_name LIKE '%` + keyword + `%' `
  28. _, err = o.Raw(sql).QueryRows(&IndustryNames)
  29. return
  30. }
  31. func DelYanxuanSpecialCompany() (err error) {
  32. o := orm.NewOrm()
  33. sql := ``
  34. sql = `DELETE FROM cygx_yanxuan_special_company `
  35. _, err = o.Raw(sql).Exec()
  36. return
  37. }