Browse Source

修改PageQueryResult<Professor> query方法

zzy.zhiyuan.foxmail 8 years ago
parent
commit
12b54f2aa9
1 changed files with 3 additions and 4 deletions
  1. 3 4
      src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

+ 3 - 4
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

198
		if (1 == pageNo) {
198
		if (1 == pageNo) {
199
			_result.setPageNo(1);
199
			_result.setPageNo(1);
200
			sql = new StringBuilder();
200
			sql = new StringBuilder();
201
			sql.append("SELECT OFFICE,SUBJECT,INDUSTRY,ADDRESS,DEPARTMENT,ORG_ID,organization.NAME AS ONAME,TITLE,AUTHENTICATION,professor.ID,professor.NAME,professor.DESCP,professor.CREATE_TIME,professor.MODIFY_TIME FROM PROFESSOR LEFT JOIN ORGANIZATION ON professor.ORG_ID=organization.ID ORDER BY ONAME");
201
			sql.append("SELECT OFFICE,SUBJECT,INDUSTRY,DEPARTMENT,ORG_ID,TITLE,AUTHENTICATION,ID,NAME,DESCP,CREATE_TIME,MODIFY_TIME FROM PROFESSOR");
202
			if (whereSql.length() > 0) {
202
			if (whereSql.length() > 0) {
203
				sql.append(whereSql);
203
				sql.append(whereSql);
204
			}
204
			}
205
			sql.append(" ORDER BY ONAME");
206
			sql.append(" LIMIT ").append(pageSize);
205
			sql.append(" LIMIT ").append(pageSize);
207
		} else {
206
		} else {
208
			int _pageSize = totalSize / pageSize;
207
			int _pageSize = totalSize / pageSize;
216
			--pageNo;
215
			--pageNo;
217
			int _m_10 = (pageNo * pageSize);
216
			int _m_10 = (pageNo * pageSize);
218
			sql = new StringBuilder();
217
			sql = new StringBuilder();
219
			sql.append("SELECT OFFICE,SUBJECT,INDUSTRY,ADDRESS,DEPARTMENT,ORG_ID,organization.NAME AS ONAME,TITLE,AUTHENTICATION,professor.ID,professor.NAME,professor.DESCP,professor.CREATE_TIME,professor.MODIFY_TIME FROM PROFESSOR LEFT JOIN ORGANIZATION ON professor.ORG_ID=organization.ID ORDER BY ONAME");
218
			sql.append("SELECT OFFICE,SUBJECT,INDUSTRY,DEPARTMENT,ORG_ID,TITLE,AUTHENTICATION,ID,NAME,DESCP,CREATE_TIME,MODIFY_TIME FROM PROFESSOR");
220
			if (whereSql.length() > 0) {
219
			if (whereSql.length() > 0) {
221
				sql.append(whereSql);
220
				sql.append(whereSql);
222
			}
221
			}
223
			sql.append(" ORDER BY ONAME");
222
			sql.append(" ORDER BY ID");
224
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
223
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
225
		}
224
		}
226
		ps = con.prepareStatement(sql.toString());
225
		ps = con.prepareStatement(sql.toString());