|
|
@@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.Transactional |
|
|
|
import org.springframework.web.multipart.MultipartFile |
|
|
|
import java.io.ByteArrayInputStream |
|
|
|
import java.io.IOException |
|
|
|
import java.util.Map |
|
|
|
import kotlin.collections.Map |
|
|
|
import java.util.Optional |
|
|
|
import javax.imageio.ImageIO |
|
|
|
|
|
|
@@ -46,7 +46,7 @@ open class FileService( |
|
|
|
open fun findFileByIdAndKey(id: Long, skey: String): Optional<File> { |
|
|
|
return jdbcDao.queryForEntity( |
|
|
|
"SELECT * from file f where f.id = :id and f.skey = :skey ", |
|
|
|
Map.of("id", id, "skey", skey), File::class.java |
|
|
|
setOf("id", id, "skey", skey), File::class.java |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
@@ -54,14 +54,14 @@ open class FileService( |
|
|
|
open fun findFileRefByTypeAndId(refType: String, refId: Long): List<FileRef> { |
|
|
|
return jdbcDao.queryForList( |
|
|
|
"SELECT * from file_ref where refType = :refType and refId = :refId order by id ", |
|
|
|
java.util.Map.of("refType", refType, "refId", refId), FileRef::class.java |
|
|
|
setOf("refType", refType, "refId", refId), FileRef::class.java |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = [Exception::class], readOnly = true) |
|
|
|
open fun findFileRefByFileId(fileId: Long): Optional<FileRef> { |
|
|
|
return jdbcDao.queryForEntity( |
|
|
|
"SELECT * from file_ref where fileId = :fileId", java.util.Map.of("fileId", fileId), |
|
|
|
"SELECT * from file_ref where fileId = :fileId", setOf("fileId", fileId), |
|
|
|
FileRef::class.java |
|
|
|
) |
|
|
|
} |
|
|
@@ -70,7 +70,7 @@ open class FileService( |
|
|
|
open fun findFileBlobByFileId(fileId: Long): Optional<FileBlob> { |
|
|
|
return jdbcDao.queryForEntity( |
|
|
|
"SELECT * from file_blob fb where fb.fileId = :fileId ", |
|
|
|
java.util.Map.of("fileId", fileId), FileBlob::class.java |
|
|
|
setOf("fileId", fileId), FileBlob::class.java |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
@@ -83,7 +83,7 @@ open class FileService( |
|
|
|
+ " AND f.id = :id" |
|
|
|
+ " AND f.skey = :skey") |
|
|
|
|
|
|
|
val count = jdbcDao.queryForInt(sql, Map.of("id", id, "skey", skey)) |
|
|
|
val count = jdbcDao.queryForInt(sql, setOf("id", id, "skey", skey)) |
|
|
|
|
|
|
|
return (count > 0) |
|
|
|
} |
|
|
@@ -129,7 +129,7 @@ open class FileService( |
|
|
|
@Transactional(isolation = Isolation.SERIALIZABLE, rollbackFor = [Exception::class], readOnly = false) |
|
|
|
open fun deleteFile(fileId: Long, refId: Long, refType: String, skey: String) { |
|
|
|
val args = |
|
|
|
Map.of("fileId", fileId, "refId", refId, "refType", refType, "skey", skey) |
|
|
|
setOf("fileId", fileId, "refId", refId, "refType", refType, "skey", skey) |
|
|
|
|
|
|
|
jdbcDao.executeUpdate( |
|
|
|
("DELETE FROM file_ref" |
|
|
@@ -143,7 +143,7 @@ open class FileService( |
|
|
|
|
|
|
|
@Transactional(isolation = Isolation.SERIALIZABLE, rollbackFor = [Exception::class], readOnly = false) |
|
|
|
open fun deleteFile(fileId: Long?, skey: String?, filename: String?) { |
|
|
|
val args = Map.of("fileId", fileId, "skey", skey, "filename", filename) |
|
|
|
val args = setOf("fileId", fileId, "skey", skey, "filename", filename) |
|
|
|
|
|
|
|
jdbcDao.executeUpdate( |
|
|
|
("DELETE FROM file_ref " |
|
|
|