修复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:
PiexlMax(奇淼
2024-04-13 18:46:58 +08:00
committed by GitHub
co-authored by crazyrunsnail XiMo-210
parent 61dd524c26
commit 4074a52b1b
6 changed files with 30 additions and 11 deletions
+6 -2
View File
@@ -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
}