From 0329317ba440412c5f50791aa48fc7f3fa4f8ea4 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Mon, 26 Aug 2024 16:39:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B5=84=E8=B4=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/db/implement/sys_cfg_implement.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/db/implement/sys_cfg_implement.go b/app/db/implement/sys_cfg_implement.go index 0690a77..eae90fa 100644 --- a/app/db/implement/sys_cfg_implement.go +++ b/app/db/implement/sys_cfg_implement.go @@ -1,4 +1,4 @@ -package implement +package implement import ( "applet/app/db/dao" @@ -24,7 +24,7 @@ type SysCfgDb struct { func (s SysCfgDb) SysCfgGetAll() (*[]model.SysCfg, error) { var cfgList []model.SysCfg - if err := s.Db.Cols("key,val,memo").Find(&cfgList); err != nil { + if err := s.Db.Cols("k,v,memo").Find(&cfgList); err != nil { return nil, logx.Error(err) } return &cfgList, nil @@ -32,7 +32,7 @@ func (s SysCfgDb) SysCfgGetAll() (*[]model.SysCfg, error) { func (s SysCfgDb) SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) { var cfgList model.SysCfg - has, err := s.Db.Where("`key`=?", key).Get(&cfgList) + has, err := s.Db.Where("`k`=?", key).Get(&cfgList) if err != nil { return nil, logx.Error(err) } @@ -44,7 +44,7 @@ func (s SysCfgDb) SysCfgGetOneNoDataNoErr(key string) (*model.SysCfg, error) { func (s SysCfgDb) SysCfgGetOne(key string) (*model.SysCfg, error) { var cfgList model.SysCfg - if has, err := s.Db.Where("`key`=?", key).Get(&cfgList); err != nil || has == false { + if has, err := s.Db.Where("`k`=?", key).Get(&cfgList); err != nil || has == false { return nil, logx.Error(err) } return &cfgList, nil @@ -62,7 +62,7 @@ func (s SysCfgDb) SysCfgInsert(key, val, memo string) bool { func (s SysCfgDb) SysCfgUpdate(key, val string) bool { cfg := model.SysCfg{K: key, V: val} - _, err := s.Db.Where("`key`=?", key).Cols("val").Update(&cfg) + _, err := s.Db.Where("`k`=?", key).Cols("v").Update(&cfg) if err != nil { logx.Error(err) return false