我有以下已定义的域类。
贷款类
@Data
@Entity
public class Loan {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String loanTitle;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "loan_id")
private List<Allowance> allowances;
}
津贴类
@Data
@Entity
public class Allowance {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@ManyToOne
private AllowanceType allowanceType;
private Double allowanceAmount;
}
我还为贷款类定义了一个投影接口,如下所示:
@Projection(name = "studyLoanSingle", types = {Loan.class})
public interface LoanProjection {
String getLoanTitle();
List<AllowanceProjection> getAllowances();
}
现在我想在预测中包含贷款的总金额(通过对津贴列表进行迭代计算)并将其发送到UI。在Spring Data REST中是否可能实现此操作?
@Value
。 - chrylis -cautiouslyoptimistic-@Value
注释中的括号里应该填什么? - Charlie