Browse Source

我的关注专家列表和资源列表改成分页列表。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
644c3ec875

+ 5 - 2
src/main/java/com/ekexiu/portal/dao/WatchDao.java

@ -10,8 +10,10 @@ import org.jfw.apt.orm.annotation.dao.method.From;
10 10
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
11 11
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12 12
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
13 14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14 15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
16
import org.jfw.util.PageQueryResult;
15 17

16 18
import com.ekexiu.portal.po.Watch;
17 19

@ -36,9 +38,10 @@ public abstract class WatchDao {
36 38
	@SelectOne
37 39
	public abstract Watch queryOne(Connection con, String professorId, String watchObject) throws SQLException;
38 40
	
39
	@SelectList
41
	@PageSelect
40 42
	@OrderBy(" ORDER BY CREATE_TIME DESC ")
41
	public abstract List<Watch> queryPro(Connection con, String professorId, Integer watchType) throws SQLException;
43
	public abstract PageQueryResult<Watch> queryPro(Connection con, String professorId, 
44
			Integer watchType, int pageSize, int pageNo) throws SQLException;
42 45
	
43 46
	@SelectList
44 47
	@OrderBy(" ORDER BY CREATE_TIME DESC ")

+ 8 - 5
src/main/java/com/ekexiu/portal/service/WatchService.java

@ -5,11 +5,12 @@ import java.sql.SQLException;
5 5
import java.util.List;
6 6

7 7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.DefaultValue;
8 9
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Delete;
10 10
import org.jfw.apt.web.annotation.operate.Get;
11 11
import org.jfw.apt.web.annotation.operate.Post;
12 12
import org.jfw.apt.web.annotation.param.JdbcConn;
13
import org.jfw.util.PageQueryResult;
13 14

14 15
import com.ekexiu.portal.dao.ProfessorDao;
15 16
import com.ekexiu.portal.dao.ResearchAreaDao;
@ -70,7 +71,7 @@ public class WatchService {
70 71
		return watch.getWatchObject();
71 72
	}
72 73
	
73
	@Delete
74
	@Post
74 75
	@Path("/delete")
75 76
	public void delete(@JdbcConn(true) Connection con, String professorId, String watchObject) throws SQLException{
76 77
		this.watchDao.delete(con, professorId, watchObject);
@ -84,8 +85,10 @@ public class WatchService {
84 85
	
85 86
	@Get
86 87
	@Path("/qaPro")
87
	public List<Watch> queryPro(@JdbcConn Connection con, String professorId, Integer watchType) throws SQLException{
88
		List<Watch> watchs = this.watchDao.queryPro(con, professorId, watchType);
88
	public PageQueryResult<Watch> queryPro(@JdbcConn Connection con, String professorId, Integer watchType, 
89
			@DefaultValue("10") int pageSize, @DefaultValue("1") int pageNo) throws SQLException {
90
		PageQueryResult<Watch> queryResult = this.watchDao.queryPro(con, professorId, watchType, pageSize, pageNo);
91
		List<Watch> watchs = queryResult.getData();
89 92
		if(1 == watchType){
90 93
			for (Watch watch : watchs) {
91 94
				EditProfessor professor = this.professorDao.queryBaseInfo(con, watch.getWatchObject());
@ -101,7 +104,7 @@ public class WatchService {
101 104
				watch.setResource(resource);
102 105
			}
103 106
		}
104
		return watchs;
107
		return queryResult;
105 108
	}
106 109
	
107 110
	@Get