浏览代码

--add queryCount();

zzy.zhiyuan.foxmail 8 年之前
父节点
当前提交
0b1e969dd8

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

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

6

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

18

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

20

18
public abstract class LeaveWordDao {
22
public abstract class LeaveWordDao {
19
	@Insert
23
	@Insert
20
	public abstract int insert(Connection con,LeaveWord word) throws SQLException;
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
	@LimitSelect
32
	@LimitSelect
23
	@OrderBy("ORDER BY CREATE_TIME DESC,ORDER_KEY DESC")
33
	@OrderBy("ORDER BY CREATE_TIME DESC,ORDER_KEY DESC")

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

62
		return id;
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
	@Get
71
	@Get
66
	@Path("/ql")
72
	@Path("/ql")
67
	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{
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{