Browse Source

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

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

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

10
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
10
import org.jfw.apt.orm.annotation.dao.method.OrderBy;
11
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
11
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
12
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
13
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
14
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
15
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
16
import org.jfw.util.PageQueryResult;
15

17

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

19

36
	@SelectOne
38
	@SelectOne
37
	public abstract Watch queryOne(Connection con, String professorId, String watchObject) throws SQLException;
39
	public abstract Watch queryOne(Connection con, String professorId, String watchObject) throws SQLException;
38
	
40
	
39
	@SelectList
41
	@PageSelect
40
	@OrderBy(" ORDER BY CREATE_TIME DESC ")
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
	@SelectList
46
	@SelectList
44
	@OrderBy(" ORDER BY CREATE_TIME DESC ")
47
	@OrderBy(" ORDER BY CREATE_TIME DESC ")

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

5
import java.util.List;
5
import java.util.List;
6

6

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

14

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