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,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 model.addAttribute("commentPage", commentPage); 138 model.addAttribute("commentPage", commentPage);
136 return "page/comment.html"; 139 return "page/comment.html";
137 } 140 }
src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
@@ -158,10 +158,10 @@ public class VideosServiceImpl { @@ -158,10 +158,10 @@ public class VideosServiceImpl {
158 criteria2.andEqualTo("receive_user_id", userId); 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 criteria.andEqualTo("state", state); 162 criteria.andEqualTo("state", state);
  163 + } else if (CommonUtils.isNotNull(state) && state == 3) {
  164 + criteria.andEqualTo("state", 1);
165 criteria2.andEqualTo("state", 2); 165 criteria2.andEqualTo("state", 2);
166 example.or(criteria2); 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,8 +42,8 @@ line-height: 2em; margin: 0 auto;font-size: 2em" th:text="${session.sessionUser.
42 </p> 42 </p>
43 </li> 43 </li>
44 <li class="user-footer" > 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 </div> 47 </div>
48 <div class="pull-right"> 48 <div class="pull-right">
49 <a style="background:#3c8dbc" href="/users/logout" class="btn btn-default btn-flat">注销</a> 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,7 +87,7 @@
87 87
88 <div class="form-horizontal form-group-sm" id="forms" style="display: none;"> 88 <div class="form-horizontal form-group-sm" id="forms" style="display: none;">
89 <form id="commentForm"> 89 <form id="commentForm">
90 - <input class="hide" name="state" th:value="${param.state}"/> 90 +<!-- <input th:value="${param.state}"/> -->
91 <div class="btn-group margin-bottom col-md-6" style="padding: 0;"> 91 <div class="btn-group margin-bottom col-md-6" style="padding: 0;">
92 <div class="col-md-5" style="padding: 0"> 92 <div class="col-md-5" style="padding: 0">
93 <label for="activity_id" class="control-label cb-toolbar">活动id:</label> 93 <label for="activity_id" class="control-label cb-toolbar">活动id:</label>
@@ -104,20 +104,21 @@ @@ -104,20 +104,21 @@
104 </div> 104 </div>
105 </div> 105 </div>
106 <div class="col-md-3" style="padding: 0"> 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 <div class="col-sm-6" style="padding: 0;"> 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 <option value="">全部</option> 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 </select> 114 </select>
114 </div> 115 </div>
115 </div> 116 </div>
116 <script th:inline="javascript"> 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 </script> 122 </script>
122 123
123 </div> 124 </div>
@@ -467,6 +468,7 @@ @@ -467,6 +468,7 @@
467 //已审、未审、全部,状态切换 468 //已审、未审、全部,状态切换
468 function searchStatus(commentStatus, receive) { 469 function searchStatus(commentStatus, receive) {
469 var href = location.href; 470 var href = location.href;
  471 + if ($.trim($("#state").val()) != '') commentStatus =$("#state").val();
470 if (sea == "") {//没有参数 472 if (sea == "") {//没有参数
471 if (href.endsWith("?")) href = href.substring(0, href.length - 1); 473 if (href.endsWith("?")) href = href.substring(0, href.length - 1);
472 if ($.trim(commentStatus) != '') href = href + "?state=" + commentStatus; 474 if ($.trim(commentStatus) != '') href = href + "?state=" + commentStatus;
src/main/resources/templates/page/content.html
@@ -26,7 +26,7 @@ @@ -26,7 +26,7 @@
26 <div class="box-body"> 26 <div class="box-body">
27 27
28 <div class="btn-group margin-bottom pull-left"> 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 <div class="btn-group margin-bottom" id="hide_select_area_2" style=> 30 <div class="btn-group margin-bottom" id="hide_select_area_2" style=>
31 <button type="button" class="btn btn-success btn-sm margin-r-5 action claim" 31 <button type="button" class="btn btn-success btn-sm margin-r-5 action claim"
32 value="2" data="claim" id="claim" data-toggle="modal" 32 value="2" data="claim" id="claim" data-toggle="modal"
src/main/resources/templates/page/video.html
@@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
25 <div class="box-body"> 25 <div class="box-body">
26 26
27 <div class="btn-group margin-bottom pull-left"> 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 <div class="btn-group margin-bottom" id="hide_select_area_2" style=> 29 <div class="btn-group margin-bottom" id="hide_select_area_2" style=>
30 <button type="button" class="btn btn-success btn-sm margin-r-5 action claim" 30 <button type="button" class="btn btn-success btn-sm margin-r-5 action claim"
31 value="2" data="claim" id="claim" data-toggle="modal" 31 value="2" data="claim" id="claim" data-toggle="modal"
@@ -87,12 +87,13 @@ @@ -87,12 +87,13 @@
87 87
88 <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 10%;float: left;"> 88 <div class="btn-group margin-bottom col-md-6" style="padding: 0;width: 10%;float: left;">
89 <div class="col-md-5" style="padding: 0;width: 100%;"> 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 <div class="col-sm-8" style="padding: 0;"> 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 <option value="">全部</option> 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 </select> 97 </select>
97 <!--<input class="form-control" name="video_priority" type="text" id="video_priority">--> 98 <!--<input class="form-control" name="video_priority" type="text" id="video_priority">-->
98 </div> 99 </div>
@@ -366,12 +367,14 @@ @@ -366,12 +367,14 @@
366 var end_date = ""; 367 var end_date = "";
367 var sp_desc =""; 368 var sp_desc ="";
368 var count = ""; 369 var count = "";
  370 + var state = "";
369 371
370 function updateValue(){ 372 function updateValue(){
371 - video_priority = $("#video_priority").val(); 373 +// video_priority = $("#video_priority").val();
372 video_title = $("#video_titleID").val(); 374 video_title = $("#video_titleID").val();
373 start_date = $("#start_date").val(); 375 start_date = $("#start_date").val();
374 end_date = $("#end_date").val(); 376 end_date = $("#end_date").val();
  377 + state = $("#state").val();
375 var spId=[[${session.sessionUser.spid}]]; 378 var spId=[[${session.sessionUser.spid}]];
376 if(spId==0){ 379 if(spId==0){
377 sp_desc = $("#sp_desc").val(); 380 sp_desc = $("#sp_desc").val();
@@ -383,35 +386,35 @@ @@ -383,35 +386,35 @@
383 //全部 386 //全部
384 function quanbu() { 387 function quanbu() {
385 updateValue(); 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 $('#daishen').click(function () { 393 $('#daishen').click(function () {
391 updateValue(); 394 updateValue();
392 - var state = 0; 395 + if($.trim(state) == '') state=0;
393 var receive = 0; 396 var receive = 0;
394 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; 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 $('#Mydaishen').click(function () { 400 $('#Mydaishen').click(function () {
398 updateValue(); 401 updateValue();
399 - var state = 0;  
400 var receive = 1; 402 var receive = 1;
  403 + if($.trim(state) == '') state=0;
401 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; 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 $('#yishen').click(function () { 407 $('#yishen').click(function () {
405 updateValue(); 408 updateValue();
406 - var state = 1;  
407 var receive = 1; 409 var receive = 1;
  410 + if($.trim(state) == '') state=3;//审核状态,3代表通过和拒绝都查询
408 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; 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 $('#videos_query').click(function () { 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 $('#select_all').click(function () { 420 $('#select_all').click(function () {