Browse Source

--update query().

zzy.zhiyuan.foxmail 8 years ago
parent
commit
ba8a683833

+ 10 - 0
src/main/java/com/ekexiu/portal/po/LeaveWord.java

@ -1,11 +1,14 @@
1 1
package com.ekexiu.portal.po;
2 2

3
import java.util.List;
4

3 5
import org.jfw.apt.orm.annotation.entry.Column;
4 6
import org.jfw.apt.orm.annotation.entry.PrimaryKey;
5 7
import org.jfw.apt.orm.annotation.entry.Table;
6 8
import org.jfw.apt.orm.core.enums.DE;
7 9

8 10
import com.ekexiu.portal.basepo.CreateTimeSupported;
11
import com.ekexiu.portal.pojo.EditProfessor;
9 12

10 13
@PrimaryKey("id")
11 14
@Table
@ -16,7 +19,14 @@ public class LeaveWord implements CreateTimeSupported {
16 19
	private String articleId;
17 20
	private String createTime;
18 21
	private long orderKey;
22
	private EditProfessor professor ;
19 23
	
24
	public EditProfessor getProfessor() {
25
		return professor;
26
	}
27
	public void setProfessor(EditProfessor professor) {
28
		this.professor = professor;
29
	}
20 30
	@Column(DE.id_32)
21 31
	public String getId() {
22 32
		return id;

+ 31 - 1
src/main/java/com/ekexiu/portal/service/LeaveWordService.java

@ -13,7 +13,9 @@ import org.jfw.apt.web.annotation.param.JdbcConn;
13 13
import org.jfw.util.StringUtil;
14 14

15 15
import com.ekexiu.portal.dao.LeaveWordDao;
16
import com.ekexiu.portal.dao.ProfessorDao;
16 17
import com.ekexiu.portal.po.LeaveWord;
18
import com.ekexiu.portal.pojo.EditProfessor;
17 19

18 20
@Path("/leaveWord")
19 21
public class LeaveWordService {
@ -21,6 +23,10 @@ public class LeaveWordService {
21 23

22 24
	@Autowrie
23 25
	private LeaveWordDao leaveWordDao;
26
	@Autowrie
27
	private ProfessorDao professorDao;
28
	@Autowrie
29
	private ImageService imageService;
24 30

25 31
	public LeaveWordDao getLeaveWordDao() {
26 32
		return leaveWordDao;
@ -30,6 +36,22 @@ public class LeaveWordService {
30 36
		this.leaveWordDao = leaveWordDao;
31 37
	}
32 38
	
39
	public ProfessorDao getProfessorDao() {
40
		return professorDao;
41
	}
42

43
	public void setProfessorDao(ProfessorDao professorDao) {
44
		this.professorDao = professorDao;
45
	}
46

47
	public ImageService getImageService() {
48
		return imageService;
49
	}
50

51
	public void setImageService(ImageService imageService) {
52
		this.imageService = imageService;
53
	}
54

33 55
	@Post
34 56
	@Path
35 57
	public String insert(@JdbcConn(true) Connection con,LeaveWord word) throws SQLException{
@ -43,6 +65,14 @@ public class LeaveWordService {
43 65
	@Get
44 66
	@Path("/ql")
45 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{
46
		return this.leaveWordDao.query(con, articleId, createTime, orderKey, rows);
68
		List<LeaveWord> leaveWords = this.leaveWordDao.query(con, articleId, createTime, orderKey, rows);
69
		if(!leaveWords.isEmpty()){
70
			for (LeaveWord leaveWord : leaveWords) {
71
				EditProfessor professor = this.professorDao.queryBaseInfo(con, leaveWord.getSender());
72
				professor.setHasHeadImage(this.imageService.hasProfessorImage(leaveWord.getSender()));
73
				leaveWord.setProfessor(professor);
74
			}
75
		}
76
		return leaveWords;
47 77
	}
48 78
}