瀏覽代碼

专家搜索接口添加按专家地址字段搜索。

zzy.zhiyuan.foxmail 8 年之前
父節點
當前提交
7fb6a05345

+ 11 - 1
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

@ -191,7 +191,7 @@ public abstract class ProfessorDao {
191 191
					"" + "ORG_ID IN(SELECT ID FROM ORGANIZATION WHERE NAME LIKE ?)", "NAME LIKE ?" }, handlerClass = StringHandler.class) String key,
192 192
			int pageSize, int pageNo) throws SQLException;
193 193

194
	public PageQueryResult<Professor> query(Connection con, @Nullable String key, String subject, String industry, int pageSize, int pageNo)
194
	public PageQueryResult<Professor> query(Connection con, @Nullable String key, String subject, String industry, String address, int pageSize, int pageNo)
195 195
			throws SQLException {
196 196

197 197
		org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Professor> _result = new org.jfw.util.PageQueryResult<com.ekexiu.portal.po.Professor>();
@ -204,12 +204,16 @@ public abstract class ProfessorDao {
204 204
		}
205 205
		boolean hasSubject = null != subject;
206 206
		boolean hasIndustry = null != industry;
207
		boolean hasAddress = null != address;
207 208
		if (hasSubject) {
208 209
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(SUBJECT LIKE ?)");
209 210
		}
210 211
		if (hasIndustry) {
211 212
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(INDUSTRY LIKE ?)");
212 213
		}
214
		if (hasAddress) {
215
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(ADDRESS LIKE ?)");
216
		}
213 217

214 218
		StringBuilder whereSql = sql;
215 219
		sql = new StringBuilder();
@ -232,6 +236,9 @@ public abstract class ProfessorDao {
232 236
			if (hasIndustry) {
233 237
				ps.setString(paramIndex++, industry);
234 238
			}
239
			if (hasAddress) {
240
				ps.setString(paramIndex++, address);
241
			}
235 242
			_result.setPageSize(pageSize);
236 243
			java.sql.ResultSet _pageRs = ps.executeQuery();
237 244
			try {
@ -297,6 +304,9 @@ public abstract class ProfessorDao {
297 304
			if (hasIndustry) {
298 305
				ps.setString(paramIndex++, industry);
299 306
			}
307
			if (hasAddress) {
308
				ps.setString(paramIndex++, address);
309
			}
300 310
			java.sql.ResultSet rs = ps.executeQuery();
301 311
			try {
302 312
				java.util.List<com.ekexiu.portal.po.Professor> _m_11 = new java.util.ArrayList<com.ekexiu.portal.po.Professor>();

+ 4 - 3
src/main/java/com/ekexiu/portal/service/ProfessorService.java

@ -237,14 +237,15 @@ public class ProfessorService {
237 237
	}
238 238
	@Get
239 239
	@Path("/pq")
240
	PageQueryResult<Professor> query(@JdbcConn(false) Connection con,@Nullable String key,@Nullable String subject,@Nullable String industry, @DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
240
	PageQueryResult<Professor> query(@JdbcConn(false) Connection con,@Nullable String key,@Nullable String subject,@Nullable String industry,@Nullable String address, @DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo)throws SQLException{
241 241
	//	System.out.println("key==["+(key==null?"":key)+"]");
242 242
	//	System.out.println("subject==["+(subject==null?"":subject)+"]");
243 243
	//	System.out.println("industry==["+(industry==null?"":industry)+"]");
244 244
		if(key!=null) key="%"+key+"%";
245 245
		if(subject!=null) subject ="%"+subject+"%";
246
		if(null!=industry)industry="%"+industry+"%";
247
		return this.professorDao.query(con, key, subject, industry, pageSize, pageNo);
246
		if(null!=industry) industry="%"+industry+"%";
247
		if(null!=address) address="%"+address+"%";
248
		return this.professorDao.query(con, key, subject, industry, address, pageSize, pageNo);
248 249
	}
249 250
	
250 251
	@Get