jiapeng 7 years ago
parent
commit
10ba40549e

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

@ -42,6 +42,12 @@ public interface QuestionDao {
42 42
	@SetSentence("REPLY_COUNT=REPLY_COUNT+1")
43 43
	int incQuestionReply(Connection con,String id)throws SQLException;
44 44
	
45
	@UpdateWith
46
	@From(Question.class)
47
	@SetSentence("REPLY_COUNT=REPLY_COUNT-1")
48
	@Where("REPLY_COUNT >0")
49
	int deccQuestionReply(Connection con,String id)throws SQLException;
50
	
45 51
	@UpdateWith
46 52
	@From(Question.class)
47 53
	@SetSentence("PAGE_VIEWS=PAGE_VIEWS+1")
@ -104,10 +110,12 @@ public interface QuestionDao {
104 110
			@LessThan String timeDesc, int rows) throws SQLException;
105 111

106 112
	@LimitSelect
113
	@Where("STATE='1'")
107 114
	@OrderBy("ORDER BY TIME_DESC DESC")
108 115
	List<Answer> byQes(Connection con, String qid, @LessThan String timeDesc, int rows) throws SQLException;
109 116
	@LimitQuery
110 117
	@OrderBy("ORDER BY SCORE_DESC DESC")
118
	@Where("STATE='1'")
111 119
	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;
112 120

113 121
	@Insert

+ 5 - 1
src/main/java/com/ekexiu/portal/question/Service.java

@ -578,7 +578,11 @@ public class Service {
578 578
	@Get
579 579
	@Path("/answer/delete")
580 580
	public int logicDelete(@JdbcConn(true) Connection con, String id) throws SQLException {
581
		return questionDao.logicDeleteAnswer(con, id);
581
		if(questionDao.logicDeleteAnswer(con, id)>0){
582
			questionDao.deccQuestionReply(con, id);
583
			return 1;
584
		}
585
		return 0;
582 586
	}
583 587

584 588
	@Post