diff --git a/src/models/official/db_sys_cfg.go b/src/models/official/db_sys_cfg.go new file mode 100644 index 0000000..7849fe3 --- /dev/null +++ b/src/models/official/db_sys_cfg.go @@ -0,0 +1,23 @@ +package db + +import ( + "code.fnuoos.com/go_rely_warehouse/zyos_model.git/src/models/official/model" + "xorm.io/xorm" +) + +func SysCfgByKey(eg *xorm.Engine, key string) *model.SysCfg { + var data model.SysCfg + get, err := eg.Where("k=?", key).Get(&data) + if get == false || err != nil { + return nil + } + return &data +} +func SysCfgByKeyStr(eg *xorm.Engine, key string) string { + var data model.SysCfg + get, err := eg.Where("k=?", key).Get(&data) + if get == false || err != nil { + return "" + } + return data.V +} diff --git a/src/models/official/model/sys_cfg.go b/src/models/official/model/sys_cfg.go new file mode 100644 index 0000000..5508c9a --- /dev/null +++ b/src/models/official/model/sys_cfg.go @@ -0,0 +1,7 @@ +package model + +type SysCfg struct { + K string `json:"k" xorm:"not null pk comment('键') VARCHAR(127)"` + V string `json:"v" xorm:"comment('值') TEXT"` + Memo string `json:"memo" xorm:"not null default '' comment('备注') VARCHAR(255)"` +}