feat(base): 重置数据库序列并优化查询语句
- 在 base 模块初始化时添加重置所有序列的函数
- 修改多个模块中的查询语句,使用 Where(key, value) 替代 Where("key = ?", value)
- 优化部分代码结构,提高可读性和维护性
This commit is contained in:
@@ -25,7 +25,7 @@ func NewBaseSysConfService() *BaseSysConfService {
|
||||
|
||||
// UpdateValue 更新配置值
|
||||
func (s *BaseSysConfService) UpdateValue(cKey, cValue string) error {
|
||||
m := cool.DBM(s.Model).Where("cKey = ?", cKey)
|
||||
m := cool.DBM(s.Model).Where("cKey", cKey)
|
||||
record, err := m.One()
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -36,7 +36,7 @@ func (s *BaseSysConfService) UpdateValue(cKey, cValue string) error {
|
||||
"cValue": cValue,
|
||||
})
|
||||
} else {
|
||||
_, err = cool.DBM(s.Model).Where("cKey = ?", cKey).Data(g.Map{"cValue": cValue}).Update()
|
||||
_, err = cool.DBM(s.Model).Where("cKey", cKey).Data(g.Map{"cValue": cValue}).Update()
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user