This commit is contained in:
@@ -49,9 +49,9 @@ public class StoryController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/{storyId}")
|
@GetMapping("/{storyId}")
|
||||||
public ResponseEntity<Story> getStoryById(@PathVariable String storyId) {
|
public ResponseEntity<StoryDetailVo> getStoryById(@PathVariable String storyId) {
|
||||||
log.info("获取故事详情, ID: {}", storyId);
|
log.info("获取故事详情, ID: {}", storyId);
|
||||||
Story story = storyService.getStoryByInstanceId(storyId);
|
StoryDetailVo story = storyService.getStoryByInstanceId(storyId);
|
||||||
return ResponseEntity.success(story);
|
return ResponseEntity.success(story);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ public interface StoryService {
|
|||||||
void createStory(StoryVo storyVo);
|
void createStory(StoryVo storyVo);
|
||||||
void updateStory(StoryVo storyVo, String storyId);
|
void updateStory(StoryVo storyVo, String storyId);
|
||||||
void deleteStory(String storyId);
|
void deleteStory(String storyId);
|
||||||
Story getStoryByInstanceId(String storyId);
|
StoryDetailVo getStoryByInstanceId(String storyId);
|
||||||
List<StoryDetailVo> getStoriesByOwnerId(String ownerId);
|
List<StoryDetailVo> getStoriesByOwnerId(String ownerId);
|
||||||
List<StoryDetailVo> getStories(StoryVo storyVo);
|
List<StoryDetailVo> getStories(StoryVo storyVo);
|
||||||
|
|
||||||
|
|||||||
@@ -136,9 +136,9 @@ public class StoryServiceImpl implements StoryService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Story getStoryByInstanceId(String storyId) {
|
public StoryDetailVo getStoryByInstanceId(String storyId) {
|
||||||
val userId = getCurrentUserId();
|
val userId = getCurrentUserId();
|
||||||
Story story = storyMapper.selectByInstanceId(storyId, userId);
|
StoryDetailVo story = storyMapper.selectByInstanceId(storyId, userId);
|
||||||
if (story == null) {
|
if (story == null) {
|
||||||
throw new CustomException(ResponseEnum.NOT_FOUND);
|
throw new CustomException(ResponseEnum.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@
|
|||||||
WHERE s.instance_id = #{instanceId}
|
WHERE s.instance_id = #{instanceId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectByOwnerId" resultType="com.timeline.story.entity.Story">
|
<select id="selectByOwnerId" resultType="com.timeline.story.vo.StoryDetailVo">
|
||||||
SELECT
|
SELECT
|
||||||
s.*,
|
s.*,
|
||||||
u1.username AS owner_name,
|
u1.username AS owner_name,
|
||||||
|
|||||||
Reference in New Issue
Block a user