config.go 486 B

12345678910111213141516171819
  1. package yb
  2. import "github.com/beego/beego/v2/client/orm"
  3. type Config struct {
  4. ConfigValue string `description:"配置值"`
  5. ConfigCode string `description:"配置编码"`
  6. }
  7. func (c *Config) TableName() string {
  8. return "yb_config"
  9. }
  10. // GetConfigByCode 查询配置详情
  11. func GetConfigByCode(configCode string) (item *Config, err error) {
  12. o := orm.NewOrm()
  13. sql := `SELECT * FROM yb_config WHERE config_code= ?`
  14. err = o.Raw(sql, configCode).QueryRow(&item)
  15. return
  16. }