Ver Código Fonte

专家搜索添加一个排序字段,运维人员可以修改。

zzy.zhiyuan.foxmail 8 anos atrás
pai
commit
1e8f8d8303

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

@ -19,6 +19,7 @@ import org.jfw.apt.orm.annotation.dao.method.operator.DeleteWith;
19 19
import org.jfw.apt.orm.annotation.dao.method.operator.Insert;
20 20
import org.jfw.apt.orm.annotation.dao.method.operator.PageSelect;
21 21
import org.jfw.apt.orm.annotation.dao.method.operator.QueryOne;
22
import org.jfw.apt.orm.annotation.dao.method.operator.SelectOne;
22 23
import org.jfw.apt.orm.annotation.dao.method.operator.Update;
23 24
import org.jfw.apt.orm.annotation.dao.method.operator.UpdateWith;
24 25
import org.jfw.apt.orm.annotation.dao.param.Set;
@ -39,6 +40,10 @@ public abstract class ProfessorDao {
39 40
	@Update
40 41
	public abstract int update(Connection con, Professor professor) throws SQLException;
41 42
	
43
	@UpdateWith
44
	@From(Professor.class)
45
	public abstract int updateSortFirst(Connection con, String id, @Set Integer sortFirst) throws SQLException;
46
	
42 47
	@UpdateWith
43 48
	@From(Professor.class)
44 49
	public abstract int updateAuthentication(Connection con, String id, @Set Integer authentication, 
@ -227,6 +232,10 @@ public abstract class ProfessorDao {
227 232
        }
228 233
	}
229 234
	
235
	@SelectOne
236
	@Nullable
237
	public abstract Professor queryOne(Connection con, String id) throws SQLException;
238
	
230 239
	public Professor query(Connection con, String id) throws SQLException{
231 240
        int _m_1 = 1;
232 241
        String sql = "SELECT P.OFFICE,P.SUBJECT,P.INDUSTRY,P.ADDRESS,P.DEPARTMENT,ORG_ID,P.TITLE,AUTHENTICATION,"
@ -731,7 +740,7 @@ public abstract class ProfessorDao {
731 740
			if (whereSql.length() > 0) {
732 741
				sql.append(whereSql);
733 742
			}
734
			sql.append(" ORDER BY STAR_LEVEL DESC ");
743
			sql.append(" ORDER BY SORT_FIRST DESC,STAR_LEVEL DESC ");
735 744
			sql.append(" LIMIT ").append(pageSize);
736 745
		} else {
737 746
			int _pageSize = totalSize / pageSize;
@ -750,7 +759,7 @@ public abstract class ProfessorDao {
750 759
			if (whereSql.length() > 0) {
751 760
				sql.append(whereSql);
752 761
			}
753
			sql.append(" ORDER BY STAR_LEVEL DESC ");
762
			sql.append(" ORDER BY SORT_FIRST DESC,STAR_LEVEL DESC ");
754 763
			sql.append(" LIMIT ").append(pageSize).append(" OFFSET ").append(_m_10);
755 764
		}
756 765
		ps = con.prepareStatement(sql.toString());

+ 10 - 0
src/main/java/com/ekexiu/portal/po/Professor.java

@ -48,6 +48,7 @@ public class Professor implements CreateTimeSupported, ModifyTimeSupported{
48 48
	private Integer authStatus;
49 49
	private String phone;
50 50
	private String email;
51
	private Integer sortFirst;
51 52
	
52 53
	private Organization organization;
53 54
	private List<Resource> resources;
@ -273,4 +274,13 @@ public class Professor implements CreateTimeSupported, ModifyTimeSupported{
273 274
		this.email = email;
274 275
	}
275 276
277
	@Column(handlerClass=WIntHandler.class,dbType="INT",insertable=false,nullable=false,renewable=false,queryable=true)
278
	public Integer getSortFirst() {
279
		return sortFirst;
280
	}
281
282
	public void setSortFirst(Integer sortFirst) {
283
		this.sortFirst = sortFirst;
284
	}
285
276 286
}

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

@ -216,8 +216,6 @@ public class ProfessorService {
216 216
	public void setOrgDao(OrgDao orgDao) {
217 217
		this.orgDao = orgDao;
218 218
	}
219

220

221 219
	
222 220

223 221
	@Post
@ -318,7 +316,7 @@ public class ProfessorService {
318 316
	
319 317
	@Get
320 318
	@Path("/pqHot")
321
	public PageQueryResult<EditProfessor> queryHot(@JdbcConn Connection con,@DefaultValue("10") int pageSize,@DefaultValue("1") int pageNo) throws SQLException {
319
	public PageQueryResult<EditProfessor> queryHot(@JdbcConn Connection con,@DefaultValue("8") int pageSize,@DefaultValue("1") int pageNo) throws SQLException {
322 320
		PageQueryResult<EditProfessor> queryResult = this.professorDao.queryHot(con, pageSize, pageNo);
323 321
		List<EditProfessor> professors = queryResult.getData();
324 322
		if(professors != null){
@ -355,6 +353,12 @@ public class ProfessorService {
355 353
		return queryResult;
356 354
	}
357 355
	
356
	@Post
357
	@Path("/sortFirst")
358
	public void updateSortFirst(@JdbcConn(true) Connection con, String id, Integer sortFirst) throws SQLException{
359
		this.professorDao.updateSortFirst(con, id, sortFirst);
360
	}
361
	
358 362
	@Post
359 363
	@Path("/authentication")
360 364
	public void updateAuthentication(@JdbcConn(true) Connection con, String id, Integer authentication, 

+ 24 - 0
src/main/webapp/page/professor.html

@ -151,6 +151,15 @@
151 151
					<button id="saveAuth" type="button" class="btn btn-default">保存</button>
152 152
				</div>
153 153
			</div>
154
			<div class="form-group">
155
				<label for="sortFirst" class="col-sm-2 control-label">搜索列表排序值</label>
156
				<div class="col-sm-9">
157
					<input type="text" class="form-control" id="sortFirst" placeholder="搜索列表排序值" disable>
158
				</div>
159
				<div class="col-sm-1">
160
					<button id="saveSortFirst" type="button" class="btn btn-default">保存</button>
161
				</div>
162
			</div>
154 163
			<div class="form-group">
155 164
				<label for="subject" class="col-sm-2 control-label">学术领域</label>
156 165
				<div class="col-sm-9">
@ -719,6 +728,7 @@
719 728
							$("#industry").val($info.industry);
720 729
							$("#province").val($info.province);
721 730
							$("#address").val($info.address);
731
							$("#sortFirst").val($info.sortFirst);
722 732
							$("#authType").val($info.authType);
723 733
							$("#authentication").val($info.authentication);
724 734
							$("#authStatus").val($info.authStatus);
@ -773,6 +783,20 @@
773 783
									}
774 784
								});
775 785
							});
786
							$("#saveSortFirst").on("click",function(){
787
								$.ajax({"url" : "../ajax/professor/sortFirst",
788
									"type" : "POST",
789
									"data" : {"id":professorId,"sortFirst":$("#sortFirst").val()},
790
									"contentType" : "application/x-www-form-urlencoded",
791
									"success" : function($data) {
792
										if ($data.success) {
793
											alert("保存搜索列表排序值成功!");
794
										} else {
795
											alert($data.msg);
796
										}
797
									}
798
								});
799
							});
776 800
							$("#saveSubject").on("click",function(){
777 801
								$.ajax({"url" : "../ajax/professor/subject",
778 802
									"type" : "POST",