我想在 Spring Boot java 应用程序中创建 restcontroller findbyProductIdandYear,但出现错误,如何以很好的方式实现它?
这是我的模型:
@Entity
@Table(name="view_disbursement_by_project")
public class ViewDisbursement {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name="id")
private int id;
@Column(name="project_id")
private String projectId;
@Column(name="stage")
private String stage;
@Column(name="no")
private Integer no;
@Column(name="months")
private Integer months;
@Column(name="years")
private Integer years;
@Column(name="count")
private Integer count;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getProject_id() {
return projectId;
}
public void setProject_id(String project_id) {
this.projectId = project_id;
}
public String getStage() {
return stage;
}
public void setStage(String stage) {
this.stage = stage;
}
public Integer getNo() {
return no;
}
public void setNo(Integer no) {
this.no = no;
}
public String getProjectId() {
return projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
public Integer getMonths() {
return months;
}
public void setMonths(Integer months) {
this.months = months;
}
public Integer getYears() {
return years;
}
public void setYears(Integer years) {
this.years = years;
}
public Integer getCount() {
return count;
}
public void setCount(Integer count) {
this.count = count;
}
}
这是我的存储库:
@Repository
public interface ViewDisbursementRepository extends
JpaRepository<ViewDisbursement, Integer> {
List<ViewDisbursement> findByProjectIdandYear(String projectId,
Integer years);
}
元芳怎么了
慕莱坞森
相关分类