package com.xjhs.findmemerchant.entity; import com.xjhs.findmemerchant.adapter.id.SnowflakeGenerated; import jakarta.persistence.*; import lombok.Getter; import lombok.Setter; import org.hibernate.annotations.Comment; /** * 商家对评价的回复 * 对应表:review_replies */ @Getter @Setter @Entity @Table( name = "review_replies", uniqueConstraints = { @UniqueConstraint(name = "uk_review_replies_review_id", columnNames = "review_id") }, indexes = { @Index(name = "idx_review_replies_merchant_id", columnList = "merchant_id") } ) public class ReviewReply{ /** * 主键(雪花ID) */ @Id @GeneratedValue @SnowflakeGenerated @Column(nullable = false) @Comment("主键ID") private Long id; /** * 评价ID(唯一,一个评价一条回复) */ @Column(name = "review_id", nullable = false) @Comment("评价ID") private Long reviewId; /** * 商户ID */ @Column(name = "merchant_id", nullable = false) @Comment("商户ID") private Long merchantId; /** * 回复内容 */ @Column(name = "content", nullable = false, columnDefinition = "text") @Comment("回复内容") private String content; /** * 回复人ID(商家或员工) */ @Column(name = "replier_id", nullable = false) @Comment("回复人ID(商家或员工)") private Long replierId; /** * 回复人名称 */ @Column(name = "replier_name", length = 50) @Comment("回复人名称") private String replierName; /** * 所属评价 */ @OneToOne(fetch = FetchType.LAZY) @JoinColumn(name = "review_id", insertable = false, updatable = false) private Review review; }