Browse Source

--update queryOne().

zzy.zhiyuan.foxmail 8 years ago
parent
commit
b2efd3e0a9
1 changed files with 23 additions and 0 deletions
  1. 23 0
      src/main/java/com/ekexiu/portal/service/ArticleService.java

+ 23 - 0
src/main/java/com/ekexiu/portal/service/ArticleService.java

@ -25,6 +25,7 @@ import org.jfw.util.io.IoUtil;
25 25

26 26
import com.ekexiu.portal.dao.ArticleDao;
27 27
import com.ekexiu.portal.dao.ProfessorDao;
28
import com.ekexiu.portal.dao.ResearchAreaDao;
28 29
import com.ekexiu.portal.dao.ResourceDao;
29 30
import com.ekexiu.portal.po.Article;
30 31
import com.ekexiu.portal.pojo.EditProfessor;
@ -42,6 +43,10 @@ public class ArticleService {
42 43
	private ProfessorDao professorDao;
43 44
	@Autowrie
44 45
	private ResourceDao resourceDao;
46
	@Autowrie
47
	private ImageService imageService;
48
	@Autowrie
49
	private ResearchAreaDao researchAreaDao;
45 50

46 51
	public String getDateFormat() {
47 52
		return dateFormat;
@ -99,6 +104,22 @@ public class ArticleService {
99 104
		this.resourceDao = resourceDao;
100 105
	}
101 106

107
	public ImageService getImageService() {
108
		return imageService;
109
	}
110

111
	public void setImageService(ImageService imageService) {
112
		this.imageService = imageService;
113
	}
114

115
	public ResearchAreaDao getResearchAreaDao() {
116
		return researchAreaDao;
117
	}
118

119
	public void setResearchAreaDao(ResearchAreaDao researchAreaDao) {
120
		this.researchAreaDao = researchAreaDao;
121
	}
122

102 123
	private byte[] resImage(byte[] src, int maxLen) throws IOException {
103 124
		ByteArrayInputStream in = new ByteArrayInputStream(src);
104 125
		ByteArrayOutputStream out = new ByteArrayOutputStream();
@ -179,6 +200,8 @@ public class ArticleService {
179 200
		if(article != null){
180 201
			EditProfessor professor = this.professorDao.queryBaseInfo(con, article.getProfessorId());
181 202
			if(professor != null){
203
				professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
204
				professor.setResearchAreas(this.researchAreaDao.query(con, professor.getId()));
182 205
				professor.setResources(this.resourceDao.queryPro(con, professor.getId()));
183 206
			}
184 207
			article.setProfessor(professor);