Browse Source

专家详细信息页返回值增加是否存在研究方向点赞的专家头像。

zzy.zhiyuan.foxmail 8 years ago
parent
commit
0f6795ece7

+ 34 - 8
src/main/java/com/ekexiu/portal/dao/ResearchAreaLogDao.java

1
package com.ekexiu.portal.dao;
1
package com.ekexiu.portal.dao;
2
2
3
import java.sql.Connection;
3
import java.sql.Connection;
4
import java.sql.PreparedStatement;
5
import java.sql.ResultSet;
4
import java.sql.SQLException;
6
import java.sql.SQLException;
7
import java.util.ArrayList;
5
import java.util.List;
8
import java.util.List;
6
9
7
import org.jfw.apt.orm.annotation.dao.DAO;
10
import org.jfw.apt.orm.annotation.dao.DAO;
8
import org.jfw.apt.orm.annotation.dao.method.From;
11
import org.jfw.apt.orm.annotation.dao.method.From;
9
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
12
import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
10
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
13
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
11
import org.jfw.apt.orm.annotation.dao.method.operator.SelectList;
12
14
13
import com.ekexiu.portal.po.ResearchAreaLog;
15
import com.ekexiu.portal.po.ResearchAreaLog;
16
import com.ekexiu.portal.pojo.EditResearchAreaLog;
14
17
15
@DAO
18
@DAO
16
public interface ResearchAreaLogDao {
19
public abstract class ResearchAreaLogDao {
17
	
20
	
18
	@Insert
21
	@Insert
19
	int insert(Connection con,ResearchAreaLog log) throws SQLException;
22
	public abstract int insert(Connection con,ResearchAreaLog log) throws SQLException;
20
	
23
	
21
	@DeleteWith
24
	@DeleteWith
22
	@From(ResearchAreaLog.class)
25
	@From(ResearchAreaLog.class)
23
	int delete(Connection con,String professorId,String opreteProfessorId,String caption)throws SQLException;
26
	public abstract int delete(Connection con,String professorId,String opreteProfessorId,String caption)throws SQLException;
24
	
27
	
25
	@DeleteWith
28
	@DeleteWith
26
	@From(ResearchAreaLog.class)
29
	@From(ResearchAreaLog.class)
27
	int delete(Connection con,String professorId,String caption)throws SQLException;
30
	public abstract int delete(Connection con,String professorId,String caption)throws SQLException;
28
	@DeleteWith
31
	@DeleteWith
29
	@From(ResearchAreaLog.class)
32
	@From(ResearchAreaLog.class)
30
	int delete(Connection con,String professorId)throws SQLException;
33
	public abstract int delete(Connection con,String professorId)throws SQLException;
31
	
34
	
32
	@SelectList
33
	List<ResearchAreaLog> query(Connection con,String professorId)throws SQLException;
35
	public List<EditResearchAreaLog> query(Connection con,String professorId) throws SQLException{
36
        int _m_1 = 1;
37
        String sql = "SELECT OPRETE_PROFESSOR_ID,CREATE_TIME,PROFESSOR_ID,CAPTION FROM RESEARCH_AREA_LOG WHERE PROFESSOR_ID = ?";
38
        PreparedStatement ps = con.prepareStatement(sql);
39
        try{
40
            ps.setString(_m_1++,professorId);
41
            ResultSet rs = ps.executeQuery();
42
            try{
43
                List<EditResearchAreaLog> _result = new ArrayList<EditResearchAreaLog>();
44
                while(rs.next()){
45
                	EditResearchAreaLog log =  new EditResearchAreaLog();
46
                	log.setOpreteProfessorId(rs.getString(1));
47
                	log.setCreateTime(rs.getString(2));
48
                	log.setProfessorId(rs.getString(3));
49
                	log.setCaption(rs.getString(4));
50
                    _result.add(log);
51
                }
52
                return _result;
53
            }finally{
54
                try{rs.close();}catch(Exception _m_2){}
55
            }
56
        }finally{
57
            try{ps.close();}catch(Exception _m_3){}
58
        }
59
    }
34
60
35
}
61
}

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

1
package com.ekexiu.portal.pojo;
2

3
import com.ekexiu.portal.po.ResearchAreaLog;
4

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

8
	public Integer getHasHeadImage() {
9
		return hasHeadImage;
10
	}
11

12
	public void setHasHeadImage(Integer hasHeadImage) {
13
		this.hasHeadImage = hasHeadImage;
14
	}
15
	
16
}

+ 6 - 6
src/main/java/com/ekexiu/portal/pojo/ProfessorInfo.java

10
import com.ekexiu.portal.po.ProfessorEduBg;
10
import com.ekexiu.portal.po.ProfessorEduBg;
11
import com.ekexiu.portal.po.Project;
11
import com.ekexiu.portal.po.Project;
12
import com.ekexiu.portal.po.ResearchArea;
12
import com.ekexiu.portal.po.ResearchArea;
13
import com.ekexiu.portal.po.ResearchAreaLog;
14
13
15
public class ProfessorInfo extends Professor{
14
public class ProfessorInfo extends Professor{
16
	
15
	
20
	 * 研究方向
19
	 * 研究方向
21
	 */
20
	 */
22
	private List<ResearchArea> researchAreas;
21
	private List<ResearchArea> researchAreas;
23
	private List<ResearchAreaLog> researchAreaLogs;
22
	private List<EditResearchAreaLog> editResearchAreaLogs;
24
	/**
23
	/**
25
	 * 教育背景
24
	 * 教育背景
26
	 */
25
	 */
58
	public void setHasHeadImage(Integer hasHeadImage) {
57
	public void setHasHeadImage(Integer hasHeadImage) {
59
		this.hasHeadImage = hasHeadImage;
58
		this.hasHeadImage = hasHeadImage;
60
	}
59
	}
61
	public List<ResearchAreaLog> getResearchAreaLogs() {
62
		return researchAreaLogs;
60
	public List<EditResearchAreaLog> getEditResearchAreaLogs() {
61
		return editResearchAreaLogs;
63
	}
62
	}
64
	public void setogs(List<ResearchAreaLog> researchAreaLogs) {
65
		this.researchAreaLogs = researchAreaLogs;
63
	public void setEditogs(
64
			List<EditResearchAreaLog> editResearchAreaLogs) {
65
		this.editResearchAreaLogs = editResearchAreaLogs;
66
	}
66
	}
67
	public List<ResearchArea> getResearchAreas() {
67
	public List<ResearchArea> getResearchAreas() {
68
		return researchAreas;
68
		return researchAreas;

+ 8 - 1
src/main/java/com/ekexiu/portal/service/ProfessorService.java

35
import com.ekexiu.portal.dao.WatchDao;
35
import com.ekexiu.portal.dao.WatchDao;
36
import com.ekexiu.portal.po.Professor;
36
import com.ekexiu.portal.po.Professor;
37
import com.ekexiu.portal.pojo.EditProfessor;
37
import com.ekexiu.portal.pojo.EditProfessor;
38
import com.ekexiu.portal.pojo.EditResearchAreaLog;
38
import com.ekexiu.portal.pojo.ProfessorInfo;
39
import com.ekexiu.portal.pojo.ProfessorInfo;
39
import com.ekexiu.portal.util.Calculate;
40
import com.ekexiu.portal.util.Calculate;
40

41

411
			info.setPapers(this.paperDao.query(con, id));
412
			info.setPapers(this.paperDao.query(con, id));
412
			info.setPatents(this.patentDao.query(con, id));
413
			info.setPatents(this.patentDao.query(con, id));
413
			info.setProjects(this.projectDao.query(con, id));
414
			info.setProjects(this.projectDao.query(con, id));
414
			info.setResearchAreaLogs(this.researchAreaLogDao.query(con, id));
415
			List<EditResearchAreaLog> logs = this.researchAreaLogDao.query(con, id);
416
			if(logs != null){
417
				for (EditResearchAreaLog log : logs) {
418
					log.setHasHeadImage(this.imageService.hasProfessorImage(log.getOpreteProfessorId()));
419
				}
420
			}
421
			info.setEditResearchAreaLogs(logs);
415
			info.setResearchAreas(this.researchAreaDao.query(con, id));
422
			info.setResearchAreas(this.researchAreaDao.query(con, id));
416
			info.setResources(this.resourceDao.queryPro(con, id));
423
			info.setResources(this.resourceDao.queryPro(con, id));
417
		}
424
		}