package models import "github.com/beego/beego/v2/client/orm" type CygxYanxuanSpecialCompany struct { Id int `orm:"column(id);pk"` TradeCode string `json:"trade_code"` // 交易代码 SecName string `json:"sec_name"` // 公司名 PyName string `json:"py_name"` // 拼音名 Region string `json:"region"` // 地区 } type VmpStocks struct { Code int Msg string Data []CygxYanxuanSpecialCompany } // 批量添加 func AddCygxYanxuanSpecialCompanyMulti(items []*CygxYanxuanSpecialCompany) (err error) { o := orm.NewOrm() if len(items) > 0 { //批量添加 _, err = o.InsertMulti(len(items), items) } return } func GetYanxuanSpecialCompany(keyword string) (IndustryNames []string, err error) { o := orm.NewOrm() sql := `` sql = `SELECT sec_name FROM cygx_yanxuan_special_company WHERE sec_name LIKE '%` + keyword + `%' ` _, err = o.Raw(sql).QueryRows(&IndustryNames) return } func DelYanxuanSpecialCompany() (err error) { o := orm.NewOrm() sql := `` sql = `DELETE FROM cygx_yanxuan_special_company ` _, err = o.Raw(sql).Exec() return }