package data_manage

import "github.com/beego/beego/v2/client/orm"

type EdbConfig struct {
	ConfigValue string `description:"详情"`
}

// EdbConfigUpdate 修改配置
func EdbConfigUpdate(newValue, configCode string) (err error) {
	o := orm.NewOrmUsingDB("data")
	sql := `UPDATE edb_config SET  config_value=?   WHERE config_code=  ?`
	_, err = o.Raw(sql, newValue, configCode).Exec()
	return
}

// GetConfigDetailByCode 根据配置编码获取配置的值
func GetConfigDetailByCode(configCode string) (item *EdbConfig, err error) {
	o := orm.NewOrmUsingDB("data")
	sql := ` SELECT config_value FROM edb_config WHERE config_code=? `
	err = o.Raw(sql, configCode).QueryRow(&item)
	return
}
