This commit is contained in:
suyl
2021-07-22 18:56:18 +08:00
parent 08cdbe84cf
commit b903db0c13
6 changed files with 156 additions and 0 deletions

20
dao/config_dao.go Normal file
View File

@@ -0,0 +1,20 @@
package dao
import (
"git.rosy.net.cn/jx-print/model"
"github.com/jmoiron/sqlx"
)
func GetConfig(db *sqlx.DB, configType, key string) (config *model.NewConfig, err error) {
var (
configs []*model.NewConfig
)
sql := `
SELECT * FROM new_config WHERE type = ? AND key = ?
`
sqlParams := []interface{}{configType, key}
if err = db.Select(&configs, sql, sqlParams...); err == nil && len(configs) > 0 {
return configs[0], err
}
return config, err
}