Bladeren bron

--add queryCaption().查询研究方向点赞的专家列表

zzy.zhiyuan.foxmail 8 jaren geleden
bovenliggende
commit
446d0b3ad4

+ 27 - 0
src/main/java/com/ekexiu/portal/dao/ResearchAreaLogDao.java

@ -32,6 +32,33 @@ public abstract class ResearchAreaLogDao {
32 32
	@From(ResearchAreaLog.class)
33 33
	public abstract int delete(Connection con,String professorId)throws SQLException;
34 34
	
35
	public List<EditResearchAreaLog> queryCaption(Connection con,String professorId,String caption) throws SQLException{
36
        int _m_1 = 1;
37
        String sql = "SELECT OPRETE_PROFESSOR_ID,CREATE_TIME,PROFESSOR_ID,CAPTION FROM RESEARCH_AREA_LOG WHERE CAPTION = ? AND PROFESSOR_ID = ?";
38
        PreparedStatement ps = con.prepareStatement(sql);
39
        try{
40
            ps.setString(_m_1++,caption);
41
            ps.setString(_m_1++,professorId);
42
            ResultSet rs = ps.executeQuery();
43
            try{
44
                List<EditResearchAreaLog> _result = new ArrayList<EditResearchAreaLog>();
45
                while(rs.next()){
46
                	EditResearchAreaLog _obj =  new EditResearchAreaLog();
47
                    _obj.setOpreteProfessorId(rs.getString(1));
48
                    _obj.setCreateTime(rs.getString(2));
49
                    _obj.setProfessorId(rs.getString(3));
50
                    _obj.setCaption(rs.getString(4));
51
                    _result.add(_obj);
52
                }
53
                return _result;
54
            }finally{
55
                try{rs.close();}catch(Exception _m_2){}
56
            }
57
        }finally{
58
            try{ps.close();}catch(Exception _m_3){}
59
        }
60
    }
61
	
35 62
	public List<EditResearchAreaLog> query(Connection con,String professorId) throws SQLException{
36 63
        int _m_1 = 1;
37 64
        String sql = "SELECT OPRETE_PROFESSOR_ID,CREATE_TIME,PROFESSOR_ID,CAPTION FROM RESEARCH_AREA_LOG WHERE PROFESSOR_ID = ?";

+ 9 - 0
src/main/java/com/ekexiu/portal/pojo/EditResearchAreaLog.java

@ -4,6 +4,7 @@ import com.ekexiu.portal.po.ResearchAreaLog;
4 4

5 5
public class EditResearchAreaLog extends ResearchAreaLog {
6 6
	private Integer hasHeadImage;
7
	private EditProfessor professor;
7 8

8 9
	public Integer getHasHeadImage() {
9 10
		return hasHeadImage;
@ -12,5 +13,13 @@ public class EditResearchAreaLog extends ResearchAreaLog {
12 13
	public void setHasHeadImage(Integer hasHeadImage) {
13 14
		this.hasHeadImage = hasHeadImage;
14 15
	}
16

17
	public EditProfessor getProfessor() {
18
		return professor;
19
	}
20

21
	public void setProfessor(EditProfessor professor) {
22
		this.professor = professor;
23
	}
15 24
	
16 25
}

+ 63 - 0
src/main/java/com/ekexiu/portal/service/ResearchAreaLogService.java

@ -0,0 +1,63 @@
1
package com.ekexiu.portal.service;
2

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

7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.web.annotation.Path;
9
import org.jfw.apt.web.annotation.operate.Get;
10
import org.jfw.apt.web.annotation.param.JdbcConn;
11

12
import com.ekexiu.portal.dao.ProfessorDao;
13
import com.ekexiu.portal.dao.ResearchAreaLogDao;
14
import com.ekexiu.portal.pojo.EditProfessor;
15
import com.ekexiu.portal.pojo.EditResearchAreaLog;
16

17
@Path("/researchAreaLog")
18
public class ResearchAreaLogService {
19
	@Autowrie
20
	private ResearchAreaLogDao researchAreaLogDao;
21
	@Autowrie
22
	private ProfessorDao professorDao;
23
	@Autowrie
24
	private ImageService imageService;
25
	
26
	public ResearchAreaLogDao getResearchAreaLogDao() {
27
		return researchAreaLogDao;
28
	}
29

30
	public void setResearchAreaLogDao(ResearchAreaLogDao researchAreaLogDao) {
31
		this.researchAreaLogDao = researchAreaLogDao;
32
	}
33

34
	public ProfessorDao getProfessorDao() {
35
		return professorDao;
36
	}
37

38
	public void setProfessorDao(ProfessorDao professorDao) {
39
		this.professorDao = professorDao;
40
	}
41

42
	public ImageService getImageService() {
43
		return imageService;
44
	}
45

46
	public void setImageService(ImageService imageService) {
47
		this.imageService = imageService;
48
	}
49

50
	@Get
51
	@Path("/agreeList")
52
	public List<EditResearchAreaLog> queryCaption(@JdbcConn Connection con, String professorId, String caption) throws SQLException{
53
		List<EditResearchAreaLog> areaLogs = this.researchAreaLogDao.queryCaption(con, professorId, caption);
54
		if(!areaLogs.isEmpty()){
55
			for (EditResearchAreaLog areaLog : areaLogs) {
56
				EditProfessor professor = this.professorDao.queryBaseInfo(con, areaLog.getOpreteProfessorId());
57
				professor.setHasHeadImage(this.imageService.hasProfessorImage(professor.getId()));
58
				areaLog.setProfessor(professor);
59
			}
60
		}
61
		return areaLogs;
62
	}
63
}