MomentComments.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. package com.zhentao.moment.domain;
  2. import com.baomidou.mybatisplus.annotation.IdType;
  3. import com.baomidou.mybatisplus.annotation.TableField;
  4. import com.baomidou.mybatisplus.annotation.TableId;
  5. import com.baomidou.mybatisplus.annotation.TableName;
  6. import java.io.Serializable;
  7. import java.util.Date;
  8. import com.fasterxml.jackson.annotation.JsonFormat;
  9. import lombok.Data;
  10. /**
  11. * 朋友圈评论表
  12. * @TableName moment_comments
  13. */
  14. @TableName(value ="moment_comments")
  15. @Data
  16. public class MomentComments implements Serializable {
  17. /**
  18. *
  19. */
  20. @TableId(type = IdType.AUTO)
  21. private Long commentId;
  22. /**
  23. * 动态ID
  24. */
  25. @JsonFormat(shape = JsonFormat.Shape.STRING)
  26. private Long momentId;
  27. /**
  28. * 评论用户ID
  29. */
  30. private Long userId;
  31. /**
  32. * 评论内容
  33. */
  34. private String content;
  35. /**
  36. * 回复的评论ID
  37. */
  38. private Long replyTo;
  39. /**
  40. * 回复的用户ID
  41. */
  42. private Long replyToUser;
  43. /**
  44. *
  45. */
  46. @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss")
  47. private Date createdAt;
  48. @TableField(exist = false)
  49. private static final long serialVersionUID = 1L;
  50. @Override
  51. public boolean equals(Object that) {
  52. if (this == that) {
  53. return true;
  54. }
  55. if (that == null) {
  56. return false;
  57. }
  58. if (getClass() != that.getClass()) {
  59. return false;
  60. }
  61. MomentComments other = (MomentComments) that;
  62. return (this.getCommentId() == null ? other.getCommentId() == null : this.getCommentId().equals(other.getCommentId()))
  63. && (this.getMomentId() == null ? other.getMomentId() == null : this.getMomentId().equals(other.getMomentId()))
  64. && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
  65. && (this.getContent() == null ? other.getContent() == null : this.getContent().equals(other.getContent()))
  66. && (this.getReplyTo() == null ? other.getReplyTo() == null : this.getReplyTo().equals(other.getReplyTo()))
  67. && (this.getReplyToUser() == null ? other.getReplyToUser() == null : this.getReplyToUser().equals(other.getReplyToUser()))
  68. && (this.getCreatedAt() == null ? other.getCreatedAt() == null : this.getCreatedAt().equals(other.getCreatedAt()));
  69. }
  70. @Override
  71. public int hashCode() {
  72. final int prime = 31;
  73. int result = 1;
  74. result = prime * result + ((getCommentId() == null) ? 0 : getCommentId().hashCode());
  75. result = prime * result + ((getMomentId() == null) ? 0 : getMomentId().hashCode());
  76. result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
  77. result = prime * result + ((getContent() == null) ? 0 : getContent().hashCode());
  78. result = prime * result + ((getReplyTo() == null) ? 0 : getReplyTo().hashCode());
  79. result = prime * result + ((getReplyToUser() == null) ? 0 : getReplyToUser().hashCode());
  80. result = prime * result + ((getCreatedAt() == null) ? 0 : getCreatedAt().hashCode());
  81. return result;
  82. }
  83. @Override
  84. public String toString() {
  85. StringBuilder sb = new StringBuilder();
  86. sb.append(getClass().getSimpleName());
  87. sb.append(" [");
  88. sb.append("Hash = ").append(hashCode());
  89. sb.append(", commentId=").append(commentId);
  90. sb.append(", momentId=").append(momentId);
  91. sb.append(", userId=").append(userId);
  92. sb.append(", content=").append(content);
  93. sb.append(", replyTo=").append(replyTo);
  94. sb.append(", replyToUser=").append(replyToUser);
  95. sb.append(", createdAt=").append(createdAt);
  96. sb.append(", serialVersionUID=").append(serialVersionUID);
  97. sb.append("]");
  98. return sb.toString();
  99. }
  100. }