diff --git a/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java b/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java index efbdfbca..75d24af1 100644 --- a/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java +++ b/backend/src/main/java/ai/basic/x1/usecase/DataInfoUseCase.java @@ -229,12 +229,14 @@ public void deleteBatch(Long datasetId, List ids) { if (count > 0) { throw new UsecaseException(UsecaseCode.DATASET_DATA_OTHERS_ANNOTATING); } - var dataInfoDeleteLambdaQueryWrapper = Wrappers.lambdaQuery(DataInfo.class); - dataInfoDeleteLambdaQueryWrapper.eq(DataInfo::getDatasetId, datasetId); - dataInfoDeleteLambdaQueryWrapper.nested(wq -> wq.in(DataInfo::getId, ids) + + var dataInfoLambdaUpdateWrapper = Wrappers.lambdaUpdate(DataInfo.class); + dataInfoLambdaUpdateWrapper.setSql("del_unique_key=id,is_deleted=1"); + dataInfoLambdaUpdateWrapper.eq(DataInfo::getDatasetId, datasetId); + dataInfoLambdaUpdateWrapper.nested(wq -> wq.in(DataInfo::getId, ids) .or() .in(DataInfo::getParentId, ids)); - dataInfoDAO.remove(dataInfoDeleteLambdaQueryWrapper); + dataInfoDAO.update(dataInfoLambdaUpdateWrapper); executorService.execute(Objects.requireNonNull(TtlRunnable.get(() -> { var dataAnnotationObjectLambdaUpdateWrapper = Wrappers.lambdaUpdate(DataAnnotationObject.class); diff --git a/backend/src/main/java/ai/basic/x1/usecase/UploadDataUseCase.java b/backend/src/main/java/ai/basic/x1/usecase/UploadDataUseCase.java index fb40ec45..9e08cd0c 100644 --- a/backend/src/main/java/ai/basic/x1/usecase/UploadDataUseCase.java +++ b/backend/src/main/java/ai/basic/x1/usecase/UploadDataUseCase.java @@ -830,9 +830,9 @@ private void createUploadThumbnail(Long userId, List fileBOS, String roo var suffix = FileUtil.getSuffix(fileName); suffix = suffix.equalsIgnoreCase(TIFF_SUFFIX) || suffix.equalsIgnoreCase(TIF_SUFFIX) ? "jpg" : suffix; var prefix = FileUtil.getPrefix(fileName); - var largeFile = FileUtil.file(basePath, String.format("%s_%s.%s", prefix, large, suffix)); - var mediumFile = FileUtil.file(basePath, String.format("%s_%s.%s", prefix, medium, suffix)); - var smallFile = FileUtil.file(basePath, String.format("%s_%s.%s", prefix, small, suffix)); + var largeFile = FileUtil.file(tempPath, String.format("%s_%s.%s", prefix, large, suffix)); + var mediumFile = FileUtil.file(tempPath, String.format("%s_%s.%s", prefix, medium, suffix)); + var smallFile = FileUtil.file(tempPath, String.format("%s_%s.%s", prefix, small, suffix)); Thumbnails.of(file).size(largeFileSize, largeFileSize).toFile(largeFile); Thumbnails.of(largeFile).size(mediumFileSize, mediumFileSize).toFile(mediumFile); Thumbnails.of(largeFile).size(smallFileSize, smallFileSize).toFile(smallFile); diff --git a/deploy/mysql/migration/V1__Create_tables.sql b/deploy/mysql/migration/V1__Create_tables.sql index 1212a589..1d860b90 100644 --- a/deploy/mysql/migration/V1__Create_tables.sql +++ b/deploy/mysql/migration/V1__Create_tables.sql @@ -69,7 +69,7 @@ CREATE TABLE `data` `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'Update time', `updated_by` bigint(20) DEFAULT NULL COMMENT 'Modify person id', PRIMARY KEY (`id`) USING BTREE, - UNIQUE KEY `uk_dataset_id_type_prent_id_name` (`dataset_id`, `type`, `parent_id`, `name`, `del_unique_key`) USING BTREE, + UNIQUE KEY `uk_dataset_id_type_parent_id_name` (`dataset_id`, `type`, `parent_id`, `name`, `del_unique_key`) USING BTREE, KEY `idx_dataset_id_created_at` (`dataset_id`, `created_at`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1