XMTT vor 7 Jahren
Ursprung
Commit
fed5165195

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

1
package com.ekexiu.portal.question;
1
package com.ekexiu.portal.question;
2

2

3
import java.sql.Connection;
4
import java.sql.SQLException;
5
import java.util.List;
6

7
import org.jfw.apt.annotation.DefaultValue;
3
import org.jfw.apt.annotation.DefaultValue;
8
import org.jfw.apt.annotation.Nullable;
4
import org.jfw.apt.annotation.Nullable;
9
import org.jfw.apt.orm.annotation.dao.Batch;
5
import org.jfw.apt.orm.annotation.dao.Batch;
29
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
25
import org.jfw.apt.orm.core.defaultImpl.LongHandler;
30
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
26
import org.jfw.apt.orm.core.defaultImpl.StringHandler;
31

27

28
import java.sql.Connection;
29
import java.sql.SQLException;
30
import java.util.List;
31

32

32

33
@DAO
33
@DAO
34
public interface QuestionDao {
34
public interface QuestionDao {
134
	@LimitQuery
134
	@LimitQuery
135
	@OrderBy("ORDER BY SCORE_DESC DESC")
135
	@OrderBy("ORDER BY SCORE_DESC DESC")
136
	@Where("STATE='1'")
136
	@Where("STATE='1'")
137
	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;
137
	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 || TO_CHAR(AGREE,'00000000000000000009') || ID) < ?  " })  String score, int rows) throws SQLException;
138

138

139
	@Insert
139
	@Insert
140
	int insert(Connection con,AnswerAgreeRec aar)throws SQLException;
140
	int insert(Connection con,AnswerAgreeRec aar)throws SQLException;

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

1
package com.ekexiu.portal.question;
1
package com.ekexiu.portal.question;
2

2

3
import java.io.ByteArrayInputStream;
4
import java.io.File;
5
import java.io.FileInputStream;
6
import java.io.FileOutputStream;
7
import java.io.IOException;
8
import java.io.InputStream;
9
import java.io.OutputStream;
10
import java.sql.Connection;
11
import java.sql.PreparedStatement;
12
import java.sql.SQLException;
13
import java.util.ArrayList;
14
import java.util.LinkedList;
15
import java.util.List;
16
import java.util.Map;
17
import java.util.concurrent.atomic.AtomicInteger;
18

3
import com.ekexiu.portal.notify.NotifyService;
4
import com.ekexiu.portal.notify.NotifyType;
5
import com.ekexiu.portal.util.SqlUtil;
19
import org.jfw.apt.annotation.Autowrie;
6
import org.jfw.apt.annotation.Autowrie;
20
import org.jfw.apt.annotation.DefaultValue;
7
import org.jfw.apt.annotation.DefaultValue;
21
import org.jfw.apt.annotation.Nullable;
8
import org.jfw.apt.annotation.Nullable;
38
import org.jfw.util.web.fileupload.Item;
25
import org.jfw.util.web.fileupload.Item;
39
import org.jfw.util.web.fileupload.UploadItemIterator;
26
import org.jfw.util.web.fileupload.UploadItemIterator;
40

27

41
import com.ekexiu.portal.notify.NotifyService;
42
import com.ekexiu.portal.notify.NotifyType;
43
import com.ekexiu.portal.util.SqlUtil;
28
import java.io.ByteArrayInputStream;
29
import java.io.File;
30
import java.io.FileInputStream;
31
import java.io.FileOutputStream;
32
import java.io.IOException;
33
import java.io.InputStream;
34
import java.io.OutputStream;
35
import java.sql.Connection;
36
import java.sql.PreparedStatement;
37
import java.sql.SQLException;
38
import java.util.ArrayList;
39
import java.util.LinkedList;
40
import java.util.List;
41
import java.util.Map;
42
import java.util.concurrent.atomic.AtomicInteger;
44

43

45
@Path("/question")
44
@Path("/question")
46
public class Service {
45
public class Service {
573
	 */
572
	 */
574
	@Get
573
	@Get
575
	@Path("/answer/qes/byScore")
574
	@Path("/answer/qes/byScore")
576
	public List<SortedAnswwer> byQes(@JdbcConn Connection con, String qid, @DefaultValue("99999") int score, @DefaultValue("\"Z\"") String id,
575
	public List<SortedAnswwer> byQes(@JdbcConn Connection con, String qid, @DefaultValue("99999") int score, @DefaultValue("\"Z\"") String id,@DefaultValue("0") long agree,
577
			@DefaultValue("10000000") int rows) throws SQLException {
576
			@DefaultValue("10000000") int rows) throws SQLException {
578
		String p = "000000" + score;
577
		String p = "000000" + score;
579
		p = p.substring(p.length() - 5) + id;
578
		String a = "00000000000000000000"+agree;
579
		p = p.substring(p.length() - 5) + a.substring(a.length()-20) + id;
580
		return questionDao.byQesScore(con, qid, p, rows);
580
		return questionDao.byQesScore(con, qid, p, rows);
581
	}
581
	}
582

582


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

11
	private transient String scoreDesc;
11
	private transient String scoreDesc;
12
	
12
	
13
	
13
	
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")
14
	@CalcColumn(nullable=false,handlerClass=StringHandler.class,column=" case when ballot=0 then '00000' else  TO_CHAR(10000 *AGREE / BALLOT,'00009') end ||  TO_CHAR(AGREE,'00000000000000000009') || ID SCORE_DESC")
15
	public String getScoreDesc() {
15
	public String getScoreDesc() {
16
		return scoreDesc;
16
		return scoreDesc;
17
	}
17
	}