fix: 优化文件上传时的数据库查询条件

This commit is contained in:
pixelmaxQM
2025-12-06 15:46:15 +08:00
parent f23df92c18
commit 805f319578

View File

@@ -110,7 +110,7 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader,
if noSave == "0" {
// 检查是否已存在相同key的记录
var existingFile example.ExaFileUploadAndDownload
err = global.GVA_DB.Where("`key` = ?", key).First(&existingFile).Error
err = global.GVA_DB.Where(&example.ExaFileUploadAndDownload{Key: key}).First(&existingFile).Error
if errors.Is(err, gorm.ErrRecordNotFound) {
return f, e.Upload(f)
}