Skip to content

Commit 805f319

Browse files
committed
fix: 优化文件上传时的数据库查询条件
1 parent f23df92 commit 805f319

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

server/service/example/exa_file_upload_download.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ func (e *FileUploadAndDownloadService) UploadFile(header *multipart.FileHeader,
110110
if noSave == "0" {
111111
// 检查是否已存在相同key的记录
112112
var existingFile example.ExaFileUploadAndDownload
113-
err = global.GVA_DB.Where("`key` = ?", key).First(&existingFile).Error
113+
err = global.GVA_DB.Where(&example.ExaFileUploadAndDownload{Key: key}).First(&existingFile).Error
114114
if errors.Is(err, gorm.ErrRecordNotFound) {
115115
return f, e.Upload(f)
116116
}

0 commit comments

Comments
 (0)