refactor(service): 优化代码结构和导入

- 移除了未使用的导入语句
- 删除了不必要的变量和注释
-简化了一些代码逻辑
This commit is contained in:
LingandRX 2025-05-11 22:03:40 +08:00
parent 9a8263b051
commit 6d8e44627f
3 changed files with 0 additions and 9 deletions

View File

@ -14,7 +14,6 @@ import com.example.copykamanotes.model.entity.Comment;
import com.example.copykamanotes.model.entity.Note;
import com.example.copykamanotes.model.entity.User;
import com.example.copykamanotes.model.vo.comment.CommentVO;
import com.example.copykamanotes.model.vo.note.NoteVO;
import com.example.copykamanotes.model.vo.user.UserActionVO;
import com.example.copykamanotes.scope.RequestScopeData;
import com.example.copykamanotes.service.CommentService;
@ -26,9 +25,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
@ -217,8 +214,6 @@ public class CommentServiceImpl implements CommentService {
@NeedLogin
@Transactional
public ApiResponse<EmptyVO> unlikeComment(Integer commentId) {
Long userId= requestScopeData.getUserId();
Comment comment = commentMapper.findById(commentId);
if (comment == null) {
return ApiResponse.error(HttpStatus.NOT_FOUND.value(), "评论不存在");

View File

@ -1,7 +1,6 @@
package com.example.copykamanotes.service.impl;
import com.example.copykamanotes.annotation.NeedLogin;
import com.example.copykamanotes.mapper.MessageMapper;
import com.example.copykamanotes.mapper.NoteLikeMapper;
import com.example.copykamanotes.mapper.NoteMapper;
import com.example.copykamanotes.model.base.ApiResponse;
@ -13,7 +12,6 @@ import com.example.copykamanotes.service.MessageService;
import com.example.copykamanotes.service.NoteLikeService;
import com.example.copykamanotes.utils.ApiResponseUtils;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

View File

@ -17,10 +17,8 @@ import com.example.copykamanotes.service.*;
import com.example.copykamanotes.utils.ApiResponseUtils;
import com.example.copykamanotes.utils.MarkdownUtils;
import com.example.copykamanotes.utils.PaginationUtils;
import com.google.protobuf.Api;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.relational.core.sql.In;
import org.springframework.stereotype.Service;
import java.util.*;