From b0be8350bc0f240469e846867c197acdc3740b15 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Fri, 18 Oct 2024 15:15:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/models/official/db_sys_cfg.go | 23 +++++++++++++++++++++++ src/models/official/model/sys_cfg.go | 7 +++++++ 2 files changed, 30 insertions(+) create mode 100644 src/models/official/db_sys_cfg.go create mode 100644 src/models/official/model/sys_cfg.go 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)"` +}