Compare commits

..

3 Commits

Author SHA1 Message Date
s2042968 a22b20aab7 fix:库文件增添取消收藏接口 2025-04-11 17:43:57 +08:00
s2042968 821f4adfc1 fix:废除标签时同时废除标签关联关系 2025-04-11 17:16:32 +08:00
s2042968 346b971481 fix:已发布标签组添加标签时也显示已发布 2025-04-11 17:01:40 +08:00
2 changed files with 20 additions and 1 deletions

View File

@ -176,4 +176,17 @@ public class RepoEdFileInfoController {
String userId = UserThreadLocal.getUserId();
return ElectromagneticResultUtil.success(edFileInfoService.addFavorite(userId, id));
}
/**
* 从收藏夹移除
*
* @param id 文件id
* @return
*/
@GetMapping("/removeCollection")
@UserOperation(value = "从收藏夹移除文件", modelName = UserOperationModuleEnum.USER_PRJ)
public ElectromagneticResult<?> removeFavorite(@RequestParam String id) {
String userId = UserThreadLocal.getUserId();
return ElectromagneticResultUtil.success(edFileInfoService.removeFavorite(userId, id));
}
}

View File

@ -79,7 +79,11 @@ public class EdTagLibraryServiceImpl extends ServiceImpl<EdTagLibraryMapper, EdT
tag.setType(TagTypeEnum.TAG.getCode()); // 标签
tag.setTagName(tagName);
tag.setOrderBy(maxOrder + 1); // 默认排序
tag.setIsPublished(PublishEnum.UNPUBLISHED.getCode()); // 默认未发布
// 判断标签组有无发布若发布则标签已发布若未发布则标签未发布
int isPublished = this.getById(parentId).getIsPublished();
tag.setIsPublished(isPublished);
tag.setCreatedBy(createdBy);
boolean isSuccess = this.save(tag);
if (isSuccess) {
@ -198,6 +202,8 @@ public class EdTagLibraryServiceImpl extends ServiceImpl<EdTagLibraryMapper, EdT
}
// 删除本身
boolean isDeleted = this.removeById(tagId);
// 删除本身的关联关系
fileTagRelationMapper.delete(new LambdaQueryWrapper<FileTagRelation>().eq(FileTagRelation::getTagId, tagId));
if (isDeleted) {
UserThreadLocal.setSuccessInfo("", tagId, StrFormatter.format("删除了标签 {} ", tag.getTagName()));
}