Entity实体类:
@Entity //实体类注解
@Data
@Table(name = "AA") //表注解
@IdClass(value = AaId.class) //联合主键注解
public class Aa implements Serializable {
@Id
@Column(name = "aa_id")
@ApiModelProperty(value = "aa_id")
private Integer aaId;
@Id
@Column(name = "aa1_id")
@ApiModelProperty(value = "aa1_id")
private Integer aa1Id;
}
ID类
@Embeddable
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class AaId implements Serializable {
@Column(name = "aa_id")
private Integer aaId;
@Column(name = "aa1_id")
private Integer aa1Id;