修复pgsql和数据库导入bug,增加默认mod中的datatypes (#1712)
* 多文件: fix error specified more than once in PG * Update sys_authority.go * Update sys_authority.go * sys_export_template.go: 导入Excel时使用批量插入提高性能 * 添加gorm.io/datatypes --------- Co-authored-by: crazyrunsnail <fjyuan1991@163.com> Co-authored-by: XiMo-210 <2831802697@qq.com>
This commit is contained in:
co-authored by
crazyrunsnail
XiMo-210
parent
61dd524c26
commit
4074a52b1b
@@ -63,13 +63,17 @@ func (dictionaryService *DictionaryService) UpdateSysDictionary(sysDictionary *s
|
||||
"Status": sysDictionary.Status,
|
||||
"Desc": sysDictionary.Desc,
|
||||
}
|
||||
db := global.GVA_DB.Where("id = ?", sysDictionary.ID).First(&dict)
|
||||
err = global.GVA_DB.Where("id = ?", sysDictionary.ID).First(&dict).Error
|
||||
if err != nil {
|
||||
global.GVA_LOG.Debug(err.Error())
|
||||
return errors.New("查询字典数据失败")
|
||||
}
|
||||
if dict.Type != sysDictionary.Type {
|
||||
if !errors.Is(global.GVA_DB.First(&system.SysDictionary{}, "type = ?", sysDictionary.Type).Error, gorm.ErrRecordNotFound) {
|
||||
return errors.New("存在相同的type,不允许创建")
|
||||
}
|
||||
}
|
||||
err = db.Updates(sysDictionaryMap).Error
|
||||
err = global.GVA_DB.Model(&dict).Updates(sysDictionaryMap).Error
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user