Przeglądaj źródła

Merge remote-tracking branch 'origin/dev' into test

jiapeng 7 lat temu
rodzic
commit
469c12776a

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

476
            sql = new StringBuilder();
476
            sql = new StringBuilder();
477
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
477
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
478
            sql.append(whereSql);
478
            sql.append(whereSql);
479
            sql.append(" ORDER BY PUBLISH_TIME DESC");
479
            sql.append(" ORDER BY SORT_NUM DESC, PUBLISH_TIME DESC");
480
            sql.append(" LIMIT ").append(pageSize);
480
            sql.append(" LIMIT ").append(pageSize);
481
        }else{
481
        }else{
482
            int pageNum = total / pageSize;
482
            int pageNum = total / pageSize;
492
            sql = new StringBuilder();
492
            sql = new StringBuilder();
493
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
493
            sql.append("SELECT ARTICLE_ID,PROFESSOR_ID,ARTICLE_TITLE,ARTICLE_CONTENT,SUBJECT,INDUSTRY,PUBLISH_TIME,ARTICLE_IMG,ORG_ID,ARTICLE_TYPE,ARTICLE_AGREE,PAGE_VIEWS,STATUS,CREATE_TIME,MODIFY_TIME,SHARE_ID FROM ARTICLE");
494
            sql.append(whereSql);
494
            sql.append(whereSql);
495
            sql.append(" ORDER BY PUBLISH_TIME DESC");
495
            sql.append(" ORDER BY SORT_NUM DESC,PUBLISH_TIME DESC");
496
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
496
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
497
        }
497
        }
498
        ps = con.prepareStatement(sql.toString());
498
        ps = con.prepareStatement(sql.toString());

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

47
	@Column(handlerClass=IntHandler.class,value="COUNT(1)")
47
	@Column(handlerClass=IntHandler.class,value="COUNT(1)")
48
	@From(Demand.class)
48
	@From(Demand.class)
49
	public abstract int queryCountStatus(Connection con,String demandStatus)throws SQLException, JfwBaseException;
49
	public abstract int queryCountStatus(Connection con,String demandStatus)throws SQLException, JfwBaseException;
50
	
50
	
51
	@SelectList
51
	@SelectList
52
	@OrderBy("ORDER BY CREATE_TIME DESC")
52
	@OrderBy("ORDER BY CREATE_TIME DESC")
53
	public abstract List<Demand> queryForOrg(Connection con,String orgId)throws SQLException;
53
	public abstract List<Demand> queryForOrg(Connection con,String orgId)throws SQLException;

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

68
	@PageSelect
68
	@PageSelect
69
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
69
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
70
	@Or
70
	@Or
71
	public abstract PageQueryResult<Ppaper> query(Connection con,@Alias({"name","authors","keywords"}) @Like String cnt,int pageSize,int pageNo) throws SQLException;
71
	public abstract PageQueryResult<Ppaper> query(Connection con,@Alias({"name","authors","keywords","cn4periodical","en4periodical"}) @Like String cnt,int pageSize,int pageNo) throws SQLException;
72
	
72
	
73
	
73
	
74
	@SelectOne
74
	@SelectOne

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

68
	@PageSelect
68
	@PageSelect
69
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
69
	@OrderBy(" ORDER BY SORT_NUM DESC,CREATE_TIME DESC,ID DESC")
70
	@Or
70
	@Or
71
	public abstract PageQueryResult<Ppatent> query(Connection con, @Alias({ "code", "authors", "name", "keywords" }) @Like String cnt, int pageSize, int pageNo)
71
	public abstract PageQueryResult<Ppatent> query(Connection con, @Alias({ "code", "authors", "name", "keywords","reqPerson" }) @Like String cnt, int pageSize, int pageNo)
72
			throws SQLException;
72
			throws SQLException;
73

73

74
	@SelectOne
74
	@SelectOne

+ 1037 - 909
src/main/java/com/ekexiu/portal/dao/ProfessorDao.java

47
public abstract class ProfessorDao {
47
public abstract class ProfessorDao {
48
	@Insert
48
	@Insert
49
	public abstract int insert(Connection con, Professor professor) throws SQLException;
49
	public abstract int insert(Connection con, Professor professor) throws SQLException;
50
	
50

51
	@UpdateWith
51
	@UpdateWith
52
	@From(Professor.class)
52
	@From(Professor.class)
53
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
53
	@SetSentence("PAGE_VIEWS = PAGE_VIEWS + 1")
54
	public abstract int incPageViews(Connection con,String id)throws SQLException;
54
	public abstract int incPageViews(Connection con, String id) throws SQLException;
55

55

56
	@Update
56
	@Update
57
	public abstract int update(Connection con, Professor professor) throws SQLException;
57
	public abstract int update(Connection con, Professor professor) throws SQLException;
58
	
59
	public int updateScoreValue(Connection con,String id,Integer scoreValue)throws SQLException{
58

59
	public int updateScoreValue(Connection con, String id, Integer scoreValue) throws SQLException {
60
		String sql = "UPDATE PROFESSOR SET SCORE_VALUE = SCORE_VALUE + " + scoreValue + " WHERE ID = '" + id + "'";
60
		String sql = "UPDATE PROFESSOR SET SCORE_VALUE = SCORE_VALUE + " + scoreValue + " WHERE ID = '" + id + "'";
61
		PreparedStatement ps = con.prepareStatement(sql);
61
		PreparedStatement ps = con.prepareStatement(sql);
62
		try{
62
		try {
63
			return ps.executeUpdate();
63
			return ps.executeUpdate();
64
		}finally{
65
			try{ps.close();}catch(Exception e){}
64
		} finally {
65
			try {
66
				ps.close();
67
			} catch (Exception e) {
68
			}
66
		}
69
		}
67
	}
70
	}
68
	
69
	public int updateGrowthValue(Connection con,String id,Integer growthValue)throws SQLException{
71

72
	public int updateGrowthValue(Connection con, String id, Integer growthValue) throws SQLException {
70
		String sql = "UPDATE PROFESSOR SET GROWTH_VALUE = GROWTH_VALUE + " + growthValue + " WHERE ID = '" + id + "'";
73
		String sql = "UPDATE PROFESSOR SET GROWTH_VALUE = GROWTH_VALUE + " + growthValue + " WHERE ID = '" + id + "'";
71
		PreparedStatement ps = con.prepareStatement(sql);
74
		PreparedStatement ps = con.prepareStatement(sql);
72
		try{
75
		try {
73
			return ps.executeUpdate();
76
			return ps.executeUpdate();
74
		}finally{
75
			try{ps.close();}catch(Exception e){}
77
		} finally {
78
			try {
79
				ps.close();
80
			} catch (Exception e) {
81
			}
76
		}
82
		}
77
	}
83
	}
78
	
84

79
	@SelectOne
85
	@SelectOne
80
	@Nullable
86
	@Nullable
81
	public abstract Professor query(Connection con,long shareId)throws SQLException;
82
	
87
	public abstract Professor query(Connection con, long shareId) throws SQLException;
88

83
	@UpdateWith
89
	@UpdateWith
84
	@From(Professor.class)
90
	@From(Professor.class)
85
	public abstract int updatePhone(Connection con, String id, @Set String phone) throws SQLException;
91
	public abstract int updatePhone(Connection con, String id, @Set String phone) throws SQLException;
86
	
92

87
	@UpdateWith
93
	@UpdateWith
88
	@From(Professor.class)
94
	@From(Professor.class)
89
	public abstract int updateEmail(Connection con, String id, @Set String email) throws SQLException;
95
	public abstract int updateEmail(Connection con, String id, @Set String email) throws SQLException;
90
	
96

91
	@UpdateWith
97
	@UpdateWith
92
	@From(Professor.class)
98
	@From(Professor.class)
93
	public abstract int updateSortFirst(Connection con, String id, @Set Integer sortFirst) throws SQLException;
99
	public abstract int updateSortFirst(Connection con, String id, @Set Integer sortFirst) throws SQLException;
94
	
100

95
	@UpdateWith
101
	@UpdateWith
96
	@From(Professor.class)
102
	@From(Professor.class)
97
	public abstract int updateAuthentication(Connection con, String id, @Set Integer authentication, 
98
			@Set Integer authType, @Set Integer authStatus) throws SQLException;
99
	
103
	public abstract int updateAuthentication(Connection con, String id, @Set Integer authentication, @Set Integer authType, @Set Integer authStatus)
104
			throws SQLException;
105

100
	@UpdateWith
106
	@UpdateWith
101
	@From(Professor.class)
107
	@From(Professor.class)
102
	public abstract int updateAuthType(Connection con, String id, @Set Integer authType) throws SQLException;
108
	public abstract int updateAuthType(Connection con, String id, @Set Integer authType) throws SQLException;
103
	
109

104
	@UpdateWith
110
	@UpdateWith
105
	@From(Professor.class)
111
	@From(Professor.class)
106
	public abstract int updateAuthentication(Connection con, String id, @Set Integer authentication) throws SQLException;
112
	public abstract int updateAuthentication(Connection con, String id, @Set Integer authentication) throws SQLException;
107
	
113

108
	@UpdateWith
114
	@UpdateWith
109
	@From(Professor.class)
115
	@From(Professor.class)
110
	public abstract int updateAuthStatus(Connection con, String id, @Set Integer authStatus) throws SQLException;
116
	public abstract int updateAuthStatus(Connection con, String id, @Set Integer authStatus) throws SQLException;
111
	
117

112
	@UpdateWith
118
	@UpdateWith
113
	@From(Professor.class)
119
	@From(Professor.class)
114
	public abstract int updateAuthStatusExpert(Connection con,String id,@Set Integer authStatusExpert)throws SQLException;
115
	
120
	public abstract int updateAuthStatusExpert(Connection con, String id, @Set Integer authStatusExpert) throws SQLException;
121

116
	@UpdateWith
122
	@UpdateWith
117
	@From(Professor.class)
123
	@From(Professor.class)
118
	public abstract int updateOrgAuth(Connection con,String id,@Set String orgAuth)throws SQLException;
119
	
124
	public abstract int updateOrgAuth(Connection con, String id, @Set String orgAuth) throws SQLException;
125

120
	@UpdateWith
126
	@UpdateWith
121
	@From(Professor.class)
127
	@From(Professor.class)
122
	public abstract int updateStarLevel(Connection con, String id, @Set BigDecimal starLevel) throws SQLException;
128
	public abstract int updateStarLevel(Connection con, String id, @Set BigDecimal starLevel) throws SQLException;
123
	
129

124
	@UpdateWith
130
	@UpdateWith
125
	@From(Professor.class)
131
	@From(Professor.class)
126
	public abstract int updateConsultCount(Connection con, String id, @Set Integer consultCount) throws SQLException;
132
	public abstract int updateConsultCount(Connection con, String id, @Set Integer consultCount) throws SQLException;
136
	@UpdateWith
142
	@UpdateWith
137
	@From(Professor.class)
143
	@From(Professor.class)
138
	public abstract int updateIndustry(Connection con, String id, @Set String industry) throws SQLException;
144
	public abstract int updateIndustry(Connection con, String id, @Set String industry) throws SQLException;
139
	
145

140
	@UpdateWith
146
	@UpdateWith
141
	@From(Professor.class)
147
	@From(Professor.class)
142
	public abstract int updateAddress(Connection con, String id, @Set String address) throws SQLException;
148
	public abstract int updateAddress(Connection con, String id, @Set String address) throws SQLException;
143
	
149

144
	@UpdateWith
150
	@UpdateWith
145
	@From(Professor.class)
151
	@From(Professor.class)
146
	public abstract int updateProvince(Connection con, String id, @Set String province) throws SQLException;
152
	public abstract int updateProvince(Connection con, String id, @Set String province) throws SQLException;
147
	
153

148
	@UpdateWith
154
	@UpdateWith
149
	@From(Professor.class)
155
	@From(Professor.class)
150
	public abstract int updateStarAvg(Connection con, String id, @Set BigDecimal starAvg) throws SQLException;
156
	public abstract int updateStarAvg(Connection con, String id, @Set BigDecimal starAvg) throws SQLException;
151
	
157

152
	@UpdateWith
158
	@UpdateWith
153
	@From(Professor.class)
159
	@From(Professor.class)
154
	public abstract int updateScorePercent(Connection con,String id,@Set String scorePercent)throws SQLException;
155
	
160
	public abstract int updateScorePercent(Connection con, String id, @Set String scorePercent) throws SQLException;
161

156
	/**
162
	/**
157
	 * 查用户总数
163
	 * 查用户总数
164
	 * 
158
	 * @param con
165
	 * @param con
159
	 * @return
166
	 * @return
160
	 * @throws SQLException
167
	 * @throws SQLException
161
	 */
168
	 */
162
	@QueryVal
169
	@QueryVal
163
	@Column(handlerClass=IntHandler.class,value={"COUNT(1)"})
170
	@Column(handlerClass = IntHandler.class, value = { "COUNT(1)" })
164
	@From(Professor.class)
171
	@From(Professor.class)
165
	@DefaultValue("0")
172
	@DefaultValue("0")
166
	public abstract int queryCount(Connection con)throws SQLException;
167
	
173
	public abstract int queryCount(Connection con) throws SQLException;
174

168
	/**
175
	/**
169
	 * 查询积分值低于scoreValue的用户总数
176
	 * 查询积分值低于scoreValue的用户总数
177
	 * 
170
	 * @param con
178
	 * @param con
171
	 * @param scoreValue 积分值
179
	 * @param scoreValue
180
	 *            积分值
172
	 * @return
181
	 * @return
173
	 * @throws SQLException
182
	 * @throws SQLException
174
	 */
183
	 */
175
	@QueryVal
184
	@QueryVal
176
	@Column(handlerClass=IntHandler.class,value={"COUNT(1)"})
185
	@Column(handlerClass = IntHandler.class, value = { "COUNT(1)" })
177
	@From(Professor.class)
186
	@From(Professor.class)
178
	@DefaultValue("0")
187
	@DefaultValue("0")
179
	public abstract int queryCountLessThan(Connection con,@LessThan int scoreValue)throws SQLException;
180
	
188
	public abstract int queryCountLessThan(Connection con, @LessThan int scoreValue) throws SQLException;
189

181
	@SelectList
190
	@SelectList
182
	public abstract List<Professor> queryList(Connection con)throws SQLException;
183
	
184
	public List<EditProfessor> queryInvite(Connection con, String id) throws SQLException{
191
	public abstract List<Professor> queryList(Connection con) throws SQLException;
192

193
	public List<EditProfessor> queryInvite(Connection con, String id) throws SQLException {
185
		int index = 1;
194
		int index = 1;
186
        String sql = "SELECT OFFICE,ADDRESS,ORG_ID,O.NAME,TITLE,AUTHENTICATION,P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_AUTH,P.SHARE_ID "
187
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID "
188
        		+ " INNER JOIN LUSER L ON P.ID=L.ID WHERE L.INVITER_ID = ? ORDER BY P.CREATE_TIME DESC,P.ID";
189
        PreparedStatement ps = con.prepareStatement(sql);
190
        try{
191
        	ps.setString(index++,id);
192
            ResultSet rs = ps.executeQuery();
193
            try{
194
                List<EditProfessor> professors = new ArrayList<EditProfessor>();
195
                while(rs.next()){
196
                	EditProfessor professor =  new EditProfessor();
197
                    String office = rs.getString(1);
198
                    if(rs.wasNull()){
199
                    	office = null;
200
                    }
201
                    professor.setOffice(office);
202
                    String address = rs.getString(2);
203
                    if(rs.wasNull()){
204
                    	address = null;
205
                    }
206
                    professor.setAddress(address);
207
                    Organization organization = new Organization();
208
                    String orgId = rs.getString(3);
209
                    if(rs.wasNull()){
210
                    	orgId = null;
211
                    }
212
                    organization.setId(orgId);
213
                    String orgName = rs.getString(4);
214
                    if(rs.wasNull()){
215
                    	orgName = null;
216
                    }
217
                    organization.setName(orgName);
218
                    professor.setOrganization(organization);
219
                    professor.setTitle(rs.getString(5));
220
                    Integer auth = rs.getInt(6);
221
                    if(rs.wasNull()){
222
                    	auth = null;
223
                    }
224
                    professor.setAuthentication(auth);
225
                    professor.setAuthType(rs.getInt(7));
226
                    professor.setAuthStatus(rs.getInt(8));
227
                    professor.setId(rs.getString(9));
228
                    professor.setName(rs.getString(10));
229
                    professor.setOrgAuth(rs.getString(11));
230
                    professor.setShareId(rs.getLong(12));
231
                    professors.add(professor);
232
                }
233
                return professors;
234
            }finally{
235
                try{rs.close();}catch(Exception e1){}
236
            }
237
        }finally{
238
            try{ps.close();}catch(Exception e2){}
239
        }
240
    }
241
	
195
		String sql = "SELECT OFFICE,ADDRESS,ORG_ID,O.NAME,TITLE,AUTHENTICATION,P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_AUTH,P.SHARE_ID "
196
				+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID "
197
				+ " INNER JOIN LUSER L ON P.ID=L.ID WHERE L.INVITER_ID = ? ORDER BY P.CREATE_TIME DESC,P.ID";
198
		PreparedStatement ps = con.prepareStatement(sql);
199
		try {
200
			ps.setString(index++, id);
201
			ResultSet rs = ps.executeQuery();
202
			try {
203
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
204
				while (rs.next()) {
205
					EditProfessor professor = new EditProfessor();
206
					String office = rs.getString(1);
207
					if (rs.wasNull()) {
208
						office = null;
209
					}
210
					professor.setOffice(office);
211
					String address = rs.getString(2);
212
					if (rs.wasNull()) {
213
						address = null;
214
					}
215
					professor.setAddress(address);
216
					Organization organization = new Organization();
217
					String orgId = rs.getString(3);
218
					if (rs.wasNull()) {
219
						orgId = null;
220
					}
221
					organization.setId(orgId);
222
					String orgName = rs.getString(4);
223
					if (rs.wasNull()) {
224
						orgName = null;
225
					}
226
					organization.setName(orgName);
227
					professor.setOrganization(organization);
228
					professor.setTitle(rs.getString(5));
229
					Integer auth = rs.getInt(6);
230
					if (rs.wasNull()) {
231
						auth = null;
232
					}
233
					professor.setAuthentication(auth);
234
					professor.setAuthType(rs.getInt(7));
235
					professor.setAuthStatus(rs.getInt(8));
236
					professor.setId(rs.getString(9));
237
					professor.setName(rs.getString(10));
238
					professor.setOrgAuth(rs.getString(11));
239
					professor.setShareId(rs.getLong(12));
240
					professors.add(professor);
241
				}
242
				return professors;
243
			} finally {
244
				try {
245
					rs.close();
246
				} catch (Exception e1) {
247
				}
248
			}
249
		} finally {
250
			try {
251
				ps.close();
252
			} catch (Exception e2) {
253
			}
254
		}
255
	}
256

242
	/**
257
	/**
243
	 * 查询用户的认证状态。
258
	 * 查询用户的认证状态。
259
	 * 
244
	 * @param con
260
	 * @param con
245
	 * @param id
261
	 * @param id
246
	 * @return 返回认证类型 用户类型 实名认证状态和专家认证状态
262
	 * @return 返回认证类型 用户类型 实名认证状态和专家认证状态
247
	 * @throws SQLException
263
	 * @throws SQLException
248
	 */
264
	 */
249
	public Professor queryAuth(Connection con, String id) throws SQLException{
265
	public Professor queryAuth(Connection con, String id) throws SQLException {
250
		int index = 1;
266
		int index = 1;
251
		String sql = " SELECT AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,AUTH_STATUS_EXPERT,ORG_AUTH FROM PROFESSOR WHERE ID = ? ";
267
		String sql = " SELECT AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,AUTH_STATUS_EXPERT,ORG_AUTH FROM PROFESSOR WHERE ID = ? ";
252
		PreparedStatement ps = con.prepareStatement(sql);
268
		PreparedStatement ps = con.prepareStatement(sql);
253
		try{
254
            ps.setString(index++,id);
255
            ResultSet rs = ps.executeQuery();
256
            try{
257
                if(rs.next()){
258
                	Professor professor = new Professor();
259
                	Integer auth = rs.getInt(1);
260
                    if(rs.wasNull()){
261
                    	auth = null;
262
                    }
263
                    professor.setAuthentication(auth);
264
                    professor.setAuthType(rs.getInt(2));
265
                    professor.setAuthStatus(rs.getInt(3));
266
                    professor.setAuthStatusExpert(rs.getInt(4));
267
                    professor.setOrgAuth(rs.getString(5));
268
                    return professor;
269
                }else{
270
                    return null;
271
                }
272
            }finally{
273
                try{rs.close();}catch(Exception e1){}
274
            }
275
        }finally{
276
            try{ps.close();}catch(Exception e2){}
277
        }
269
		try {
270
			ps.setString(index++, id);
271
			ResultSet rs = ps.executeQuery();
272
			try {
273
				if (rs.next()) {
274
					Professor professor = new Professor();
275
					Integer auth = rs.getInt(1);
276
					if (rs.wasNull()) {
277
						auth = null;
278
					}
279
					professor.setAuthentication(auth);
280
					professor.setAuthType(rs.getInt(2));
281
					professor.setAuthStatus(rs.getInt(3));
282
					professor.setAuthStatusExpert(rs.getInt(4));
283
					professor.setOrgAuth(rs.getString(5));
284
					return professor;
285
				} else {
286
					return null;
287
				}
288
			} finally {
289
				try {
290
					rs.close();
291
				} catch (Exception e1) {
292
				}
293
			}
294
		} finally {
295
			try {
296
				ps.close();
297
			} catch (Exception e2) {
298
			}
299
		}
278
	}
300
	}
279
	
301

280
	/**
302
	/**
281
	 * 查询专家基本信息接口
303
	 * 查询专家基本信息接口
304
	 * 
282
	 * @param con
305
	 * @param con
283
	 * @param id 专家ID
306
	 * @param id
307
	 *            专家ID
284
	 * @return 返回专家基本信息
308
	 * @return 返回专家基本信息
285
	 * @throws SQLException
309
	 * @throws SQLException
286
	 */
310
	 */
287
	public EditProfessor queryBaseInfo(Connection con, String id) throws SQLException {
311
	public EditProfessor queryBaseInfo(Connection con, String id) throws SQLException {
288
		int index = 1;
312
		int index = 1;
289
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,"
290
        		+ " P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT,P.SHARE_ID,P.PHONE,P.EMAIL,P.PROVINCE"
291
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
292
        PreparedStatement ps = con.prepareStatement(sql);
293
        try{
294
            ps.setString(index++,id);
295
            ResultSet rs = ps.executeQuery();
296
            try{
297
                if(rs.next()){
298
                	EditProfessor professor = new EditProfessor();
299
                	String office = rs.getString(1);
300
                	if(rs.wasNull()){
301
                		office = null;
302
                	}
303
                    professor.setOffice(office);
304
                    String depart = rs.getString(2);
305
                    if(rs.wasNull()){
306
                    	depart = null;
307
                	}
308
                    professor.setDepartment(depart);
309
                    String title = rs.getString(3);
310
                    if(rs.wasNull()){
311
                    	title = null;
312
                	}
313
                    professor.setTitle(title);
314
                    Integer auth = rs.getInt(4);
315
                    if(rs.wasNull()){
316
                    	auth = null;
317
                    }
318
                    professor.setAuthentication(auth);
319
                    professor.setAuthType(rs.getInt(5));
320
                    professor.setAuthStatus(rs.getInt(6));
321
                    professor.setId(rs.getString(7));
322
                    professor.setName(rs.getString(8));
323
                    String address = rs.getString(9);
324
                    if(rs.wasNull()){
325
                    	address = null;
326
                	}
327
                    professor.setAddress(address);
328
                    professor.setOrgAuth(rs.getString(10));
329
                    String orgName = rs.getString(11);
330
                    if(rs.wasNull()){
331
                    	orgName = null;
332
                    }
333
                    professor.setOrgName(orgName);
334
                    String orgId = rs.getString(12);
335
                    if(rs.wasNull()){
336
                    	orgId = null;
337
                    }
338
                    professor.setOrgId(orgId);
339
                    String scorePercent = rs.getString(13);
340
                    if(rs.wasNull()){
341
                    	scorePercent = null;
342
                    }
343
                    professor.setScorePercent(scorePercent);
344
                    professor.setShareId(rs.getLong(14));
345
                    String phone = rs.getString(15);
346
                    if(rs.wasNull()){
347
                    	phone = null;
348
                    }
349
                    professor.setPhone(phone);
350
                    String email = rs.getString(16);
351
                    if(rs.wasNull()){
352
                    	email = null;
353
                    }
354
                    professor.setEmail(email);
355
                    String province = rs.getString(17);
356
                    if(rs.wasNull()){
357
                    	province = null;
358
                    }
359
                    professor.setProvince(province);
360
                    
361
                    return professor;
362
                }else{
363
                    return null;
364
                }
365
            }finally{
366
                try{rs.close();}catch(Exception e1){}
367
            }
368
        }finally{
369
            try{ps.close();}catch(Exception e2){}
370
        }
313
		String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,"
314
				+ " P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT,P.SHARE_ID,P.PHONE,P.EMAIL,P.PROVINCE"
315
				+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
316
		PreparedStatement ps = con.prepareStatement(sql);
317
		try {
318
			ps.setString(index++, id);
319
			ResultSet rs = ps.executeQuery();
320
			try {
321
				if (rs.next()) {
322
					EditProfessor professor = new EditProfessor();
323
					String office = rs.getString(1);
324
					if (rs.wasNull()) {
325
						office = null;
326
					}
327
					professor.setOffice(office);
328
					String depart = rs.getString(2);
329
					if (rs.wasNull()) {
330
						depart = null;
331
					}
332
					professor.setDepartment(depart);
333
					String title = rs.getString(3);
334
					if (rs.wasNull()) {
335
						title = null;
336
					}
337
					professor.setTitle(title);
338
					Integer auth = rs.getInt(4);
339
					if (rs.wasNull()) {
340
						auth = null;
341
					}
342
					professor.setAuthentication(auth);
343
					professor.setAuthType(rs.getInt(5));
344
					professor.setAuthStatus(rs.getInt(6));
345
					professor.setId(rs.getString(7));
346
					professor.setName(rs.getString(8));
347
					String address = rs.getString(9);
348
					if (rs.wasNull()) {
349
						address = null;
350
					}
351
					professor.setAddress(address);
352
					professor.setOrgAuth(rs.getString(10));
353
					String orgName = rs.getString(11);
354
					if (rs.wasNull()) {
355
						orgName = null;
356
					}
357
					professor.setOrgName(orgName);
358
					String orgId = rs.getString(12);
359
					if (rs.wasNull()) {
360
						orgId = null;
361
					}
362
					professor.setOrgId(orgId);
363
					String scorePercent = rs.getString(13);
364
					if (rs.wasNull()) {
365
						scorePercent = null;
366
					}
367
					professor.setScorePercent(scorePercent);
368
					professor.setShareId(rs.getLong(14));
369
					String phone = rs.getString(15);
370
					if (rs.wasNull()) {
371
						phone = null;
372
					}
373
					professor.setPhone(phone);
374
					String email = rs.getString(16);
375
					if (rs.wasNull()) {
376
						email = null;
377
					}
378
					professor.setEmail(email);
379
					String province = rs.getString(17);
380
					if (rs.wasNull()) {
381
						province = null;
382
					}
383
					professor.setProvince(province);
384

385
					return professor;
386
				} else {
387
					return null;
388
				}
389
			} finally {
390
				try {
391
					rs.close();
392
				} catch (Exception e1) {
393
				}
394
			}
395
		} finally {
396
			try {
397
				ps.close();
398
			} catch (Exception e2) {
399
			}
400
		}
401
	}
402

403
	public List<EditProfessor> queryByName(Connection con, String name, int total) throws SQLException {
404
		int index = 1;
405
		String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT,P.SHARE_ID "
406
				+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.NAME LIKE ? ORDER BY P.SCORE_PERCENT DESC LIMIT " + total;
407
		PreparedStatement ps = con.prepareStatement(sql);
408
		try {
409
			ps.setString(index++, name);
410
			ResultSet rs = ps.executeQuery();
411
			try {
412
				List<EditProfessor> editProfessors = new ArrayList<EditProfessor>();
413
				while (rs.next()) {
414
					EditProfessor professor = new EditProfessor();
415
					String office = rs.getString(1);
416
					if (rs.wasNull()) {
417
						office = null;
418
					}
419
					professor.setOffice(office);
420
					String depart = rs.getString(2);
421
					if (rs.wasNull()) {
422
						depart = null;
423
					}
424
					professor.setDepartment(depart);
425
					String title = rs.getString(3);
426
					if (rs.wasNull()) {
427
						title = null;
428
					}
429
					professor.setTitle(title);
430
					Integer auth = rs.getInt(4);
431
					if (rs.wasNull()) {
432
						auth = null;
433
					}
434
					professor.setAuthentication(auth);
435
					professor.setAuthType(rs.getInt(5));
436
					professor.setAuthStatus(rs.getInt(6));
437
					professor.setId(rs.getString(7));
438
					professor.setName(rs.getString(8));
439
					String address = rs.getString(9);
440
					if (rs.wasNull()) {
441
						address = null;
442
					}
443
					professor.setAddress(address);
444
					professor.setOrgAuth(rs.getString(10));
445
					String orgName = rs.getString(11);
446
					if (rs.wasNull()) {
447
						orgName = null;
448
					}
449
					professor.setOrgName(orgName);
450
					String orgId = rs.getString(12);
451
					if (rs.wasNull()) {
452
						orgId = null;
453
					}
454
					professor.setOrgId(orgId);
455
					String scorePercent = rs.getString(13);
456
					if (rs.wasNull()) {
457
						scorePercent = null;
458
					}
459
					professor.setScorePercent(scorePercent);
460
					professor.setShareId(rs.getLong(14));
461
					editProfessors.add(professor);
462
				}
463
				return editProfessors;
464
			} finally {
465
				try {
466
					rs.close();
467
				} catch (Exception e1) {
468
				}
469
			}
470
		} finally {
471
			try {
472
				ps.close();
473
			} catch (Exception e2) {
474
			}
475
		}
476
	}
477

478
	/**
479
	 * 查询专家基本信息+星级+咨询次数的接口
480
	 * 
481
	 * @param con
482
	 * @param id
483
	 *            专家ID
484
	 * @return 返回专家基本信息+星级+咨询次数
485
	 * @throws SQLException
486
	 */
487
	public EditProfessor queryEditBaseInfo(Connection con, String id) throws SQLException {
488
		int index = 1;
489
		String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,"
490
				+ " P.ID,P.NAME,P.ADDRESS,P.STAR_LEVEL,P.CONSULT_COUNT,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID "
491
				+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
492
		PreparedStatement ps = con.prepareStatement(sql);
493
		try {
494
			ps.setString(index++, id);
495
			ResultSet rs = ps.executeQuery();
496
			try {
497
				if (rs.next()) {
498
					EditProfessor professor = new EditProfessor();
499
					String office = rs.getString(1);
500
					if (rs.wasNull()) {
501
						office = null;
502
					}
503
					professor.setOffice(office);
504
					String depart = rs.getString(2);
505
					if (rs.wasNull()) {
506
						depart = null;
507
					}
508
					professor.setDepartment(depart);
509
					String title = rs.getString(3);
510
					if (rs.wasNull()) {
511
						title = null;
512
					}
513
					professor.setTitle(title);
514
					Integer auth = rs.getInt(4);
515
					if (rs.wasNull()) {
516
						auth = null;
517
					}
518
					professor.setAuthentication(auth);
519
					professor.setAuthType(rs.getInt(5));
520
					professor.setAuthStatus(rs.getInt(6));
521
					professor.setId(rs.getString(7));
522
					professor.setName(rs.getString(8));
523
					String address = rs.getString(9);
524
					if (rs.wasNull()) {
525
						address = null;
526
					}
527
					professor.setAddress(address);
528
					professor.setStarLevel(rs.getBigDecimal(10));
529
					professor.setConsultCount(rs.getInt(11));
530
					professor.setOrgAuth(rs.getString(12));
531
					String orgName = rs.getString(13);
532
					if (rs.wasNull()) {
533
						orgName = null;
534
					}
535
					professor.setOrgName(orgName);
536
					professor.setShareId(rs.getLong(14));
537
					return professor;
538
				} else {
539
					return null;
540
				}
541
			} finally {
542
				try {
543
					rs.close();
544
				} catch (Exception e1) {
545
				}
546
			}
547
		} finally {
548
			try {
549
				ps.close();
550
			} catch (Exception e2) {
551
			}
552
		}
553
	}
554

555
	@SelectOne
556
	@Nullable
557
	public abstract Professor queryOne(Connection con, String id) throws SQLException;
558

559
	public Professor query(Connection con, String id) throws SQLException {
560
		int index = 1;
561
		String sql = "SELECT P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,ORG_ID,P.TITLE,AUTHENTICATION,AUTH_TYPE,"
562
				+ "P.AUTH_STATUS,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.PHONE,P.EMAIL,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID "
563
				+ "FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
564
		PreparedStatement ps = con.prepareStatement(sql);
565
		try {
566
			ps.setString(index++, id);
567
			ResultSet rs = ps.executeQuery();
568
			try {
569
				if (rs.next()) {
570
					Professor professor = new Professor();
571
					String office = rs.getString(1);
572
					if (rs.wasNull()) {
573
						office = null;
574
					}
575
					professor.setOffice(office);
576
					String subject = rs.getString(2);
577
					if (rs.wasNull()) {
578
						subject = null;
579
					}
580
					professor.setSubject(subject);
581
					String industry = rs.getString(3);
582
					if (rs.wasNull()) {
583
						industry = null;
584
					}
585
					professor.setIndustry(industry);
586
					String address = rs.getString(4);
587
					if (rs.wasNull()) {
588
						address = null;
589
					}
590
					professor.setAddress(address);
591
					String department = rs.getString(5);
592
					if (rs.wasNull()) {
593
						department = null;
594
					}
595
					professor.setDepartment(department);
596
					Organization organization = new Organization();
597
					String orgId = rs.getString(6);
598
					if (rs.wasNull()) {
599
						orgId = null;
600
					}
601
					organization.setId(orgId);
602
					String title = rs.getString(7);
603
					if (rs.wasNull()) {
604
						title = null;
605
					}
606
					professor.setTitle(title);
607
					Integer auth = rs.getInt(8);
608
					if (rs.wasNull()) {
609
						auth = null;
610
					}
611
					professor.setAuthentication(auth);
612
					professor.setAuthType(rs.getInt(9));
613
					professor.setAuthStatus(rs.getInt(10));
614
					professor.setId(rs.getString(11));
615
					professor.setName(rs.getString(12));
616
					String descp = rs.getString(13);
617
					if (rs.wasNull()) {
618
						descp = null;
619
					}
620
					professor.setDescp(descp);
621
					professor.setCreateTime(rs.getString(14));
622
					professor.setModifyTime(rs.getString(15));
623
					String phone = rs.getString(16);
624
					if (rs.wasNull()) {
625
						phone = null;
626
					}
627
					professor.setPhone(phone);
628
					String email = rs.getString(17);
629
					if (rs.wasNull()) {
630
						email = null;
631
					}
632
					professor.setEmail(email);
633
					professor.setOrgAuth(rs.getString(18));
634
					String orgName = rs.getString(19);
635
					if (rs.wasNull()) {
636
						orgName = null;
637
					}
638
					organization.setName(orgName);
639
					professor.setOrganization(organization);
640
					professor.setShareId(rs.getLong(20));
641
					return professor;
642
				} else {
643
					return null;
644
				}
645
			} finally {
646
				try {
647
					rs.close();
648
				} catch (Exception e1) {
649
				}
650
			}
651
		} finally {
652
			try {
653
				ps.close();
654
			} catch (Exception e2) {
655
			}
656
		}
657
	}
658

659
	public List<Professor> query(Connection con) throws SQLException {
660
		String sql = "SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.PROVINCE,P.ADDRESS,DEPARTMENT,ORG_ID,organization.NAME AS ONAME,"
661
				+ " TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME AS PNAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH,P.SHARE_ID "
662
				+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=organization.ID ORDER BY ONAME,P.ID";
663
		PreparedStatement ps = con.prepareStatement(sql);
664
		try {
665
			ResultSet rs = ps.executeQuery();
666
			try {
667
				List<Professor> professors = new ArrayList<Professor>();
668
				while (rs.next()) {
669
					Professor professor = new Professor();
670
					String office = rs.getString(1);
671
					if (rs.wasNull()) {
672
						office = null;
673
					}
674
					professor.setOffice(office);
675
					String subject = rs.getString(2);
676
					if (rs.wasNull()) {
677
						subject = null;
678
					}
679
					professor.setSubject(subject);
680
					String industry = rs.getString(3);
681
					if (rs.wasNull()) {
682
						industry = null;
683
					}
684
					professor.setIndustry(industry);
685
					String province = rs.getString(4);
686
					if (rs.wasNull()) {
687
						province = null;
688
					}
689
					professor.setProvince(province);
690
					String address = rs.getString(5);
691
					if (rs.wasNull()) {
692
						address = null;
693
					}
694
					professor.setAddress(address);
695
					professor.setDepartment(rs.getString(6));
696
					Organization organization = new Organization();
697
					String orgId = rs.getString(7);
698
					if (rs.wasNull()) {
699
						orgId = null;
700
					}
701
					organization.setId(orgId);
702
					String orgName = rs.getString(8);
703
					if (rs.wasNull()) {
704
						orgName = null;
705
					}
706
					organization.setName(orgName);
707
					professor.setOrganization(organization);
708
					professor.setTitle(rs.getString(9));
709
					Integer auth = rs.getInt(10);
710
					if (rs.wasNull()) {
711
						auth = null;
712
					}
713
					professor.setAuthentication(auth);
714
					professor.setAuthType(rs.getInt(11));
715
					professor.setAuthStatus(rs.getInt(12));
716
					professor.setId(rs.getString(13));
717
					professor.setName(rs.getString(14));
718
					String descp = rs.getString(15);
719
					if (rs.wasNull()) {
720
						descp = null;
721
					}
722
					professor.setDescp(descp);
723
					professor.setCreateTime(rs.getString(16));
724
					professor.setModifyTime(rs.getString(17));
725
					professor.setOrgAuth(rs.getString(18));
726
					professor.setShareId(rs.getLong(19));
727
					professors.add(professor);
728
				}
729
				return professors;
730
			} finally {
731
				try {
732
					rs.close();
733
				} catch (Exception e1) {
734
				}
735
			}
736
		} finally {
737
			try {
738
				ps.close();
739
			} catch (Exception e2) {
740
			}
741
		}
742
	}
743

744
	public PageQueryResult<EditProfessor> queryPage(Connection con, String orgId, String orgAuth, int pageSize, int pageNo) throws SQLException {
745
		int total = 0;
746
		PageQueryResult<EditProfessor> queryResult = new PageQueryResult<EditProfessor>();
747
		int index = 1;
748
		boolean hasOrgAuth = null != orgAuth;
749
		String sql = null;
750
		sql = " WHERE ORG_ID = ? ";
751
		if (hasOrgAuth) {
752
			sql = sql + " AND ORG_AUTH = ?";
753
		}
754
		String whereSql = sql;
755
		sql = "SELECT COUNT(1) FROM PROFESSOR";
756
		sql = sql + whereSql;
757
		PreparedStatement ps = con.prepareStatement(sql);
758
		try {
759
			ps.setString(index++, orgId);
760
			if (hasOrgAuth) {
761
				ps.setString(index++, orgAuth);
762
			}
763
			queryResult.setPageSize(pageSize);
764
			ResultSet rs = ps.executeQuery();
765
			try {
766
				rs.next();
767
				total = rs.getInt(1);
768
			} finally {
769
				try {
770
					rs.close();
771
				} catch (Exception e1) {
772
				}
773
			}
774
		} finally {
775
			try {
776
				ps.close();
777
			} catch (Exception e2) {
778
			}
779
		}
780
		queryResult.setTotal(total);
781
		if (0 == total) {
782
			queryResult.setPageNo(1);
783
			queryResult.setData(Collections.<EditProfessor> emptyList());
784
			return queryResult;
785
		}
786
		index = 1;
787
		boolean firstPage = (1 == pageNo);
788
		if (firstPage) {
789
			queryResult.setPageNo(1);
790
			sql = "SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH,SHARE_ID FROM PROFESSOR";
791
			sql = sql + whereSql;
792
			sql = sql + " ORDER BY AUTH_TYPE DESC,ID";
793
			sql = sql + " LIMIT " + pageSize;
794
		} else {
795
			int pageNum = total / pageSize;
796
			if (total % pageSize != 0) {
797
				++pageNum;
798
			}
799
			if (pageNo > pageNum) {
800
				pageNo = pageNum;
801
			}
802
			queryResult.setPageNo(pageNo);
803
			--pageNo;
804
			int offset = (pageNo * pageSize);
805
			sql = "SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH FROM PROFESSOR";
806
			sql = sql + whereSql;
807
			sql = sql + " ORDER BY AUTH_TYPE DESC,ID";
808
			sql = sql + " LIMIT " + pageSize + " OFFSET " + offset;
809
		}
810
		ps = con.prepareStatement(sql);
811
		try {
812
			ps.setString(index++, orgId);
813
			if (hasOrgAuth) {
814
				ps.setString(index++, orgAuth);
815
			}
816
			ResultSet rs = ps.executeQuery();
817
			try {
818
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
819
				queryResult.setData(professors);
820
				int size = 0;
821
				while ((size < pageSize) && rs.next()) {
822
					++size;
823
					EditProfessor professor = new EditProfessor();
824
					String office = rs.getString(1);
825
					if (rs.wasNull()) {
826
						office = null;
827
					}
828
					professor.setOffice(office);
829
					String depart = rs.getString(2);
830
					if (rs.wasNull()) {
831
						depart = null;
832
					}
833
					professor.setDepartment(depart);
834
					String title = rs.getString(3);
835
					if (rs.wasNull()) {
836
						title = null;
837
					}
838
					professor.setTitle(title);
839
					Integer auth = rs.getInt(4);
840
					if (rs.wasNull()) {
841
						auth = null;
842
					}
843
					professor.setAuthentication(auth);
844
					professor.setAuthType(rs.getInt(5));
845
					professor.setAuthStatus(rs.getInt(6));
846
					professor.setId(rs.getString(7));
847
					professor.setName(rs.getString(8));
848
					String address = rs.getString(9);
849
					if (rs.wasNull()) {
850
						address = null;
851
					}
852
					professor.setAddress(address);
853
					professor.setOrgAuth(rs.getString(10));
854
					professor.setShareId(rs.getLong(11));
855
					professors.add(professor);
856
				}
857
				return queryResult;
858
			} finally {
859
				try {
860
					rs.close();
861
				} catch (Exception e3) {
862
				}
863
			}
864
		} finally {
865
			try {
866
				ps.close();
867
			} catch (Exception e4) {
868
			}
869
		}
371
	}
870
	}
372
	
373
	public List<EditProfessor> queryByName(Connection con,String name,int total) throws SQLException{
374
        int index = 1;
375
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.ADDRESS,P.ORG_AUTH,ORGANIZATION.NAME,P.ORG_ID,P.SCORE_PERCENT,P.SHARE_ID "
376
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.NAME LIKE ? ORDER BY P.SCORE_PERCENT DESC LIMIT " + total;
377
        PreparedStatement ps = con.prepareStatement(sql);
378
        try{
379
            ps.setString(index++,name);
380
            ResultSet rs = ps.executeQuery();
381
            try{
382
                List<EditProfessor> editProfessors = new ArrayList<EditProfessor>();
383
                while(rs.next()){
384
                	EditProfessor professor =  new EditProfessor();
385
                	String office = rs.getString(1);
386
                	if(rs.wasNull()){
387
                		office = null;
388
                	}
389
                    professor.setOffice(office);
390
                    String depart = rs.getString(2);
391
                    if(rs.wasNull()){
392
                    	depart = null;
393
                	}
394
                    professor.setDepartment(depart);
395
                    String title = rs.getString(3);
396
                    if(rs.wasNull()){
397
                    	title = null;
398
                	}
399
                    professor.setTitle(title);
400
                    Integer auth = rs.getInt(4);
401
                    if(rs.wasNull()){
402
                    	auth = null;
403
                    }
404
                    professor.setAuthentication(auth);
405
                    professor.setAuthType(rs.getInt(5));
406
                    professor.setAuthStatus(rs.getInt(6));
407
                    professor.setId(rs.getString(7));
408
                    professor.setName(rs.getString(8));
409
                    String address = rs.getString(9);
410
                    if(rs.wasNull()){
411
                    	address = null;
412
                	}
413
                    professor.setAddress(address);
414
                    professor.setOrgAuth(rs.getString(10));
415
                    String orgName = rs.getString(11);
416
                    if(rs.wasNull()){
417
                    	orgName = null;
418
                    }
419
                    professor.setOrgName(orgName);
420
                    String orgId = rs.getString(12);
421
                    if(rs.wasNull()){
422
                    	orgId = null;
423
                    }
424
                    professor.setOrgId(orgId);
425
                    String scorePercent = rs.getString(13);
426
                    if(rs.wasNull()){
427
                    	scorePercent = null;
428
                    }
429
                    professor.setScorePercent(scorePercent);
430
                    professor.setShareId(rs.getLong(14));
431
                    editProfessors.add(professor);
432
                }
433
                return editProfessors;
434
            }finally{
435
                try{rs.close();}catch(Exception e1){}
436
            }
437
        }finally{
438
            try{ps.close();}catch(Exception e2){}
439
        }
440
    }
441
	
442
	/**
443
	 * 查询专家基本信息+星级+咨询次数的接口
444
	 * @param con
445
	 * @param id 专家ID
446
	 * @return 返回专家基本信息+星级+咨询次数
447
	 * @throws SQLException
448
	 */
449
	public EditProfessor queryEditBaseInfo(Connection con, String id) throws SQLException {
871

872
	public List<EditProfessor> queryByOrg(Connection con, String orgId, String orgAuth) throws SQLException {
450
		int index = 1;
873
		int index = 1;
451
        String sql = "SELECT P.OFFICE,P.DEPARTMENT,P.TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,"
452
        		+ " P.ID,P.NAME,P.ADDRESS,P.STAR_LEVEL,P.CONSULT_COUNT,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID "
453
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
454
        PreparedStatement ps = con.prepareStatement(sql);
455
        try{
456
            ps.setString(index++,id);
457
            ResultSet rs = ps.executeQuery();
458
            try{
459
                if(rs.next()){
460
                	EditProfessor professor = new EditProfessor();
461
                	String office = rs.getString(1);
462
                	if(rs.wasNull()){
463
                		office = null;
464
                	}
465
                    professor.setOffice(office);
466
                    String depart = rs.getString(2);
467
                	if(rs.wasNull()){
468
                		depart = null;
469
                	}
470
                    professor.setDepartment(depart);
471
                    String title = rs.getString(3);
472
                	if(rs.wasNull()){
473
                		title = null;
474
                	}
475
                    professor.setTitle(title);
476
                    Integer auth = rs.getInt(4);
477
                    if(rs.wasNull()){
478
                    	auth = null;
479
                    }
480
                    professor.setAuthentication(auth);
481
                    professor.setAuthType(rs.getInt(5));
482
                    professor.setAuthStatus(rs.getInt(6));
483
                    professor.setId(rs.getString(7));
484
                    professor.setName(rs.getString(8));
485
                    String address = rs.getString(9);
486
                	if(rs.wasNull()){
487
                		address = null;
488
                	}
489
                    professor.setAddress(address);
490
                    professor.setStarLevel(rs.getBigDecimal(10));
491
                    professor.setConsultCount(rs.getInt(11));
492
                    professor.setOrgAuth(rs.getString(12));
493
                    String orgName = rs.getString(13);
494
                    if(rs.wasNull()){
495
                    	orgName = null;
496
                    }
497
                    professor.setOrgName(orgName);
498
                    professor.setShareId(rs.getLong(14));
499
                    return professor;
500
                }else{
501
                    return null;
502
                }
503
            }finally{
504
                try{rs.close();}catch(Exception e1){}
505
            }
506
        }finally{
507
            try{ps.close();}catch(Exception e2){}
508
        }
874
		boolean hasOrgAuth = null != orgAuth;
875
		StringBuilder sql = new StringBuilder();
876
		sql.append("SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH,SHARE_ID FROM PROFESSOR");
877
		sql.append(" WHERE ORG_ID = ?");
878
		if (hasOrgAuth) {
879
			sql.append(" AND ORG_AUTH = ?");
880
		}
881
		sql.append(" ORDER BY AUTH_TYPE DESC,ID");
882
		PreparedStatement ps = con.prepareStatement(sql.toString());
883
		try {
884
			ps.setString(index++, orgId);
885
			if (hasOrgAuth) {
886
				ps.setString(index++, orgAuth);
887
			}
888
			ResultSet rs = ps.executeQuery();
889
			try {
890
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
891
				while (rs.next()) {
892
					EditProfessor professor = new EditProfessor();
893
					String office = rs.getString(1);
894
					if (rs.wasNull()) {
895
						office = null;
896
					}
897
					professor.setOffice(office);
898
					String depart = rs.getString(2);
899
					if (rs.wasNull()) {
900
						depart = null;
901
					}
902
					professor.setDepartment(depart);
903
					String title = rs.getString(3);
904
					if (rs.wasNull()) {
905
						title = null;
906
					}
907
					professor.setTitle(title);
908
					Integer auth = rs.getInt(4);
909
					if (rs.wasNull()) {
910
						auth = null;
911
					}
912
					professor.setAuthentication(auth);
913
					professor.setAuthType(rs.getInt(5));
914
					professor.setAuthStatus(rs.getInt(6));
915
					professor.setId(rs.getString(7));
916
					professor.setName(rs.getString(8));
917
					String address = rs.getString(9);
918
					if (rs.wasNull()) {
919
						address = null;
920
					}
921
					professor.setAddress(address);
922
					professor.setOrgAuth(rs.getString(10));
923
					professor.setShareId(rs.getLong(11));
924
					professors.add(professor);
925
				}
926
				return professors;
927
			} finally {
928
				try {
929
					rs.close();
930
				} catch (Exception e1) {
931
				}
932
			}
933
		} finally {
934
			try {
935
				ps.close();
936
			} catch (Exception e2) {
937
			}
938
		}
509
	}
939
	}
510
	
511
	@SelectOne
512
	@Nullable
513
	public abstract Professor queryOne(Connection con, String id) throws SQLException;
514
	
515
	public Professor query(Connection con, String id) throws SQLException{
516
        int index = 1;
517
        String sql = "SELECT P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,ORG_ID,P.TITLE,AUTHENTICATION,AUTH_TYPE,"
518
        		+ "P.AUTH_STATUS,P.ID,P.NAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.PHONE,P.EMAIL,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID "
519
        		+ "FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID = ORGANIZATION.ID WHERE P.ID = ?";
520
        PreparedStatement ps = con.prepareStatement(sql);
521
        try{
522
            ps.setString(index++,id);
523
            ResultSet rs = ps.executeQuery();
524
            try{
525
                if(rs.next()){
526
                    Professor professor = new Professor();
527
                    String office = rs.getString(1);
528
                    if(rs.wasNull()){
529
                    	office = null;
530
                    }
531
                    professor.setOffice(office);
532
                    String subject = rs.getString(2);
533
                    if(rs.wasNull()){
534
                    	subject = null;
535
                    }
536
                    professor.setSubject(subject);
537
                    String industry = rs.getString(3);
538
                    if(rs.wasNull()){
539
                    	industry = null;
540
                    }
541
                    professor.setIndustry(industry);
542
                    String address = rs.getString(4);
543
                    if(rs.wasNull()){
544
                    	address = null;
545
                    }
546
                    professor.setAddress(address);
547
                    String department = rs.getString(5);
548
                    if(rs.wasNull()){
549
                    	department = null;
550
                    }
551
                    professor.setDepartment(department);
552
                    Organization organization = new Organization();
553
                    String orgId = rs.getString(6);
554
                    if(rs.wasNull()){
555
                    	orgId = null;
556
                    }
557
                    organization.setId(orgId);
558
                    String title = rs.getString(7);
559
                    if(rs.wasNull()){
560
                    	title = null;
561
                    }
562
                    professor.setTitle(title);
563
                    Integer auth = rs.getInt(8);
564
                    if(rs.wasNull()){
565
                    	auth = null;
566
                    }
567
                    professor.setAuthentication(auth);
568
                    professor.setAuthType(rs.getInt(9));
569
                    professor.setAuthStatus(rs.getInt(10));
570
                    professor.setId(rs.getString(11));
571
                    professor.setName(rs.getString(12));
572
                    String descp = rs.getString(13);
573
                    if(rs.wasNull()){
574
                    	descp = null;
575
                    }
576
                    professor.setDescp(descp);
577
                    professor.setCreateTime(rs.getString(14));
578
                    professor.setModifyTime(rs.getString(15));
579
                    String phone = rs.getString(16);
580
                    if(rs.wasNull()){
581
                    	phone = null;
582
                    }
583
                    professor.setPhone(phone);
584
                    String email = rs.getString(17);
585
                    if(rs.wasNull()){
586
                    	email = null;
587
                    }
588
                    professor.setEmail(email);
589
                    professor.setOrgAuth(rs.getString(18));
590
                    String orgName = rs.getString(19);
591
                    if(rs.wasNull()){
592
                    	orgName = null;
593
                    }
594
                    organization.setName(orgName);
595
                    professor.setOrganization(organization);
596
                    professor.setShareId(rs.getLong(20));
597
                    return professor;
598
                }else{
599
                    return null;
600
                }
601
            }finally{
602
                try{rs.close();}catch(Exception e1){}
603
            }
604
        }finally{
605
            try{ps.close();}catch(Exception e2){}
606
        }
607
    }
608

940

609
	public List<Professor> query(Connection con) throws SQLException{
610
        String sql = "SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.PROVINCE,P.ADDRESS,DEPARTMENT,ORG_ID,organization.NAME AS ONAME,"
611
        		+ " TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME AS PNAME,P.DESCP,P.CREATE_TIME,P.MODIFY_TIME,P.ORG_AUTH,P.SHARE_ID "
612
        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=organization.ID ORDER BY ONAME,P.ID";
613
        PreparedStatement ps = con.prepareStatement(sql);
614
        try{
615
            ResultSet rs = ps.executeQuery();
616
            try{
617
                List<Professor> professors = new ArrayList<Professor>();
618
                while(rs.next()){
619
                    Professor professor =  new Professor();
620
                    String office = rs.getString(1);
621
                    if(rs.wasNull()){
622
                    	office = null;
623
                    }
624
                    professor.setOffice(office);
625
                    String subject = rs.getString(2);
626
                    if(rs.wasNull()){
627
                    	subject = null;
628
                    }
629
                    professor.setSubject(subject);
630
                    String industry = rs.getString(3);
631
                    if(rs.wasNull()){
632
                    	industry = null;
633
                    }
634
                    professor.setIndustry(industry);
635
                    String province = rs.getString(4);
636
                    if(rs.wasNull()){
637
                    	province = null;
638
                    }
639
                    professor.setProvince(province);
640
                    String address = rs.getString(5);
641
                    if(rs.wasNull()){
642
                    	address = null;
643
                    }
644
                    professor.setAddress(address);
645
                    professor.setDepartment(rs.getString(6));
646
                    Organization organization = new Organization();
647
                    String orgId = rs.getString(7);
648
                    if(rs.wasNull()){
649
                    	orgId = null;
650
                    }
651
                    organization.setId(orgId);
652
                    String orgName = rs.getString(8);
653
                    if(rs.wasNull()){
654
                    	orgName = null;
655
                    }
656
                    organization.setName(orgName);
657
                    professor.setOrganization(organization);
658
                    professor.setTitle(rs.getString(9));
659
                    Integer auth = rs.getInt(10);
660
                    if(rs.wasNull()){
661
                    	auth = null;
662
                    }
663
                    professor.setAuthentication(auth);
664
                    professor.setAuthType(rs.getInt(11));
665
                    professor.setAuthStatus(rs.getInt(12));
666
                    professor.setId(rs.getString(13));
667
                    professor.setName(rs.getString(14));
668
                    String descp = rs.getString(15);
669
                    if(rs.wasNull()){
670
                    	descp = null;
671
                    }
672
                    professor.setDescp(descp);
673
                    professor.setCreateTime(rs.getString(16));
674
                    professor.setModifyTime(rs.getString(17));
675
                    professor.setOrgAuth(rs.getString(18));
676
                    professor.setShareId(rs.getLong(19));
677
                    professors.add(professor);
678
                }
679
                return professors;
680
            }finally{
681
                try{rs.close();}catch(Exception e1){}
682
            }
683
        }finally{
684
            try{ps.close();}catch(Exception e2){}
685
        }
686
    }
687
	
688
	public PageQueryResult<EditProfessor> queryPage(Connection con,String orgId,String orgAuth,int pageSize,int pageNo) throws SQLException{
689
        int total = 0;
690
        PageQueryResult<EditProfessor> queryResult = new PageQueryResult<EditProfessor>();
691
        int index = 1;
692
        boolean hasOrgAuth = null != orgAuth;
693
        String sql = null;
694
        sql = " WHERE ORG_ID = ? ";
695
        if(hasOrgAuth){
696
            sql = sql + " AND ORG_AUTH = ?";
697
        }
698
        String whereSql = sql;
699
        sql = "SELECT COUNT(1) FROM PROFESSOR";
700
        sql = sql + whereSql;
701
        PreparedStatement ps = con.prepareStatement(sql);
702
        try{
703
            ps.setString(index++,orgId);
704
            if(hasOrgAuth){
705
            	ps.setString(index++,orgAuth);
706
            }
707
            queryResult.setPageSize(pageSize);
708
            ResultSet rs = ps.executeQuery();
709
            try{
710
                rs.next();
711
                total = rs.getInt(1);
712
            }finally{
713
                try{rs.close();}catch(Exception e1){}
714
            }
715
        }finally{
716
            try{ps.close();}catch(Exception e2){}
717
        }
718
        queryResult.setTotal(total);
719
        if(0== total){
720
            queryResult.setPageNo(1);
721
            queryResult.setData(Collections.<EditProfessor>emptyList());
722
            return queryResult;
723
        }
724
        index = 1;
725
        boolean firstPage = (1 == pageNo);
726
        if(firstPage){
727
            queryResult.setPageNo(1);
728
            sql = "SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH,SHARE_ID FROM PROFESSOR";
729
            sql = sql + whereSql;
730
            sql = sql + " ORDER BY AUTH_TYPE DESC,ID";
731
            sql = sql + " LIMIT " + pageSize;
732
        }else{
733
            int pageNum = total / pageSize;
734
            if(total % pageSize != 0){
735
                ++pageNum;
736
            }
737
            if(pageNo > pageNum){
738
                pageNo = pageNum;
739
            }
740
            queryResult.setPageNo(pageNo);
741
            --pageNo;
742
            int offset = (pageNo * pageSize);
743
            sql = "SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH FROM PROFESSOR";
744
            sql = sql + whereSql;
745
            sql = sql + " ORDER BY AUTH_TYPE DESC,ID";
746
            sql = sql + " LIMIT " + pageSize+ " OFFSET " + offset;
747
        }
748
        ps = con.prepareStatement(sql);
749
        try{
750
            ps.setString(index++,orgId);
751
            if(hasOrgAuth){
752
            	ps.setString(index++,orgAuth);
753
            }
754
            ResultSet rs = ps.executeQuery();
755
            try{
756
                List<EditProfessor> professors = new ArrayList<EditProfessor>();
757
                queryResult.setData(professors);
758
                int size = 0;
759
                while((size<pageSize) && rs.next()){
760
                    ++size;
761
                    EditProfessor professor =  new EditProfessor();
762
                    String office = rs.getString(1);
763
                	if(rs.wasNull()){
764
                		office = null;
765
                	}
766
                    professor.setOffice(office);
767
                    String depart = rs.getString(2);
768
                    if(rs.wasNull()){
769
                    	depart = null;
770
                	}
771
                    professor.setDepartment(depart);
772
                    String title = rs.getString(3);
773
                    if(rs.wasNull()){
774
                    	title = null;
775
                	}
776
                    professor.setTitle(title);
777
                    Integer auth = rs.getInt(4);
778
                    if(rs.wasNull()){
779
                    	auth = null;
780
                    }
781
                    professor.setAuthentication(auth);
782
                    professor.setAuthType(rs.getInt(5));
783
                    professor.setAuthStatus(rs.getInt(6));
784
                    professor.setId(rs.getString(7));
785
                    professor.setName(rs.getString(8));
786
                    String address = rs.getString(9);
787
                    if(rs.wasNull()){
788
                    	address = null;
789
                	}
790
                    professor.setAddress(address);
791
                    professor.setOrgAuth(rs.getString(10));
792
                    professor.setShareId(rs.getLong(11));
793
                    professors.add(professor);
794
                }
795
                return queryResult;
796
            }finally{
797
                try{rs.close();}catch(Exception e3){}
798
            }
799
        }finally{
800
            try{ps.close();}catch(Exception e4){}
801
        }
802
    }
803
	
804
	public List<EditProfessor> queryByOrg(Connection con,String orgId,String orgAuth) throws SQLException{
805
        int index = 1;
806
        boolean hasOrgAuth = null != orgAuth;
807
        StringBuilder sql = new StringBuilder();
808
        sql.append("SELECT OFFICE,DEPARTMENT,TITLE,AUTHENTICATION,AUTH_TYPE,AUTH_STATUS,ID,NAME,ADDRESS,ORG_AUTH,SHARE_ID FROM PROFESSOR");
809
        sql.append(" WHERE ORG_ID = ?");
810
        if(hasOrgAuth){
811
            sql.append(" AND ORG_AUTH = ?");
812
        }
813
        sql.append(" ORDER BY AUTH_TYPE DESC,ID");
814
        PreparedStatement ps = con.prepareStatement(sql.toString());
815
        try{
816
            ps.setString(index++,orgId);
817
            if(hasOrgAuth){
818
                ps.setString(index++,orgAuth);
819
            }
820
            ResultSet rs = ps.executeQuery();
821
            try{
822
                List<EditProfessor> professors = new ArrayList<EditProfessor>();
823
                while(rs.next()){
824
                	EditProfessor professor = new EditProfessor();
825
                	String office = rs.getString(1);
826
                	if(rs.wasNull()){
827
                		office = null;
828
                	}
829
                    professor.setOffice(office);
830
                    String depart = rs.getString(2);
831
                    if(rs.wasNull()){
832
                    	depart = null;
833
                	}
834
                    professor.setDepartment(depart);
835
                    String title = rs.getString(3);
836
                    if(rs.wasNull()){
837
                    	title = null;
838
                	}
839
                    professor.setTitle(title);
840
                    Integer auth = rs.getInt(4);
841
                    if(rs.wasNull()){
842
                    	auth = null;
843
                    }
844
                    professor.setAuthentication(auth);
845
                    professor.setAuthType(rs.getInt(5));
846
                    professor.setAuthStatus(rs.getInt(6));
847
                    professor.setId(rs.getString(7));
848
                    professor.setName(rs.getString(8));
849
                    String address = rs.getString(9);
850
                    if(rs.wasNull()){
851
                    	address = null;
852
                	}
853
                    professor.setAddress(address);
854
                    professor.setOrgAuth(rs.getString(10));
855
                    professor.setShareId(rs.getLong(11));
856
                    professors.add(professor);
857
                }
858
                return professors;
859
            }finally{
860
                try{rs.close();}catch(Exception e1){}
861
            }
862
        }finally{
863
            try{ps.close();}catch(Exception e2){}
864
        }
865
    }
866
	
867
	/**
941
	/**
868
	 * 查询所有专家的咨询星级和咨询完成次数
942
	 * 查询所有专家的咨询星级和咨询完成次数
943
	 * 
869
	 * @param con
944
	 * @param con
870
	 * @return
945
	 * @return
871
	 * @throws SQLException
946
	 * @throws SQLException
872
	 */
947
	 */
873
	public List<Professor> queryStar(Connection con) throws SQLException{
948
	public List<Professor> queryStar(Connection con) throws SQLException {
874
		String sql = "SELECT ID,STAR_LEVEL,CONSULT_COUNT FROM PROFESSOR ";
949
		String sql = "SELECT ID,STAR_LEVEL,CONSULT_COUNT FROM PROFESSOR ";
875
        PreparedStatement ps = con.prepareStatement(sql);
876
        try{
877
            ResultSet rs = ps.executeQuery();
878
            try{
879
                List<Professor> professors = new ArrayList<Professor>();
880
                while(rs.next()){
881
                    Professor professor =  new Professor();
882
                    professor.setId(rs.getString(1));
883
                    professor.setStarLevel(rs.getBigDecimal(2));
884
                    professor.setConsultCount(rs.getInt(3));
885
                    professors.add(professor);
886
                }
887
                return professors;
888
            }finally{
889
                try{rs.close();}catch(Exception e1){}
890
            }
891
        }finally{
892
            try{ps.close();}catch(Exception e2){}
893
        }
950
		PreparedStatement ps = con.prepareStatement(sql);
951
		try {
952
			ResultSet rs = ps.executeQuery();
953
			try {
954
				List<Professor> professors = new ArrayList<Professor>();
955
				while (rs.next()) {
956
					Professor professor = new Professor();
957
					professor.setId(rs.getString(1));
958
					professor.setStarLevel(rs.getBigDecimal(2));
959
					professor.setConsultCount(rs.getInt(3));
960
					professors.add(professor);
961
				}
962
				return professors;
963
			} finally {
964
				try {
965
					rs.close();
966
				} catch (Exception e1) {
967
				}
968
			}
969
		} finally {
970
			try {
971
				ps.close();
972
			} catch (Exception e2) {
973
			}
974
		}
894
	}
975
	}
895

976

896
	/**
977
	/**
897
	 * 查询所有专家咨询星级的最大值
978
	 * 查询所有专家咨询星级的最大值
979
	 * 
898
	 * @param con
980
	 * @param con
899
	 * @return
981
	 * @return
900
	 * @throws SQLException
982
	 * @throws SQLException
901
	 */
983
	 */
902
	@QueryVal
984
	@QueryVal
903
	@Column(handlerClass=BigDecimalHandler.class,value={"MAX(STAR_LEVEL)"})
985
	@Column(handlerClass = BigDecimalHandler.class, value = { "MAX(STAR_LEVEL)" })
904
	@From(Professor.class)
986
	@From(Professor.class)
905
	public abstract BigDecimal queryBigStar(Connection con)throws SQLException, JfwBaseException;
906
	
987
	public abstract BigDecimal queryBigStar(Connection con) throws SQLException, JfwBaseException;
988

907
	/**
989
	/**
908
	 * 查询所有专家咨询星级的最小值
990
	 * 查询所有专家咨询星级的最小值
991
	 * 
909
	 * @param con
992
	 * @param con
910
	 * @return
993
	 * @return
911
	 * @throws SQLException
994
	 * @throws SQLException
912
	 */
995
	 */
913
	@QueryVal
996
	@QueryVal
914
	@Column(handlerClass=BigDecimalHandler.class,value={"MIN(STAR_LEVEL)"})
997
	@Column(handlerClass = BigDecimalHandler.class, value = { "MIN(STAR_LEVEL)" })
915
	@From(Professor.class)
998
	@From(Professor.class)
916
	public abstract BigDecimal querySmallStar(Connection con)throws SQLException, JfwBaseException;
917
	
999
	public abstract BigDecimal querySmallStar(Connection con) throws SQLException, JfwBaseException;
1000

918
	/**
1001
	/**
919
	 * 查询所有专家咨询次数的最大值
1002
	 * 查询所有专家咨询次数的最大值
1003
	 * 
920
	 * @param con
1004
	 * @param con
921
	 * @return
1005
	 * @return
922
	 * @throws SQLException
1006
	 * @throws SQLException
923
	 */
1007
	 */
924
	@QueryVal
1008
	@QueryVal
925
	@Column(handlerClass=BigDecimalHandler.class,value={"MAX(CONSULT_COUNT)"})
1009
	@Column(handlerClass = BigDecimalHandler.class, value = { "MAX(CONSULT_COUNT)" })
926
	@From(Professor.class)
1010
	@From(Professor.class)
927
	public abstract BigDecimal queryBigConsult(Connection con)throws SQLException, JfwBaseException;
928
	
1011
	public abstract BigDecimal queryBigConsult(Connection con) throws SQLException, JfwBaseException;
1012

929
	/**
1013
	/**
930
	 * 查询所有专家咨询次数的最小值
1014
	 * 查询所有专家咨询次数的最小值
1015
	 * 
931
	 * @param con
1016
	 * @param con
932
	 * @return
1017
	 * @return
933
	 * @throws SQLException
1018
	 * @throws SQLException
934
	 */
1019
	 */
935
	@QueryVal
1020
	@QueryVal
936
	@Column(handlerClass=BigDecimalHandler.class,value={"MIN(CONSULT_COUNT)"})
1021
	@Column(handlerClass = BigDecimalHandler.class, value = { "MIN(CONSULT_COUNT)" })
937
	@From(Professor.class)
1022
	@From(Professor.class)
938
	public abstract BigDecimal querySmallConsult(Connection con)throws SQLException, JfwBaseException;
939
	
1023
	public abstract BigDecimal querySmallConsult(Connection con) throws SQLException, JfwBaseException;
1024

940
	@Nullable
1025
	@Nullable
941
	@QueryOne
1026
	@QueryOne
942
	@From(Professor.class)
1027
	@From(Professor.class)
957

1042

958
	/**
1043
	/**
959
	 * 首页搜索热门专家
1044
	 * 首页搜索热门专家
1045
	 * 
960
	 * @param con
1046
	 * @param con
961
	 * @return 返回8个热门专家,按咨询星级排序
1047
	 * @return 返回8个热门专家,按咨询星级排序
962
	 * @throws SQLException
1048
	 * @throws SQLException
1001
			queryResult.setPageNo(1);
1087
			queryResult.setPageNo(1);
1002
			sql = new StringBuilder();
1088
			sql = new StringBuilder();
1003
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1089
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1004
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1090
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1005
			if (whereSql.length() > 0) {
1091
			if (whereSql.length() > 0) {
1006
				sql.append(whereSql);
1092
				sql.append(whereSql);
1007
			}
1093
			}
1020
			int offset = (pageNo * pageSize);
1106
			int offset = (pageNo * pageSize);
1021
			sql = new StringBuilder();
1107
			sql = new StringBuilder();
1022
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1108
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1023
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1109
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1024
			if (whereSql.length() > 0) {
1110
			if (whereSql.length() > 0) {
1025
				sql.append(whereSql);
1111
				sql.append(whereSql);
1026
			}
1112
			}
1034
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
1120
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
1035
				queryResult.setData(professors);
1121
				queryResult.setData(professors);
1036
				while (rs.next()) {
1122
				while (rs.next()) {
1037
					EditProfessor professor =  new EditProfessor();
1038
                    String office = rs.getString(1);
1039
                    if(rs.wasNull()){
1040
                    	office = null;
1041
                    }
1042
                    professor.setOffice(office);
1043
                    String address = rs.getString(2);
1044
                    if(rs.wasNull()){
1045
                    	address = null;
1046
                    }
1047
                    professor.setAddress(address);
1048
                    String title = rs.getString(3);
1049
                    if(rs.wasNull()){
1050
                    	title = null;
1051
                    }
1052
                    professor.setTitle(title);
1053
                    Integer auth = rs.getInt(4);
1054
                    if(rs.wasNull()){
1055
                    	auth = null;
1056
                    }
1057
                    professor.setAuthentication(auth);
1058
                    professor.setAuthType(rs.getInt(5));
1059
                    professor.setAuthStatus(rs.getInt(6));
1060
                    professor.setId(rs.getString(7));
1061
                    professor.setName(rs.getString(8));
1062
                    professor.setOrgId(rs.getString(9));
1063
                    professor.setOrgAuth(rs.getString(10));
1064
                    String orgName = rs.getString(11);
1065
                    if(rs.wasNull()){
1066
                    	orgName = null;
1067
                    }
1068
                    professor.setOrgName(orgName);
1069
                    professor.setShareId(rs.getLong(12));
1070
                    professors.add(professor);
1123
					EditProfessor professor = new EditProfessor();
1124
					String office = rs.getString(1);
1125
					if (rs.wasNull()) {
1126
						office = null;
1127
					}
1128
					professor.setOffice(office);
1129
					String address = rs.getString(2);
1130
					if (rs.wasNull()) {
1131
						address = null;
1132
					}
1133
					professor.setAddress(address);
1134
					String title = rs.getString(3);
1135
					if (rs.wasNull()) {
1136
						title = null;
1137
					}
1138
					professor.setTitle(title);
1139
					Integer auth = rs.getInt(4);
1140
					if (rs.wasNull()) {
1141
						auth = null;
1142
					}
1143
					professor.setAuthentication(auth);
1144
					professor.setAuthType(rs.getInt(5));
1145
					professor.setAuthStatus(rs.getInt(6));
1146
					professor.setId(rs.getString(7));
1147
					professor.setName(rs.getString(8));
1148
					professor.setOrgId(rs.getString(9));
1149
					professor.setOrgAuth(rs.getString(10));
1150
					String orgName = rs.getString(11);
1151
					if (rs.wasNull()) {
1152
						orgName = null;
1153
					}
1154
					professor.setOrgName(orgName);
1155
					professor.setShareId(rs.getLong(12));
1156
					professors.add(professor);
1071
				}
1157
				}
1072
				return queryResult;
1158
				return queryResult;
1073
			} finally {
1159
			} finally {
1083
			}
1169
			}
1084
		}
1170
		}
1085
	}
1171
	}
1086
	
1172

1087
	/**
1173
	/**
1088
	 * APP专家搜索列表分页多条件查询
1174
	 * APP专家搜索列表分页多条件查询
1175
	 * 
1089
	 * @param con
1176
	 * @param con
1090
	 * @param key
1177
	 * @param key
1091
	 * @param subject 学术领域
1092
	 * @param industry 应用行业
1093
	 * @param province 所在省份
1094
	 * @param address 所在城市
1095
	 * @param authentication 是否认证
1096
	 * @param pageSize 
1178
	 * @param subject
1179
	 *            学术领域
1180
	 * @param industry
1181
	 *            应用行业
1182
	 * @param province
1183
	 *            所在省份
1184
	 * @param address
1185
	 *            所在城市
1186
	 * @param authentication
1187
	 *            是否认证
1188
	 * @param pageSize
1097
	 * @param pageNo
1189
	 * @param pageNo
1098
	 * @return 按搜索条件返回专家列表  按咨询星级排序
1190
	 * @return 按搜索条件返回专家列表 按咨询星级排序
1099
	 * @throws SQLException
1191
	 * @throws SQLException
1100
	 */
1192
	 */
1101
	public PageQueryResult<EditProfessor> queryAPP(Connection con, @Nullable String key, String subject, String industry, 
1102
			String province, String address, Integer authType, int pageSize, int pageNo) throws SQLException {
1193
	public PageQueryResult<EditProfessor> queryAPP(Connection con, @Nullable String key, String subject, String industry, String province, String address,
1194
			Integer authType, int pageSize, int pageNo) throws SQLException {
1103
		PageQueryResult<EditProfessor> queryResult = new PageQueryResult<EditProfessor>();
1195
		PageQueryResult<EditProfessor> queryResult = new PageQueryResult<EditProfessor>();
1104
		StringBuilder sql = new StringBuilder();
1196
		StringBuilder sql = new StringBuilder();
1105
		boolean hasKey = null != key;
1197
		boolean hasKey = null != key;
1106
		if (hasKey) {
1198
		if (hasKey) {
1107
			sql.append(" WHERE (( P.ID IN (SELECT PROFESSOR_ID FROM RESEARCH_AREA WHERE CAPTION LIKE ?)) "
1199
			sql.append(" WHERE (( P.ID IN (SELECT PROFESSOR_ID FROM RESEARCH_AREA WHERE CAPTION LIKE ?)) "
1108
				+ " OR (ORG_ID IN(SELECT ORGANIZATION.ID FROM ORGANIZATION WHERE ORGANIZATION.NAME LIKE ?)) "
1109
				+ " OR ( P.NAME LIKE ?) OR (P.SUBJECT LIKE ?) OR (P.INDUSTRY LIKE ?) OR (P.PROVINCE LIKE ?) OR (P.ADDRESS LIKE ?) "
1110
				+ " OR P.ID IN (SELECT PROFESSOR_ID FROM RESOURCE WHERE RESOURCE_NAME LIKE ?) "
1111
				+ " OR P.ID IN (SELECT PROFESSOR_ID FROM ARTICLE WHERE ARTICLE_TITLE LIKE ?) "
1112
				+ " OR (P.ID IN (SELECT PROFESSOR_ID FROM PATENT WHERE NAME LIKE ?)) OR (P.DEPARTMENT LIKE ?))");
1200
					+ " OR (ORG_ID IN(SELECT ORGANIZATION.ID FROM ORGANIZATION WHERE ORGANIZATION.NAME LIKE ?)) "
1201
					+ " OR ( P.NAME LIKE ?) OR (P.SUBJECT LIKE ?) OR (P.INDUSTRY LIKE ?) OR (P.PROVINCE LIKE ?) OR (P.ADDRESS LIKE ?) "
1202
					+ " OR P.ID IN (SELECT PROFESSOR_ID FROM RESOURCE WHERE RESOURCE_NAME LIKE ?) "
1203
					+ " OR P.ID IN (SELECT PROFESSOR_ID FROM ARTICLE WHERE ARTICLE_TITLE LIKE ?) "
1204
					+ " OR (P.ID IN (SELECT PROFESSOR_ID FROM PATENT WHERE NAME LIKE ?)) OR (P.DEPARTMENT LIKE ?))");
1113
		}
1205
		}
1114
		boolean hasSubject = null != subject;
1206
		boolean hasSubject = null != subject;
1115
		boolean hasIndustry = null != industry;
1207
		boolean hasIndustry = null != industry;
1197
			queryResult.setPageNo(1);
1289
			queryResult.setPageNo(1);
1198
			sql = new StringBuilder();
1290
			sql = new StringBuilder();
1199
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1291
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1200
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1292
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1201
			if (whereSql.length() > 0) {
1293
			if (whereSql.length() > 0) {
1202
				sql.append(whereSql);
1294
				sql.append(whereSql);
1203
			}
1295
			}
1216
			int offset = (pageNo * pageSize);
1308
			int offset = (pageNo * pageSize);
1217
			sql = new StringBuilder();
1309
			sql = new StringBuilder();
1218
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1310
			sql.append("SELECT OFFICE,P.ADDRESS,TITLE,AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,ORG_ID,P.ORG_AUTH,ORGANIZATION.NAME,P.SHARE_ID"
1219
	        		+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1311
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON P.ORG_ID=ORGANIZATION.ID ");
1220
			if (whereSql.length() > 0) {
1312
			if (whereSql.length() > 0) {
1221
				sql.append(whereSql);
1313
				sql.append(whereSql);
1222
			}
1314
			}
1258
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
1350
				List<EditProfessor> professors = new ArrayList<EditProfessor>();
1259
				queryResult.setData(professors);
1351
				queryResult.setData(professors);
1260
				while (rs.next()) {
1352
				while (rs.next()) {
1261
					EditProfessor professor =  new EditProfessor();
1262
                    String office = rs.getString(1);
1263
                    if(rs.wasNull()){
1264
                    	office = null;
1265
                    }
1266
                    professor.setOffice(office);
1267
                    String addr = rs.getString(2);
1268
                    if(rs.wasNull()){
1269
                    	addr = null;
1270
                    }
1271
                    professor.setAddress(addr);
1272
                    String title = rs.getString(3);
1273
                    if(rs.wasNull()){
1274
                    	title = null;
1275
                    }
1276
                    professor.setTitle(title);
1277
                    Integer auth = rs.getInt(4);
1278
                    if(rs.wasNull()){
1279
                    	auth = null;
1280
                    }
1281
                    professor.setAuthentication(auth);
1282
                    professor.setAuthType(rs.getInt(5));
1283
                    professor.setAuthStatus(rs.getInt(6));
1284
                    professor.setId(rs.getString(7));
1285
                    professor.setName(rs.getString(8));
1286
                    professor.setOrgId(rs.getString(9));
1287
                    professor.setOrgAuth(rs.getString(10));
1288
                    String orgName = rs.getString(11);
1289
                    if(rs.wasNull()){
1290
                    	orgName = null;
1291
                    }
1292
                    professor.setOrgName(orgName);
1293
                    professor.setShareId(rs.getLong(12));
1294
                    professors.add(professor);
1353
					EditProfessor professor = new EditProfessor();
1354
					String office = rs.getString(1);
1355
					if (rs.wasNull()) {
1356
						office = null;
1357
					}
1358
					professor.setOffice(office);
1359
					String addr = rs.getString(2);
1360
					if (rs.wasNull()) {
1361
						addr = null;
1362
					}
1363
					professor.setAddress(addr);
1364
					String title = rs.getString(3);
1365
					if (rs.wasNull()) {
1366
						title = null;
1367
					}
1368
					professor.setTitle(title);
1369
					Integer auth = rs.getInt(4);
1370
					if (rs.wasNull()) {
1371
						auth = null;
1372
					}
1373
					professor.setAuthentication(auth);
1374
					professor.setAuthType(rs.getInt(5));
1375
					professor.setAuthStatus(rs.getInt(6));
1376
					professor.setId(rs.getString(7));
1377
					professor.setName(rs.getString(8));
1378
					professor.setOrgId(rs.getString(9));
1379
					professor.setOrgAuth(rs.getString(10));
1380
					String orgName = rs.getString(11);
1381
					if (rs.wasNull()) {
1382
						orgName = null;
1383
					}
1384
					professor.setOrgName(orgName);
1385
					professor.setShareId(rs.getLong(12));
1386
					professors.add(professor);
1295
				}
1387
				}
1296
				return queryResult;
1388
				return queryResult;
1297
			} finally {
1389
			} finally {
1307
			}
1399
			}
1308
		}
1400
		}
1309
	}
1401
	}
1310
	
1402

1311
	/**
1403
	/**
1312
	 * 分页查询专家基础信息,多条件查询专家列表。
1404
	 * 分页查询专家基础信息,多条件查询专家列表。
1405
	 * 
1313
	 * @param con
1406
	 * @param con
1314
	 * @param key 搜索信息
1315
	 * @param subject 学术领域
1316
	 * @param industry 应用行业
1317
	 * @param address 所在城市
1318
	 * @param pageSize 
1407
	 * @param key
1408
	 *            搜索信息
1409
	 * @param subject
1410
	 *            学术领域
1411
	 * @param industry
1412
	 *            应用行业
1413
	 * @param address
1414
	 *            所在城市
1415
	 * @param pageSize
1319
	 * @param pageNo
1416
	 * @param pageNo
1320
	 * @return 返回专家信息列表
1417
	 * @return 返回专家信息列表
1321
	 * @throws SQLException
1418
	 * @throws SQLException
1322
	 */
1419
	 */
1323
	public PageQueryResult<EditProfessor> queryEditBaseInfo(Connection con, @Nullable String key, String subject, 
1324
			String industry, String address, Integer authType, int pageSize, int pageNo) throws SQLException {
1420
	public PageQueryResult<EditProfessor> queryEditBaseInfo(Connection con, @Nullable String key, String subject, String industry, String address,
1421
			Integer authType, int pageSize, int pageNo) throws SQLException {
1422
		
1423
		String fromS=" PROFESSOR P LEFT JOIN ORGANIZATION O ON P.ORG_ID=O.ID ";
1424
		String selectS =" P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,O.NAME,P.TITLE,"
1425
					+ "P.AUTHENTICATION,P.AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,P.STAR_LEVEL,P.CONSULT_COUNT,P.ORG_AUTH,P.SHARE_ID,P.SORT_FIRST ";
1325
		PageQueryResult<EditProfessor> queryResult = new PageQueryResult<EditProfessor>();
1426
		PageQueryResult<EditProfessor> queryResult = new PageQueryResult<EditProfessor>();
1326
		StringBuilder sql = new StringBuilder();
1427
		StringBuilder sql = new StringBuilder();
1327
		boolean hasKey = null != key;
1428
		boolean hasKey = null != key;
1328
		if (hasKey) {
1429
		if (hasKey) {
1329
			sql.append(" WHERE ((P.ID IN (SELECT PROFESSOR_ID FROM RESEARCH_AREA WHERE CAPTION LIKE ?)) "
1330
					+ " OR (ORG_ID IN(SELECT ORGANIZATION.ID FROM ORGANIZATION WHERE ORGANIZATION.NAME LIKE ?)) "
1331
					+ " OR (P.NAME LIKE ?) OR (P.SUBJECT LIKE ?) OR (P.INDUSTRY LIKE ?) OR (P.ADDRESS LIKE ?)"
1332
					+ " OR (P.ID IN (SELECT PROFESSOR_ID FROM RESOURCE WHERE RESOURCE_NAME LIKE ?)) "
1333
					+ " OR (P.ID IN (SELECT PROFESSOR_ID FROM ARTICLE WHERE ARTICLE_TITLE LIKE ?)) "
1334
					+ " OR (P.ID IN (SELECT PROFESSOR_ID FROM PATENT WHERE NAME LIKE ?)) OR (P.DEPARTMENT LIKE ?) )");
1430
			sql.append(" WHERE ((P.NAME LIKE ?) OR")
1431
					.append("(O.NAME LIKE ?)) OR")
1432
					.append("( P.DEPARTMENT LIKE ?) OR")
1433
					.append("( P.DESCP LIKE ?) OR")
1434
					.append("( P.SUBJECT LIKE ? ) OR")
1435
					.append("( P.INDUSTRY LIKE ? ) OR")
1436
					.append("(P.ID IN (SELECT DISTINCT PROFESSOR_ID FROM RESEARCH_AREA WHERE CAPTION LIKE ?)) OR")
1437
					.append("(P.ID IN (SELECT DISTINCT PROFESSOR_ID FROM RESOURCE WHERE RESOURCE_NAME LIKE ?)) OR")
1438
					.append("(P.ID IN (SELECT DISTINCT PROFESSOR_ID FROM ARTICLE WHERE ARTICLE_TITLE LIKE ?)) OR")
1439
					.append("(P.ID IN (SELECT DISTINCT PROFESSOR_ID FROM PAPER_AUTHOR WHERE PAPER_ID IN (SELECT ID FROM PPAPER WHERE NAME LIKE '%'))) OR ")
1440
					.append("(P.ID IN (SELECT DISTINCT PROFESSOR_ID FROM PATENT_AUTHOR WHERE PATENT_ID IN (SELECT ID FROM PPATENT WHERE NAME LIKE '%')))")
1441
					.append(") ");
1442
			//
1443
			//
1444
			// sql.append(" WHERE ((P.ID IN (SELECT PROFESSOR_ID FROM
1445
			// RESEARCH_AREA WHERE CAPTION LIKE ?)) "
1446
			// + " OR (ORG_ID IN(SELECT ORGANIZATION.ID FROM ORGANIZATION WHERE
1447
			// ORGANIZATION.NAME LIKE ?)) "
1448
			// + " OR (P.NAME LIKE ?) OR (P.SUBJECT LIKE ?) OR (P.INDUSTRY LIKE
1449
			// ?) OR (P.ADDRESS LIKE ?)"
1450
			// + " OR (P.ID IN (SELECT PROFESSOR_ID FROM RESOURCE WHERE
1451
			// RESOURCE_NAME LIKE ?)) "
1452
			// + " OR (P.ID IN (SELECT PROFESSOR_ID FROM ARTICLE WHERE
1453
			// ARTICLE_TITLE LIKE ?)) "
1454
			// + " OR (P.ID IN (SELECT PROFESSOR_ID FROM PATENT WHERE NAME LIKE
1455
			// ?)) OR (P.DEPARTMENT LIKE ?) )");
1335
		}
1456
		}
1336
		boolean hasSubject = null != subject;
1457
		boolean hasSubject = null != subject;
1337
		boolean hasIndustry = null != industry;
1458
		boolean hasIndustry = null != industry;
1338
		boolean hasAddress = null != address;
1459
		boolean hasAddress = null != address;
1339
		boolean hasAuthType = null != authType;
1460
		boolean hasAuthType = null != authType;
1340
		if (hasSubject) {
1461
		if (hasSubject) {
1341
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.SUBJECT LIKE ?)");
1462
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.SUBJECT LIKE ?) ");
1342
		}
1463
		}
1343
		if (hasIndustry) {
1464
		if (hasIndustry) {
1344
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.INDUSTRY LIKE ?)");
1465
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.INDUSTRY LIKE ?) ");
1345
		}
1466
		}
1346
		if (hasAddress) {
1467
		if (hasAddress) {
1347
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.ADDRESS LIKE ?)");
1468
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.ADDRESS LIKE ?) ");
1348
		}
1469
		}
1349
		if (hasAuthType) {
1470
		if (hasAuthType) {
1350
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.AUTH_TYPE = ?)");
1471
			sql.append(sql.length() > 0 ? " AND " : " WHERE ").append("(P.AUTH_TYPE = ?) ");
1351
		}
1472
		}
1352

1473

1353
		StringBuilder whereSql = sql;
1474
		StringBuilder whereSql = sql;
1354
		sql = new StringBuilder();
1475
		sql = new StringBuilder();
1355
		sql.append("SELECT COUNT(1) FROM PROFESSOR P");
1476
		sql.append("SELECT COUNT(1) FROM").append(fromS);
1356
		if (whereSql.length() > 0) {
1477
		if (whereSql.length() > 0) {
1357
			sql.append(whereSql);
1478
			sql.append(whereSql);
1358
		}
1479
		}
1371
				ps.setString(paramIndex++, key);
1492
				ps.setString(paramIndex++, key);
1372
				ps.setString(paramIndex++, key);
1493
				ps.setString(paramIndex++, key);
1373
				ps.setString(paramIndex++, key);
1494
				ps.setString(paramIndex++, key);
1495
				ps.setString(paramIndex++, key);
1374
			}
1496
			}
1375
			if (hasSubject) {
1497
			if (hasSubject) {
1376
				ps.setString(paramIndex++, subject);
1498
				ps.setString(paramIndex++, subject);
1411
		if (1 == pageNo) {
1533
		if (1 == pageNo) {
1412
			queryResult.setPageNo(1);
1534
			queryResult.setPageNo(1);
1413
			sql = new StringBuilder();
1535
			sql = new StringBuilder();
1414
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,ORGANIZATION.NAME,TITLE,"
1415
					+ " AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,STAR_LEVEL,CONSULT_COUNT,P.ORG_AUTH,P.SHARE_ID "
1416
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON ORG_ID=ORGANIZATION.ID ");
1536
			sql.append("SELECT ").append(selectS).append(" FROM ").append(fromS);
1417
			if (whereSql.length() > 0) {
1537
			if (whereSql.length() > 0) {
1418
				sql.append(whereSql);
1538
				sql.append(whereSql);
1419
			}
1539
			}
1431
			--pageNo;
1551
			--pageNo;
1432
			int offset = (pageNo * pageSize);
1552
			int offset = (pageNo * pageSize);
1433
			sql = new StringBuilder();
1553
			sql = new StringBuilder();
1434
			sql.append("SELECT OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,DEPARTMENT,ORGANIZATION.NAME,TITLE,"
1435
					+ " AUTHENTICATION,AUTH_TYPE,P.AUTH_STATUS,P.ID,P.NAME,STAR_LEVEL,CONSULT_COUNT,P.ORG_AUTH,P.SHARE_ID "
1436
					+ " FROM PROFESSOR P LEFT JOIN ORGANIZATION ON ORG_ID=ORGANIZATION.ID ");
1554
			sql.append("SELECT ").append(selectS).append(" FROM ").append(fromS);
1437
			if (whereSql.length() > 0) {
1555
			if (whereSql.length() > 0) {
1438
				sql.append(whereSql);
1556
				sql.append(whereSql);
1439
			}
1557
			}
1453
				ps.setString(paramIndex++, key);
1571
				ps.setString(paramIndex++, key);
1454
				ps.setString(paramIndex++, key);
1572
				ps.setString(paramIndex++, key);
1455
				ps.setString(paramIndex++, key);
1573
				ps.setString(paramIndex++, key);
1574
				ps.setString(paramIndex++, key);
1456
			}
1575
			}
1457
			if (hasSubject) {
1576
			if (hasSubject) {
1458
				ps.setString(paramIndex++, subject);
1577
				ps.setString(paramIndex++, subject);
1473
				while (rs.next()) {
1592
				while (rs.next()) {
1474
					EditProfessor professor = new EditProfessor();
1593
					EditProfessor professor = new EditProfessor();
1475
					String office = rs.getString(1);
1594
					String office = rs.getString(1);
1476
                    if(rs.wasNull()){
1477
                    	office = null;
1478
                    }
1479
                    professor.setOffice(office);
1480
                    String subj = rs.getString(2);
1481
                    if(rs.wasNull()){
1482
                    	subj = null;
1483
                    }
1595
					if (rs.wasNull()) {
1596
						office = null;
1597
					}
1598
					professor.setOffice(office);
1599
					String subj = rs.getString(2);
1600
					if (rs.wasNull()) {
1601
						subj = null;
1602
					}
1484
					professor.setSubject(subj);
1603
					professor.setSubject(subj);
1485
					String indus = rs.getString(3);
1604
					String indus = rs.getString(3);
1486
					if(rs.wasNull()){
1605
					if (rs.wasNull()) {
1487
						indus = null;
1606
						indus = null;
1488
					}
1607
					}
1489
					professor.setIndustry(indus);
1608
					professor.setIndustry(indus);
1490
					String addr = rs.getString(4);
1609
					String addr = rs.getString(4);
1491
					if(rs.wasNull()){
1610
					if (rs.wasNull()) {
1492
						addr = null;
1611
						addr = null;
1493
					}
1612
					}
1494
					professor.setAddress(addr);
1613
					professor.setAddress(addr);
1495
					String depart = rs.getString(5);
1614
					String depart = rs.getString(5);
1496
					if(rs.wasNull()){
1615
					if (rs.wasNull()) {
1497
						depart = null;
1616
						depart = null;
1498
					}
1617
					}
1499
					professor.setDepartment(depart);
1618
					professor.setDepartment(depart);
1500
					String orgName = rs.getString(6);
1619
					String orgName = rs.getString(6);
1501
					if(rs.wasNull()){
1620
					if (rs.wasNull()) {
1502
						orgName = null;
1621
						orgName = null;
1503
					}
1622
					}
1504
					professor.setOrgName(orgName);
1623
					professor.setOrgName(orgName);
1505
					String title = rs.getString(7);
1624
					String title = rs.getString(7);
1506
					if(rs.wasNull()){
1625
					if (rs.wasNull()) {
1507
						title = null;
1626
						title = null;
1508
					}
1627
					}
1509
					professor.setTitle(title);
1628
					professor.setTitle(title);
1510
					Integer auth = rs.getInt(8);
1629
					Integer auth = rs.getInt(8);
1511
                    if(rs.wasNull()){
1512
                    	auth = null;
1513
                    }
1514
                    professor.setAuthentication(auth);
1630
					if (rs.wasNull()) {
1631
						auth = null;
1632
					}
1633
					professor.setAuthentication(auth);
1515
					professor.setAuthType(rs.getInt(9));
1634
					professor.setAuthType(rs.getInt(9));
1516
					professor.setAuthStatus(rs.getInt(10));
1635
					professor.setAuthStatus(rs.getInt(10));
1517
					professor.setId(rs.getString(11));
1636
					professor.setId(rs.getString(11));
1536
			}
1655
			}
1537
		}
1656
		}
1538
	}
1657
	}
1539
	
1658

1540
	public PageQueryResult<Professor> query(Connection con, @Nullable String key, String subject, String industry, String address, int pageSize, int pageNo)
1659
	public PageQueryResult<Professor> query(Connection con, @Nullable String key, String subject, String industry, String address, int pageSize, int pageNo)
1541
			throws SQLException {
1660
			throws SQLException {
1542

1661

1686
					}
1805
					}
1687
					professor.setIndustry(industry2);
1806
					professor.setIndustry(industry2);
1688
					String addr = rs.getString(4);
1807
					String addr = rs.getString(4);
1689
					if(rs.wasNull()){
1808
					if (rs.wasNull()) {
1690
						addr = null;
1809
						addr = null;
1691
					}
1810
					}
1692
					professor.setAddress(addr);
1811
					professor.setAddress(addr);
1693
					String depart = rs.getString(5);
1812
					String depart = rs.getString(5);
1694
					if(rs.wasNull()){
1813
					if (rs.wasNull()) {
1695
						depart = null;
1814
						depart = null;
1696
					}
1815
					}
1697
					professor.setDepartment(depart);
1816
					professor.setDepartment(depart);
1698
					Organization organization = new Organization();
1817
					Organization organization = new Organization();
1699
					String orgId = rs.getString(6);
1818
					String orgId = rs.getString(6);
1700
                    if(rs.wasNull()){
1701
                    	orgId = null;
1702
                    }
1703
                    organization.setId(orgId);
1704
                    String orgName = rs.getString(7);
1705
                    if(rs.wasNull()){
1706
                    	orgName = null;
1707
                    }
1708
                    organization.setName(orgName);
1819
					if (rs.wasNull()) {
1820
						orgId = null;
1821
					}
1822
					organization.setId(orgId);
1823
					String orgName = rs.getString(7);
1824
					if (rs.wasNull()) {
1825
						orgName = null;
1826
					}
1827
					organization.setName(orgName);
1709
					professor.setOrganization(organization);
1828
					professor.setOrganization(organization);
1710
					String title = rs.getString(8);
1829
					String title = rs.getString(8);
1711
					if(rs.wasNull()){
1830
					if (rs.wasNull()) {
1712
						title = null;
1831
						title = null;
1713
					}
1832
					}
1714
					professor.setTitle(title);
1833
					professor.setTitle(title);
1715
					Integer auth = rs.getInt(9);
1834
					Integer auth = rs.getInt(9);
1716
                    if(rs.wasNull()){
1717
                    	auth = null;
1718
                    }
1719
                    professor.setAuthentication(auth);
1835
					if (rs.wasNull()) {
1836
						auth = null;
1837
					}
1838
					professor.setAuthentication(auth);
1720
					professor.setId(rs.getString(10));
1839
					professor.setId(rs.getString(10));
1721
					professor.setName(rs.getString(11));
1840
					professor.setName(rs.getString(11));
1722
					String descp = rs.getString(12);
1841
					String descp = rs.getString(12);
1744
			}
1863
			}
1745
		}
1864
		}
1746
	}
1865
	}
1747
	
1748
	public PageQueryResult<UserInfo> queryUserInfo(Connection con,String key,String address,Integer authType,String orgName,Integer activeState,int pageSize,int pageNo) throws SQLException{
1866

1867
	public PageQueryResult<UserInfo> queryUserInfo(Connection con, String key, String address, Integer authType, String orgName, Integer activeState,
1868
			int pageSize, int pageNo) throws SQLException {
1749
		PageQueryResult<UserInfo> queryResult = new PageQueryResult<UserInfo>();
1869
		PageQueryResult<UserInfo> queryResult = new PageQueryResult<UserInfo>();
1750
		StringBuilder sql = new StringBuilder();
1870
		StringBuilder sql = new StringBuilder();
1751
		boolean hasKey = null != key;
1871
		boolean hasKey = null != key;
1888
				while (rs.next()) {
2008
				while (rs.next()) {
1889
					UserInfo userInfo = new UserInfo();
2009
					UserInfo userInfo = new UserInfo();
1890
					String office = rs.getString(1);
2010
					String office = rs.getString(1);
1891
                    if(rs.wasNull()){
1892
                    	office = null;
1893
                    }
1894
                    userInfo.setOffice(office);
1895
                    String subj = rs.getString(2);
1896
                    if(rs.wasNull()){
1897
                    	subj = null;
1898
                    }
1899
                    userInfo.setSubject(subj);
2011
					if (rs.wasNull()) {
2012
						office = null;
2013
					}
2014
					userInfo.setOffice(office);
2015
					String subj = rs.getString(2);
2016
					if (rs.wasNull()) {
2017
						subj = null;
2018
					}
2019
					userInfo.setSubject(subj);
1900
					String indus = rs.getString(3);
2020
					String indus = rs.getString(3);
1901
					if(rs.wasNull()){
2021
					if (rs.wasNull()) {
1902
						indus = null;
2022
						indus = null;
1903
					}
2023
					}
1904
					userInfo.setIndustry(indus);
2024
					userInfo.setIndustry(indus);
1905
					String addr = rs.getString(4);
2025
					String addr = rs.getString(4);
1906
					if(rs.wasNull()){
2026
					if (rs.wasNull()) {
1907
						addr = null;
2027
						addr = null;
1908
					}
2028
					}
1909
					userInfo.setAddress(addr);
2029
					userInfo.setAddress(addr);
1910
					String depart = rs.getString(5);
2030
					String depart = rs.getString(5);
1911
					if(rs.wasNull()){
2031
					if (rs.wasNull()) {
1912
						depart = null;
2032
						depart = null;
1913
					}
2033
					}
1914
					userInfo.setDepartment(depart);
2034
					userInfo.setDepartment(depart);
1915
					String org = rs.getString(6);
2035
					String org = rs.getString(6);
1916
					if(rs.wasNull()){
2036
					if (rs.wasNull()) {
1917
						org = null;
2037
						org = null;
1918
					}
2038
					}
1919
					userInfo.setOrgName(org);
2039
					userInfo.setOrgName(org);
1920
					String title = rs.getString(7);
2040
					String title = rs.getString(7);
1921
					if(rs.wasNull()){
2041
					if (rs.wasNull()) {
1922
						title = null;
2042
						title = null;
1923
					}
2043
					}
1924
					userInfo.setTitle(title);
2044
					userInfo.setTitle(title);
1925
					Integer auth = rs.getInt(8);
2045
					Integer auth = rs.getInt(8);
1926
					if(rs.wasNull()){
2046
					if (rs.wasNull()) {
1927
						auth = null;
2047
						auth = null;
1928
					}
2048
					}
1929
					userInfo.setAuthentication(auth);
2049
					userInfo.setAuthentication(auth);
1934
					userInfo.setEmail(rs.getString(13));
2054
					userInfo.setEmail(rs.getString(13));
1935
					userInfo.setPhone(rs.getString(14));
2055
					userInfo.setPhone(rs.getString(14));
1936
					userInfo.setActiveTime(rs.getString(15));
2056
					userInfo.setActiveTime(rs.getString(15));
1937
					userInfo.setActiveState(!(rs.getString(15)==null));
2057
					userInfo.setActiveState(!(rs.getString(15) == null));
1938
					userInfo.setOrgAuth(rs.getString(16));
2058
					userInfo.setOrgAuth(rs.getString(16));
1939
					userInfo.setShareId(rs.getLong(17));
2059
					userInfo.setShareId(rs.getLong(17));
1940
					userInfos.add(userInfo);
2060
					userInfos.add(userInfo);
1953
			}
2073
			}
1954
		}
2074
		}
1955
	}
2075
	}
1956
	public String[] queryProfessorIdWithSameKeyWord(Connection con,String id,int rows)throws SQLException{
2076

2077
	public String[] queryProfessorIdWithSameKeyWord(Connection con, String id, int rows) throws SQLException {
1957
		List<String> ret = new ArrayList<String>();
2078
		List<String> ret = new ArrayList<String>();
1958
		String sql = "select id,count(1) sort from pro_key_word where kw in (select kw from pro_key_word where id=?) and id <>? group by id order by sort desc limit ?";
2079
		String sql = "select id,count(1) sort from pro_key_word where kw in (select kw from pro_key_word where id=?) and id <>? group by id order by sort desc limit ?";
1959
		PreparedStatement ps = con.prepareStatement(sql);
2080
		PreparedStatement ps = con.prepareStatement(sql);
1960
		try{
2081
		try {
1961
			ps.setString(1, id);
2082
			ps.setString(1, id);
1962
			ps.setString(2, id);
2083
			ps.setString(2, id);
1963
			ps.setInt(3, rows);
2084
			ps.setInt(3, rows);
1964
			ResultSet rs = ps.executeQuery();
2085
			ResultSet rs = ps.executeQuery();
1965
			try{
1966
				while(rs.next()){
2086
			try {
2087
				while (rs.next()) {
1967
					ret.add(rs.getString(1));
2088
					ret.add(rs.getString(1));
1968
				}
2089
				}
1969
			}finally{
1970
				try{rs.close();}catch(Exception e1){}
2090
			} finally {
2091
				try {
2092
					rs.close();
2093
				} catch (Exception e1) {
2094
				}
2095
			}
2096
		} finally {
2097
			try {
2098
				ps.close();
2099
			} catch (Exception e2) {
1971
			}
2100
			}
1972
		}finally{
1973
			try{ps.close();}catch(Exception e2){}
1974
		}
2101
		}
1975
		return ret.isEmpty()?null:ret.toArray(new String[ret.size()]);		
2102
		return ret.isEmpty() ? null : ret.toArray(new String[ret.size()]);
1976
	}
2103
	}
2104

1977
	@SelectList
2105
	@SelectList
1978
	public abstract List<Professor> query(Connection con,@In String[] id)throws SQLException; 
2106
	public abstract List<Professor> query(Connection con, @In String[] id) throws SQLException;
1979
}
2107
}

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

1221
            sql = new StringBuilder();
1221
            sql = new StringBuilder();
1222
            sql.append("SELECT RESOURCE_ID,RESOURCE_NAME,SUBJECT,SUPPORTED_SERVICES,ORG_NAME,SPEC,PARAMETER,STATUS,DESCP,PROFESSOR_ID,PUBLISH_TIME,PAGE_VIEWS,ORG_ID,RESOURCE_TYPE FROM RESOURCE");
1222
            sql.append("SELECT RESOURCE_ID,RESOURCE_NAME,SUBJECT,SUPPORTED_SERVICES,ORG_NAME,SPEC,PARAMETER,STATUS,DESCP,PROFESSOR_ID,PUBLISH_TIME,PAGE_VIEWS,ORG_ID,RESOURCE_TYPE FROM RESOURCE");
1223
            sql.append(whereSql);
1223
            sql.append(whereSql);
1224
            sql.append(" ORDER BY PUBLISH_TIME DESC");
1224
            sql.append(" ORDER BY SORT_NUM DESC,PUBLISH_TIME DESC");
1225
            sql.append(" LIMIT ").append(pageSize);
1225
            sql.append(" LIMIT ").append(pageSize);
1226
        }else{
1226
        }else{
1227
            int pageNum = total / pageSize;
1227
            int pageNum = total / pageSize;
1237
            sql = new StringBuilder();
1237
            sql = new StringBuilder();
1238
            sql.append("SELECT RESOURCE_ID,RESOURCE_NAME,SUBJECT,SUPPORTED_SERVICES,ORG_NAME,SPEC,PARAMETER,STATUS,DESCP,PROFESSOR_ID,PUBLISH_TIME,PAGE_VIEWS,ORG_ID,RESOURCE_TYPE FROM RESOURCE");
1238
            sql.append("SELECT RESOURCE_ID,RESOURCE_NAME,SUBJECT,SUPPORTED_SERVICES,ORG_NAME,SPEC,PARAMETER,STATUS,DESCP,PROFESSOR_ID,PUBLISH_TIME,PAGE_VIEWS,ORG_ID,RESOURCE_TYPE FROM RESOURCE");
1239
            sql.append(whereSql);
1239
            sql.append(whereSql);
1240
            sql.append(" ORDER BY PUBLISH_TIME DESC");
1240
            sql.append(" ORDER BY SORT_NUM DESC,PUBLISH_TIME DESC");
1241
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
1241
            sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(offset);
1242
        }
1242
        }
1243
        ps = con.prepareStatement(sql.toString());
1243
        ps = con.prepareStatement(sql.toString());

+ 0 - 1
src/main/java/com/ekexiu/portal/service/OrgService.java

21
import com.ekexiu.portal.dao.OrgRegInfoDao;
21
import com.ekexiu.portal.dao.OrgRegInfoDao;
22
import com.ekexiu.portal.po.OrgRegInfo;
22
import com.ekexiu.portal.po.OrgRegInfo;
23
import com.ekexiu.portal.po.Organization;
23
import com.ekexiu.portal.po.Organization;
24
import com.ekexiu.portal.po.Professor;
25
import com.ekexiu.portal.pojo.EditOrganization;
24
import com.ekexiu.portal.pojo.EditOrganization;
26
25
27
@Path("/org")
26
@Path("/org")

+ 0 - 2
src/main/java/com/ekexiu/portal/service/PpatentServcie.java

14
import org.jfw.apt.web.annotation.param.JdbcConn;
14
import org.jfw.apt.web.annotation.param.JdbcConn;
15
import org.jfw.util.PageQueryResult;
15
import org.jfw.util.PageQueryResult;
16

16

17
import com.ekexiu.portal.dao.PaperAuthorDao;
18
import com.ekexiu.portal.dao.PatentAgreeDao;
17
import com.ekexiu.portal.dao.PatentAgreeDao;
19
import com.ekexiu.portal.dao.PatentAuthorDao;
18
import com.ekexiu.portal.dao.PatentAuthorDao;
20
import com.ekexiu.portal.dao.PpatentDao;
19
import com.ekexiu.portal.dao.PpatentDao;
21
import com.ekexiu.portal.po.PaperAuthor;
22
import com.ekexiu.portal.po.PatentAgree;
20
import com.ekexiu.portal.po.PatentAgree;
23
import com.ekexiu.portal.po.PatentAuthor;
21
import com.ekexiu.portal.po.PatentAuthor;
24
import com.ekexiu.portal.po.Ppatent;
22
import com.ekexiu.portal.po.Ppatent;

+ 4 - 1
src/main/java/com/ekexiu/portal/service/SysService.java

1791
	 */
1791
	 */
1792
	@Get
1792
	@Get
1793
	@Path("/regmobilephone")
1793
	@Path("/regmobilephone")
1794
	public String regMobilePhone(@JdbcConn(false) Connection con, String mobilePhone, @DefaultValue("true") boolean checkExists)
1794
	public String regMobilePhone(@JdbcConn(false) Connection con, String mobilePhone, @DefaultValue("true") boolean checkExists,String vcode,@SessionVal(value="verification",remove=true) String scode)
1795
			throws JfwBaseException, SQLException {
1795
			throws JfwBaseException, SQLException {
1796
		if(!vcode.toUpperCase().equals(scode)){
1797
			throw new JfwBaseException(20001, "valid code error");
1798
		}
1796
		if (checkExists) {
1799
		if (checkExists) {
1797
			User user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
1800
			User user = this.userDao.queryByEmailOrMobilePhone(con, mobilePhone);
1798
			if (null != user) {
1801
			if (null != user) {

+ 4 - 0
src/main/resources/database.sql

1516
update organization set org_type = null;
1516
update organization set org_type = null;
1517
ALTER TABLE  organization ADD COLUMN linkman text;
1517
ALTER TABLE  organization ADD COLUMN linkman text;
1518
COMMENT ON COLUMN  organization.linkman IS '联系人';
1518
COMMENT ON COLUMN  organization.linkman IS '联系人';
1519
ALTER TABLE article ADD COLUMN sort_num  int8 default 0 not null;
1520
COMMENT ON COLUMN article.sort_num IS '排序字段,人工权重';
1519

1521

1522
ALTER TABLE resource ADD COLUMN sort_num  int8 default 0 not null;
1523
COMMENT ON COLUMN resource.sort_num IS '排序字段,人工权重';
1520

1524

1521
--begin v1.9.1
1525
--begin v1.9.1
1522
ALTER TABLE professor ADD COLUMN page_views  int8 default 0 not null;
1526
ALTER TABLE professor ADD COLUMN page_views  int8 default 0 not null;