jiapeng 7 years ago
parent
commit
d85ff91a05

+ 2 - 2
src/main/java/com/ekexiu/portal/question/QuestionDao.java

@ -89,8 +89,8 @@ public interface QuestionDao {
89 89
	@OrderBy("ORDER BY TIME_DESC DESC")
90 90
	List<Answer> byQes(Connection con, String qid, @LessThan String timeDesc, int rows) throws SQLException;
91 91
	@LimitQuery
92
	@OrderBy("ORDER BY SCORE_DESC ASC")
93
	List<SortedAnswwer> byQesScore(Connection con, String qid, @SqlColumn(handlerClass = StringHandler.class, value = { "(TO_CHAR((10000 * (AGREE+1)) / (BALLOT+1),'00009')||ID) < ?  " })  String score, int rows) throws SQLException;
92
	@OrderBy("ORDER BY SCORE_DESC DESC")
93
	List<SortedAnswwer> byQesScore(Connection con, String qid, @SqlColumn(handlerClass = StringHandler.class, value = { "(case when ballot=0 then '00000'  else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end  || ID) < ?  " })  String score, int rows) throws SQLException;
94 94

95 95
	@Insert
96 96
	int insert(Connection con,AnswerAgreeRec aar)throws SQLException;

+ 2 - 2
src/main/java/com/ekexiu/portal/question/SortedAnswwer.java

@ -11,7 +11,7 @@ public class SortedAnswwer extends Answer {
11 11
	private transient String scoreDesc;
12 12
	
13 13
	
14
	@CalcColumn(nullable=false,handlerClass=StringHandler.class,column="TO_CHAR((10000 *(AGREE + 1)) / (BALLOT + 1),'00009') || ID SCORE_DESC")
14
	@CalcColumn(nullable=false,handlerClass=StringHandler.class,column=" case when ballot=0 then '00000' else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end  || ID SCORE_DESC")
15 15
	public String getScoreDesc() {
16 16
		return scoreDesc;
17 17
	}
@ -20,7 +20,7 @@ public class SortedAnswwer extends Answer {
20 20
		this.scoreDesc = scoreDesc;
21 21
	}
22 22

23
	@CalcColumn(nullable=false,handlerClass=LongHandler.class,column="(10000 * (agree+1)) / (ballot+1) SCORE")
23
	@CalcColumn(nullable=false,handlerClass=LongHandler.class,column="case when ballot=0 then 0 else  10000 *AGREE / BALLOT end SCORE")
24 24
	public long getScore() {
25 25
		return score;
26 26
	}