故事增加权限响应及校验
All checks were successful
test/timeline-server/pipeline/head This commit looks good

This commit is contained in:
2025-12-31 14:02:11 +08:00
parent 5285d50687
commit eb1e6949f9
4 changed files with 6 additions and 6 deletions

View File

@@ -49,9 +49,9 @@ public class StoryController {
}
@GetMapping("/{storyId}")
public ResponseEntity<Story> getStoryById(@PathVariable String storyId) {
public ResponseEntity<StoryDetailVo> getStoryById(@PathVariable String storyId) {
log.info("获取故事详情, ID: {}", storyId);
Story story = storyService.getStoryByInstanceId(storyId);
StoryDetailVo story = storyService.getStoryByInstanceId(storyId);
return ResponseEntity.success(story);
}

View File

@@ -10,7 +10,7 @@ public interface StoryService {
void createStory(StoryVo storyVo);
void updateStory(StoryVo storyVo, String storyId);
void deleteStory(String storyId);
Story getStoryByInstanceId(String storyId);
StoryDetailVo getStoryByInstanceId(String storyId);
List<StoryDetailVo> getStoriesByOwnerId(String ownerId);
List<StoryDetailVo> getStories(StoryVo storyVo);

View File

@@ -136,9 +136,9 @@ public class StoryServiceImpl implements StoryService {
}
@Override
public Story getStoryByInstanceId(String storyId) {
public StoryDetailVo getStoryByInstanceId(String storyId) {
val userId = getCurrentUserId();
Story story = storyMapper.selectByInstanceId(storyId, userId);
StoryDetailVo story = storyMapper.selectByInstanceId(storyId, userId);
if (story == null) {
throw new CustomException(ResponseEnum.NOT_FOUND);
}

View File

@@ -42,7 +42,7 @@
WHERE s.instance_id = #{instanceId}
</select>
<select id="selectByOwnerId" resultType="com.timeline.story.entity.Story">
<select id="selectByOwnerId" resultType="com.timeline.story.vo.StoryDetailVo">
SELECT
s.*,
u1.username AS owner_name,