parent
51a3439939
commit
4bb495d8f9
@ -0,0 +1,72 @@ |
|||||||
|
package com.bupt.note.Model; |
||||||
|
|
||||||
|
import javax.persistence.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* 评价实体 |
||||||
|
*/ |
||||||
|
@Entity |
||||||
|
@Table(name = "sys_paper_rating") |
||||||
|
public class Rating { |
||||||
|
private Long id; |
||||||
|
private Integer score1; |
||||||
|
private Integer score2; |
||||||
|
private Integer score3; |
||||||
|
private Long paperId; |
||||||
|
private String userName; |
||||||
|
|
||||||
|
@Id |
||||||
|
@GeneratedValue(strategy = GenerationType.IDENTITY) |
||||||
|
public Long getId() { |
||||||
|
return id; |
||||||
|
} |
||||||
|
|
||||||
|
public void setId(Long id) { |
||||||
|
this.id = id; |
||||||
|
} |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
public Integer getScore1() { |
||||||
|
return score1; |
||||||
|
} |
||||||
|
|
||||||
|
public void setScore1(Integer score1) { |
||||||
|
this.score1 = score1; |
||||||
|
} |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
public Integer getScore2() { |
||||||
|
return score2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setScore2(Integer score2) { |
||||||
|
this.score2 = score2; |
||||||
|
} |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
public Integer getScore3() { |
||||||
|
return score3; |
||||||
|
} |
||||||
|
|
||||||
|
public void setScore3(Integer score3) { |
||||||
|
this.score3 = score3; |
||||||
|
} |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
public Long getPaperId() { |
||||||
|
return paperId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPaperId(Long paperId) { |
||||||
|
this.paperId = paperId; |
||||||
|
} |
||||||
|
|
||||||
|
@Column(nullable = false) |
||||||
|
public String getUserName() { |
||||||
|
return userName; |
||||||
|
} |
||||||
|
|
||||||
|
public void setUserName(String userName) { |
||||||
|
this.userName = userName; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,8 @@ |
|||||||
|
package com.bupt.note.Repository; |
||||||
|
|
||||||
|
import com.bupt.note.Model.Rating; |
||||||
|
import org.springframework.data.jpa.repository.JpaRepository; |
||||||
|
|
||||||
|
public interface RatingRepository extends JpaRepository<Rating, Long> { |
||||||
|
Rating findByPaperIdAndUserName(Long paperId, String userName); |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.bupt.note.dto; |
||||||
|
|
||||||
|
public class QueryRating { |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
public Long getPaperId() { |
||||||
|
return paperId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPaperId(Long paperId) { |
||||||
|
this.paperId = paperId; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package com.bupt.note.dto; |
||||||
|
|
||||||
|
import com.bupt.note.Model.Rating; |
||||||
|
|
||||||
|
public class RatingForm { |
||||||
|
private Integer score1; |
||||||
|
private Integer score2; |
||||||
|
private Integer score3; |
||||||
|
private Long paperId; |
||||||
|
|
||||||
|
public Integer getScore1() { |
||||||
|
return score1; |
||||||
|
} |
||||||
|
|
||||||
|
public void setScore1(Integer score1) { |
||||||
|
this.score1 = score1; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getScore2() { |
||||||
|
return score2; |
||||||
|
} |
||||||
|
|
||||||
|
public void setScore2(Integer score2) { |
||||||
|
this.score2 = score2; |
||||||
|
} |
||||||
|
|
||||||
|
public Integer getScore3() { |
||||||
|
return score3; |
||||||
|
} |
||||||
|
|
||||||
|
public void setScore3(Integer score3) { |
||||||
|
this.score3 = score3; |
||||||
|
} |
||||||
|
|
||||||
|
public Long getPaperId() { |
||||||
|
return paperId; |
||||||
|
} |
||||||
|
|
||||||
|
public void setPaperId(Long paperId) { |
||||||
|
this.paperId = paperId; |
||||||
|
} |
||||||
|
|
||||||
|
public Rating toRating(){ |
||||||
|
Rating rating=new Rating(); |
||||||
|
rating.setPaperId(this.paperId); |
||||||
|
rating.setScore1(this.score1); |
||||||
|
rating.setScore2(this.score2); |
||||||
|
rating.setScore3(this.score3); |
||||||
|
return rating; |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue