refactor: 移除 StoryItem 的分享相关功能和字段
All checks were successful
test/timeline-server/pipeline/head This commit looks good
All checks were successful
test/timeline-server/pipeline/head This commit looks good
从 StoryItem 实体类中删除了 shareId、type、status 和 cover 字段,并注释掉了控制器、服务层及 Mapper 中所有根据 shareId 查询的方法。同时同步更新了 SQL 映射文件,移除了对应的数据库操作字段。
This commit is contained in:
@@ -80,17 +80,20 @@ public class StoryItemController {
|
||||
return ResponseEntity.success(count);
|
||||
}
|
||||
|
||||
@GetMapping("/public/story/item/{shareId}")
|
||||
public ResponseEntity<StoryItemShareVo> getStoryItemByShareId(@PathVariable String shareId) {
|
||||
log.info("获取分享的 StoryItem,shareId: {}", shareId);
|
||||
StoryItemShareVo item = storyItemService.getItemByShareId(shareId);
|
||||
return ResponseEntity.success(item);
|
||||
}
|
||||
/*
|
||||
* @GetMapping("/public/story/item/{shareId}")
|
||||
* public ResponseEntity<StoryItemShareVo> getStoryItemByShareId(@PathVariable
|
||||
* String shareId) {
|
||||
* log.info("获取分享的 StoryItem,shareId: {}", shareId);
|
||||
* StoryItemShareVo item = storyItemService.getItemByShareId(shareId);
|
||||
* return ResponseEntity.success(item);
|
||||
* }
|
||||
*/
|
||||
|
||||
@GetMapping("/search")
|
||||
public ResponseEntity<Map> searchItems(@RequestParam String keyword,
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
@RequestParam(defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(defaultValue = "10") Integer pageSize) {
|
||||
log.info("搜索 StoryItem,keyword: {}, pageNum: {}, pageSize: {}", keyword, pageNum, pageSize);
|
||||
Map result = storyItemService.searchItems(keyword, pageNum, pageSize);
|
||||
return ResponseEntity.success(result);
|
||||
|
||||
@@ -18,10 +18,13 @@ public class StoryPublicController {
|
||||
@Autowired
|
||||
private StoryItemService storyItemService;
|
||||
|
||||
@GetMapping("/{shareId}")
|
||||
public ResponseEntity<StoryItem> getStoryItemByShareId(@PathVariable String shareId) {
|
||||
log.info("根据 shareId 获取 StoryItem: {}", shareId);
|
||||
StoryItem storyItem = storyItemService.getItemByShareId(shareId);
|
||||
return ResponseEntity.success(storyItem);
|
||||
}
|
||||
/*
|
||||
* @GetMapping("/{shareId}")
|
||||
* public ResponseEntity<StoryItem> getStoryItemByShareId(@PathVariable String
|
||||
* shareId) {
|
||||
* log.info("根据 shareId 获取 StoryItem: {}", shareId);
|
||||
* StoryItem storyItem = storyItemService.getItemByShareId(shareId);
|
||||
* return ResponseEntity.success(storyItem);
|
||||
* }
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -28,9 +28,9 @@ public interface StoryItemMapper {
|
||||
|
||||
int countByStoryId(String storyInstanceId);
|
||||
|
||||
StoryItem selectByShareId(String shareId);
|
||||
// StoryItem selectByShareId(String shareId);
|
||||
|
||||
StoryItemShareVo selectByShareIdWithAuthor(String shareId);
|
||||
// StoryItemShareVo selectByShareIdWithAuthor(String shareId);
|
||||
|
||||
List<StoryItemVo> searchItems(@Param("keyword") String keyword);
|
||||
}
|
||||
|
||||
@@ -14,12 +14,8 @@ public class StoryItem {
|
||||
private String description;
|
||||
private String location;
|
||||
private LocalDateTime storyItemTime;
|
||||
private String type;
|
||||
private String status;
|
||||
private String cover;
|
||||
private String createId;
|
||||
private String updateId;
|
||||
private String shareId;
|
||||
private LocalDateTime createTime;
|
||||
private LocalDateTime updateTime;
|
||||
private Integer isDelete;
|
||||
|
||||
@@ -24,7 +24,7 @@ public interface StoryItemService {
|
||||
|
||||
Integer getStoryItemCount(String storyInstanceId);
|
||||
|
||||
StoryItemShareVo getItemByShareId(String shareId);
|
||||
// StoryItemShareVo getItemByShareId(String shareId);
|
||||
|
||||
Map<String, Object> searchItems(String keyword, Integer pageNum, Integer pageSize);
|
||||
}
|
||||
|
||||
@@ -94,10 +94,12 @@ public class StoryItemServiceImpl implements StoryItemService {
|
||||
return storyItemMapper.countByStoryId(storyInstanceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public StoryItemShareVo getItemByShareId(String shareId) {
|
||||
return storyItemMapper.selectByShareIdWithAuthor(shareId);
|
||||
}
|
||||
/*
|
||||
* @Override
|
||||
* public StoryItemShareVo getItemByShareId(String shareId) {
|
||||
* return storyItemMapper.selectByShareIdWithAuthor(shareId);
|
||||
* }
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Map<String, Object> searchItems(String keyword, Integer pageNum, Integer pageSize) {
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
<mapper namespace="com.timeline.story.dao.StoryItemMapper">
|
||||
|
||||
<insert id="insert">
|
||||
INSERT INTO story_item (instance_id, master_item_id, description, location, title, create_id, story_instance_id, is_delete, story_item_time, update_id, share_id, cover)
|
||||
VALUES (#{instanceId}, #{masterItemId}, #{description}, #{location}, #{title},#{createId}, #{storyInstanceId}, #{isDelete}, #{storyItemTime}, #{updateId}, #{shareId}, #{cover})
|
||||
INSERT INTO story_item (instance_id, master_item_id, description, location, title, create_id, story_instance_id, is_delete, story_item_time, update_id)
|
||||
VALUES (#{instanceId}, #{masterItemId}, #{description}, #{location}, #{title},#{createId}, #{storyInstanceId}, #{isDelete}, #{storyItemTime}, #{updateId})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
@@ -14,11 +14,9 @@
|
||||
SET description = #{description},
|
||||
location = #{location},
|
||||
title = #{title},
|
||||
cover = #{cover},
|
||||
create_id = #{createId},
|
||||
update_time = NOW(),
|
||||
update_id = #{updateId},
|
||||
share_id = #{shareId}
|
||||
update_id = #{updateId}
|
||||
WHERE instance_id = #{instanceId}
|
||||
</update>
|
||||
|
||||
@@ -48,10 +46,6 @@
|
||||
si.title,
|
||||
si.story_instance_id,
|
||||
si.master_item_id,
|
||||
si.share_id,
|
||||
si.cover,
|
||||
si.type,
|
||||
si.status,
|
||||
si.is_delete,
|
||||
si.story_item_time as story_item_time,
|
||||
si.create_id AS create_id,
|
||||
@@ -78,6 +72,7 @@
|
||||
SELECT COUNT(*) FROM story_item WHERE story_instance_id = #{storyInstanceId} AND is_delete = 0
|
||||
</select>
|
||||
|
||||
<!--
|
||||
<select id="selectByShareId" resultType="com.timeline.story.entity.StoryItem">
|
||||
SELECT * FROM story_item WHERE share_id = #{shareId} AND is_delete = 0
|
||||
</select>
|
||||
@@ -94,6 +89,7 @@
|
||||
WHERE
|
||||
si.share_id = #{shareId} AND si.is_delete = 0
|
||||
</select>
|
||||
-->
|
||||
|
||||
<select id="searchItems" resultType="com.timeline.story.vo.StoryItemVo">
|
||||
SELECT
|
||||
@@ -101,8 +97,7 @@
|
||||
si.story_instance_id,
|
||||
si.title,
|
||||
si.description,
|
||||
si.story_item_time,
|
||||
si.cover
|
||||
si.story_item_time
|
||||
FROM
|
||||
story_item si
|
||||
WHERE
|
||||
|
||||
Reference in New Issue
Block a user