浏览代码

--add queryLimit().

zzy.zhiyuan.foxmail 8 年之前
父节点
当前提交
74dd3a92c2

+ 4 - 2
src/main/java/com/ekexiu/portal/dao/ResearchAreaLogDao.java

@ -32,11 +32,13 @@ 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{
35
	public List<EditResearchAreaLog> queryLimit(Connection con,String professorId,String caption,String createTime,int rows) throws SQLException{
36 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 = ?";
37
        String sql = "SELECT OPRETE_PROFESSOR_ID,CREATE_TIME,PROFESSOR_ID,CAPTION FROM RESEARCH_AREA_LOG "
38
        		+ " WHERE CREATE_TIME < ? AND CAPTION = ? AND PROFESSOR_ID = ? ORDER BY CREATE_TIME DESC LIMIT "+rows;
38 39
        PreparedStatement ps = con.prepareStatement(sql);
39 40
        try{
41
            ps.setString(_m_1++,createTime);
40 42
            ps.setString(_m_1++,caption);
41 43
            ps.setString(_m_1++,professorId);
42 44
            ResultSet rs = ps.executeQuery();

+ 7 - 4
src/main/java/com/ekexiu/portal/service/ResearchAreaLogService.java

@ -5,6 +5,7 @@ import java.sql.SQLException;
5 5
import java.util.List;
6 6

7 7
import org.jfw.apt.annotation.Autowrie;
8
import org.jfw.apt.annotation.DefaultValue;
8 9
import org.jfw.apt.web.annotation.Path;
9 10
import org.jfw.apt.web.annotation.operate.Get;
10 11
import org.jfw.apt.web.annotation.param.JdbcConn;
@ -16,6 +17,7 @@ import com.ekexiu.portal.pojo.EditResearchAreaLog;
16 17

17 18
@Path("/researchAreaLog")
18 19
public class ResearchAreaLogService {
20
	public static final String MAX_CREATE_TIME = "9";
19 21
	@Autowrie
20 22
	private ResearchAreaLogDao researchAreaLogDao;
21 23
	@Autowrie
@ -46,11 +48,11 @@ public class ResearchAreaLogService {
46 48
	public void setImageService(ImageService imageService) {
47 49
		this.imageService = imageService;
48 50
	}
49

51
	
50 52
	@Get
51
	@Path("/agreeList")
52
	public List<EditResearchAreaLog> queryCaption(@JdbcConn Connection con, String professorId, String caption@DefaultValue("com.ekexiu.portal.service.ResearchAreaLogService.MAX_CREATE_TIME") String createTime,@DefaultValue("10") int rows) throws SQLException{
53
		List<EditResearchAreaLog> areaLogs = this.researchAreaLogDao.queryCaption(con, professorId, caption);
53
	@Path("/ql")
54
	public List<EditResearchAreaLog> queryLimit(@JdbcConn Connection con,String professorId,String caption,@DefaultValue("com.ekexiu.portal.service.ResearchAreaLogService.MAX_CREATE_TIME") String createTime,@DefaultValue("10") int rows@DefaultValue("com.ekexiu.portal.service.ResearchAreaLogService.MAX_CREATE_TIME") String createTime,@DefaultValue("10") int rows)throws SQLException{
55
		List<EditResearchAreaLog> areaLogs = this.researchAreaLogDao.queryLimit(con, professorId, caption, createTime, rows);
54 56
		if(!areaLogs.isEmpty()){
55 57
			for (EditResearchAreaLog areaLog : areaLogs) {
56 58
				EditProfessor professor = this.professorDao.queryBaseInfo(con, areaLog.getOpreteProfessorId());
@ -60,4 +62,5 @@ public class ResearchAreaLogService {
60 62
		}
61 63
		return areaLogs;
62 64
	}
65

63 66
}