Bladeren bron

--add queryCount();

zzy.zhiyuan.foxmail 8 jaren geleden
bovenliggende
commit
0b1e969dd8

+ 10 - 0
src/main/java/com/ekexiu/portal/dao/LeaveWordDao.java

@ -4,13 +4,17 @@ import java.sql.Connection;
4 4
import java.sql.SQLException;
5 5
import java.util.List;
6 6

7
import org.jfw.apt.annotation.DefaultValue;
8
import org.jfw.apt.orm.annotation.dao.Column;
7 9
import org.jfw.apt.orm.annotation.dao.DAO;
8 10
import org.jfw.apt.orm.annotation.dao.method.From;
9 11
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10 12
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11 13
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12 14
import org.jfw.apt.orm.annotation.dao.method.operator.LimitSelect;
15
import org.jfw.apt.orm.annotation.dao.method.operator.QueryVal;
13 16
import org.jfw.apt.orm.annotation.dao.param.LessThan;
17
import org.jfw.apt.orm.core.defaultImpl.IntHandler;
14 18

15 19
import com.ekexiu.portal.po.LeaveWord;
16 20

@ -18,6 +22,12 @@ import com.ekexiu.portal.po.LeaveWord;
18 22
public abstract class LeaveWordDao {
19 23
	@Insert
20 24
	public abstract int insert(Connection con,LeaveWord word) throws SQLException;
25
	
26
	@QueryVal
27
	@From(LeaveWord.class)
28
	@Column(handlerClass=IntHandler.class,value={"COUNT(1)"})
29
	@DefaultValue("0")
30
	public abstract int queryCount(Connection con,String articleId)throws SQLException;
21 31

22 32
	@LimitSelect
23 33
	@OrderBy("ORDER BY CREATE_TIME DESC,ORDER_KEY DESC")

+ 6 - 0
src/main/java/com/ekexiu/portal/service/LeaveWordService.java

@ -62,6 +62,12 @@ public class LeaveWordService {
62 62
		return id;
63 63
	}
64 64
	
65
	@Get
66
	@Path("/lwCount")
67
	public int queryCount(@JdbcConn Connection con,String articleId)throws SQLException{
68
		return this.leaveWordDao.queryCount(con, articleId);
69
	}
70
	
65 71
	@Get
66 72
	@Path("/ql")
67 73
	public List<LeaveWord> query(@JdbcConn Connection con,String articleId,@DefaultValue("com.ekexiu.portal.service.LeaveWordService.MAX_CREATETIME")  String createTime,@DefaultValue("Long.MAX_VALUE") long orderKey,@DefaultValue("10") int rows) throws SQLException{