Commit 5b3a7a25bb445aecd77bc46dff36df5e420b9a61

Authored by liwei2917
1 parent ec6893bd

搜索优化

src/main/java/com/cnlive/shenhe/controller/CommentsController.java
... ... @@ -132,6 +132,9 @@ public class CommentsController {
132 132 }
133 133 }
134 134 }
  135 + /* 获取参数值给前台 用来判断是否需要把查看显示出来 state recive*/
  136 + String state1 = state == null ? "" : state.toString();
  137 + model.addAttribute("state1", state1);
135 138 model.addAttribute("commentPage", commentPage);
136 139 return "page/comment.html";
137 140 }
... ...
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -158,10 +158,10 @@ public class VideosServiceImpl {
158 158 criteria2.andEqualTo("receive_user_id", userId);
159 159 }
160 160 }
161   - if (CommonUtils.isNotNull(state) && state == 0) {
162   - criteria.andEqualTo("state", state);
163   - } else if (CommonUtils.isNotNull(state) && state == 1) {
  161 + if (CommonUtils.isNotNull(state) && state != 3) {
164 162 criteria.andEqualTo("state", state);
  163 + } else if (CommonUtils.isNotNull(state) && state == 3) {
  164 + criteria.andEqualTo("state", 1);
165 165 criteria2.andEqualTo("state", 2);
166 166 example.or(criteria2);
167 167 }
... ...
src/main/resources/templates/common/frame.html
... ... @@ -42,8 +42,8 @@ line-height: 2em; margin: 0 auto;font-size: 2em" th:text="${session.sessionUser.
42 42 </p>
43 43 </li>
44 44 <li class="user-footer" >
45   - <div class="pull-left">
46   - <a style="background:#3c8dbc" href="http://console.open.cnlive.com/open/console/admin/account_list?shenhe=1" target="black" class="btn btn-default btn-flat">账号管理</a>
  45 + <div class="pull-left" th:if="${session.sessionUser.spid==0 or session.sessionUser.master}">
  46 + <a style="background:#3c8dbc" href="http://console.open.cnlive.com/open/console/user/info" target="black" class="btn btn-default btn-flat">账号管理</a>
47 47 </div>
48 48 <div class="pull-right">
49 49 <a style="background:#3c8dbc" href="/users/logout" class="btn btn-default btn-flat">注销</a>
... ...
src/main/resources/templates/page/comment.html
... ... @@ -87,7 +87,7 @@
87 87  
88 88 <div class="form-horizontal form-group-sm" id="forms" style="display: none;">
89 89 <form id="commentForm">
90   - <input class="hide" name="state" th:value="${param.state}"/>
  90 +<!-- <input th:value="${param.state}"/> -->
91 91 <div class="btn-group margin-bottom col-md-6" style="padding: 0;">
92 92 <div class="col-md-5" style="padding: 0">
93 93 <label for="activity_id" class="control-label cb-toolbar">活动id:</label>
... ... @@ -104,20 +104,21 @@
104 104 </div>
105 105 </div>
106 106 <div class="col-md-3" style="padding: 0">
107   - <label for="is_hot" class="control-label cb-toolbar">是否热点:</label>
  107 + <label for="state" class="control-label cb-toolbar">状态:</label>
108 108 <div class="col-sm-6" style="padding: 0;">
109   - <select class="form-control col-sm-2" id="is_hot" name="is_hot">
  109 + <select class="form-control col-sm-2" id="state" name="state">
110 110 <option value="">全部</option>
111   - <option value="2">是</option>
112   - <option value="1">否</option>
  111 + <option value="0" th:selected="${state1 == '0'}">未审核</option>
  112 + <option value="1" th:selected="${state1 == '1'}">已通过</option>
  113 + <option value="2" th:selected="${state1 == '2'}">已拒绝</option>
113 114 </select>
114 115 </div>
115 116 </div>
116 117 <script th:inline="javascript">
117   - var isHot = [[${param.is_hot}]];
118   - if (isHot != null && isHot[0] != "") {
119   - $("#is_hot").val(isHot[0]);
120   - }
  118 +// var isHot = [[${param.is_hot}]];
  119 +// if (isHot != null && isHot[0] != "") {
  120 +// $("#is_hot").val(isHot[0]);
  121 +// }
121 122 </script>
122 123  
123 124 </div>
... ... @@ -467,6 +468,7 @@
467 468 //已审、未审、全部,状态切换
468 469 function searchStatus(commentStatus, receive) {
469 470 var href = location.href;
  471 + if ($.trim($("#state").val()) != '') commentStatus =$("#state").val();
470 472 if (sea == "") {//没有参数
471 473 if (href.endsWith("?")) href = href.substring(0, href.length - 1);
472 474 if ($.trim(commentStatus) != '') href = href + "?state=" + commentStatus;
... ...
src/main/resources/templates/page/content.html
... ... @@ -26,7 +26,7 @@
26 26 <div class="box-body">
27 27  
28 28 <div class="btn-group margin-bottom pull-left">
29   - <input type="hidden" name="state" id="state" value=""/>
  29 +<!-- <input type="hidden" name="state" id="state" value=""/> -->
30 30 <div class="btn-group margin-bottom" id="hide_select_area_2" style=>
31 31 <button type="button" class="btn btn-success btn-sm margin-r-5 action claim"
32 32 value="2" data="claim" id="claim" data-toggle="modal"
... ...
src/main/resources/templates/page/video.html
... ... @@ -25,7 +25,7 @@
25 25 <div class="box-body">
26 26  
27 27 <div class="btn-group margin-bottom pull-left">
28   - <input type="hidden" name="state" id="state" value=""/>
  28 +<!-- <input type="hidden" name="state" id="state" value=""/> -->
29 29 <div class="btn-group margin-bottom" id="hide_select_area_2" style=>
30 30 <button type="button" class="btn btn-success btn-sm margin-r-5 action claim"
31 31 value="2" data="claim" id="claim" data-toggle="modal"
... ... @@ -87,12 +87,13 @@
87 87  
88 88 <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 10%;float: left;">
89 89 <div class="col-md-5" style="padding: 0;width: 100%;">
90   - <label for="video_priority" class="control-label cb-toolbar">热点:</label>
  90 + <label for="state" class="control-label cb-toolbar">状态:</label>
91 91 <div class="col-sm-8" style="padding: 0;">
92   - <select class="form-control" id="video_priority" name="video_priority">
  92 + <select class="form-control" id="state" name="state">
93 93 <option value="">全部</option>
94   - <option value="1">是</option>
95   - <option value="0">否</option>
  94 + <option value="0">未审核</option>
  95 + <option value="1">已通过</option>
  96 + <option value="2">已拒绝</option>
96 97 </select>
97 98 <!--<input class="form-control" name="video_priority" type="text" id="video_priority">-->
98 99 </div>
... ... @@ -366,12 +367,14 @@
366 367 var end_date = "";
367 368 var sp_desc ="";
368 369 var count = "";
  370 + var state = "";
369 371  
370 372 function updateValue(){
371   - video_priority = $("#video_priority").val();
  373 +// video_priority = $("#video_priority").val();
372 374 video_title = $("#video_titleID").val();
373 375 start_date = $("#start_date").val();
374 376 end_date = $("#end_date").val();
  377 + state = $("#state").val();
375 378 var spId=[[${session.sessionUser.spid}]];
376 379 if(spId==0){
377 380 sp_desc = $("#sp_desc").val();
... ... @@ -383,35 +386,35 @@
383 386 //全部
384 387 function quanbu() {
385 388 updateValue();
386   - window.location.href = "/videos/page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
  389 + window.location.href = "/videos/page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
387 390 }
388 391  
389 392 //全部待领
390 393 $('#daishen').click(function () {
391 394 updateValue();
392   - var state = 0;
  395 + if($.trim(state) == '') state=0;
393 396 var receive = 0;
394 397 window.location.href = "page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&receive=" + receive + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
395 398 });
396 399 //我的待审核
397 400 $('#Mydaishen').click(function () {
398 401 updateValue();
399   - var state = 0;
400 402 var receive = 1;
  403 + if($.trim(state) == '') state=0;
401 404 window.location.href = "page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&receive=" + receive + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
402 405 });
403 406 //我的已审核
404 407 $('#yishen').click(function () {
405 408 updateValue();
406   - var state = 1;
407 409 var receive = 1;
  410 + if($.trim(state) == '') state=3;//审核状态,3代表通过和拒绝都查询
408 411 window.location.href = "page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&receive=" + receive + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
409 412 });
410 413  
411 414  
412 415 //查询
413 416 $('#videos_query').click(function () {
414   - window.location.href = "/videos/page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
  417 + window.location.href = "/videos/page?video_title=" + video_title + "&start_date=" + start_date + "&end_date=" + end_date + "&state=" + state + "&video_priority=" + video_priority + "&sp_desc=" + sp_desc+"&pageSize="+count;
415 418 });
416 419 /*全选的操作*/
417 420 $('#select_all').click(function () {
... ...