我有以下pojo
public class Like {
private Long commentId;
private Collection<Long> accountIds;
}
public class Comment {
private Long personId;
private Long pageId;
private Long Id;
private String text;
private Like like;
private LocalDate commentDate;
}
public class Page {
private Long Id;
private Long textId;
private Collection<Comment> comments;
private LocalTime postingDate;
private ViewType type;
private String mediaUrl;
private Collection<Long> openAccountIds;
private Like like;
}
public class Text{
private Long accountId;
private Long Id;
private String name;
private LocalTime firstPostedTime;
private LocalTime lastPostedTime;
private ViewType type;
private Collection<Page> pages;
private Like like;
private String description;
private Collection<Long> openAccountIds;
}
现在我的文本存储库如下:
public interface TextRepository {
Collection<Text> getAllTexts(Long accountId);
Diary getText(Long TextId);
Page getPage(Long pageId);
Comment getComment(Long commentId);
void addPageToText(Long TextId , Page page);
void addCommentToPage(Long pageId , Comment comment);
void updateText(Text text);
void deletePage(Long pageId);
void deleteComment(Long commentId);
void updateLikeToText(Long textIds);
void updateLikeToPage(Long pageId);
void updateLikeToComment(Long commentId);
}
我是mysql的新手。我想知道如何有效地创建 mysql 表,以便我可以在更短的时间内检索数据。此外,如果我的 pojo 包含任何结构缺陷,请继续更改它们或提供建议。