Commit c59632c76ea490a7e4edb5f195eb23594d279b06
1 parent
5a1b07d8
优化活动管理模块
Showing
6 changed files
with
131 additions
and
27 deletions
src/main/java/com/cnlive/shenhe/controller/ShyActivityController.java
| ... | ... | @@ -3,6 +3,7 @@ package com.cnlive.shenhe.controller; |
| 3 | 3 | |
| 4 | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | +import com.cnlive.shenhe.dto.ShyActivityDTO; | |
| 6 | 7 | import com.cnlive.shenhe.entity.ShyActivity; |
| 7 | 8 | import com.cnlive.shenhe.serviceImpl.ShyActivityImpl; |
| 8 | 9 | import com.cnlive.shenhe.utils.CommonConst; |
| ... | ... | @@ -61,8 +62,8 @@ public class ShyActivityController { |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | @GetMapping("/page") |
| 64 | - public String getShyActivity(Integer id, @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, Model model) { | |
| 65 | - PageInfo<ShyActivity> shyActivityPageInfo = shyActivityImpl.selectByExample(id, pageNum, pageSize); | |
| 65 | + public String getShyActivity( @RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, Model model,String activity,String exempt_from_trial) { | |
| 66 | + PageInfo<ShyActivity> shyActivityPageInfo = shyActivityImpl.selectByExample(pageNum, pageSize,activity,exempt_from_trial); | |
| 66 | 67 | model.addAttribute("ShyActivitylist", shyActivityPageInfo); |
| 67 | 68 | return "page/activity.html"; |
| 68 | 69 | } | ... | ... |
src/main/java/com/cnlive/shenhe/dto/ShyActivityDTO.java
0 → 100644
| 1 | +package com.cnlive.shenhe.dto; | |
| 2 | + | |
| 3 | + | |
| 4 | +import org.springframework.stereotype.Component; | |
| 5 | + | |
| 6 | +import java.io.Serializable; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * @author Administrator | |
| 10 | + * @author yanzhaowang | |
| 11 | + * @create 2022-03-14 13:16 | |
| 12 | + */ | |
| 13 | +@Component | |
| 14 | +public class ShyActivityDTO implements Serializable { | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + private Integer pageNum = 1; | |
| 19 | + | |
| 20 | + private Integer pageSize = 10; | |
| 21 | + | |
| 22 | + private String activity; | |
| 23 | + | |
| 24 | + private Byte exempt_from_trial; | |
| 25 | + | |
| 26 | + public ShyActivityDTO(Integer pageNum, Integer pageSize, String activity, Byte exempt_from_trial) { | |
| 27 | + this.pageNum = pageNum; | |
| 28 | + this.pageSize = pageSize; | |
| 29 | + this.activity = activity; | |
| 30 | + this.exempt_from_trial = exempt_from_trial; | |
| 31 | + } | |
| 32 | + | |
| 33 | + public Integer getPageNum() { | |
| 34 | + return pageNum; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public void setPageNum(Integer pageNum) { | |
| 38 | + this.pageNum = pageNum; | |
| 39 | + } | |
| 40 | + | |
| 41 | + public Integer getPageSize() { | |
| 42 | + return pageSize; | |
| 43 | + } | |
| 44 | + | |
| 45 | + public void setPageSize(Integer pageSize) { | |
| 46 | + this.pageSize = pageSize; | |
| 47 | + } | |
| 48 | + | |
| 49 | + public String getActivity() { | |
| 50 | + return activity; | |
| 51 | + } | |
| 52 | + | |
| 53 | + public void setActivity(String activity) { | |
| 54 | + this.activity = activity; | |
| 55 | + } | |
| 56 | + | |
| 57 | + public Byte getExempt_from_trial() { | |
| 58 | + return exempt_from_trial; | |
| 59 | + } | |
| 60 | + | |
| 61 | + public void setExempt_from_trial(Byte exempt_from_trial) { | |
| 62 | + this.exempt_from_trial = exempt_from_trial; | |
| 63 | + } | |
| 64 | + | |
| 65 | + public ShyActivityDTO(String activity, Byte exempt_from_trial) { | |
| 66 | + this.activity = activity; | |
| 67 | + this.exempt_from_trial = exempt_from_trial; | |
| 68 | + } | |
| 69 | + | |
| 70 | + public ShyActivityDTO() { | |
| 71 | + } | |
| 72 | +} | ... | ... |
src/main/java/com/cnlive/shenhe/serviceImpl/ShyActivityImpl.java
| 1 | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import com.cnlive.shenhe.dto.ShyActivityDTO; | |
| 4 | 5 | import com.cnlive.shenhe.entity.ShyActivity; |
| 5 | 6 | import com.cnlive.shenhe.mapper.ShyActivityMapper; |
| 6 | 7 | import com.cnlive.shenhe.utils.CommonUtils; |
| ... | ... | @@ -71,15 +72,26 @@ public class ShyActivityImpl { |
| 71 | 72 | |
| 72 | 73 | /** |
| 73 | 74 | * 查询活动 |
| 74 | - * | |
| 75 | 75 | * @param pageNum |
| 76 | 76 | * @param pageSize |
| 77 | 77 | * @return |
| 78 | 78 | */ |
| 79 | - public PageInfo<ShyActivity> selectByExample(Integer id, Integer pageNum, Integer pageSize) { | |
| 79 | + public PageInfo<ShyActivity> selectByExample(Integer pageNum, Integer pageSize,String activity,String exempt_from_trial) { | |
| 80 | 80 | Example example = new Example(ShyActivity.class); |
| 81 | + //如果为空 按照倒序排序 分页查询所有 | |
| 82 | + //以创建时间为条件进行倒序 | |
| 83 | + example.setOrderByClause("`create_time` desc"); | |
| 84 | + | |
| 81 | 85 | Example.Criteria criteria = example.createCriteria(); |
| 82 | - criteria.andEqualTo(id); | |
| 86 | + | |
| 87 | + // 如果查询条件不为空 按照条件走模糊查询 | |
| 88 | + if (CommonUtils.isNotEmpty(String.valueOf(exempt_from_trial))) { | |
| 89 | + criteria.andLike("exempt_from_trial", "%" + exempt_from_trial + "%"); | |
| 90 | + } | |
| 91 | + // 如果查询条件不为空 按照条件走模糊查询 | |
| 92 | + if (CommonUtils.isNotEmpty(activity)) { | |
| 93 | + criteria.andLike("activity", "%" + activity + "%"); | |
| 94 | + } | |
| 83 | 95 | PageHelper.startPage(pageNum, pageSize, true); |
| 84 | 96 | List<ShyActivity> shyActivities = ShyActivityMapper.selectByExample(example); |
| 85 | 97 | PageInfo<ShyActivity> shyActivityPageInfo = new PageInfo<>(shyActivities); | ... | ... |
src/main/resources/templates/common/frame.html
| ... | ... | @@ -99,7 +99,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em" |
| 99 | 99 | <li><a href="/email/page" id="/email/page"> 邮件消息管理</a></li> |
| 100 | 100 | <li><a href="/usersFree/page" id="/usersFree/page"> 网++白名单管理</a></li> |
| 101 | 101 | <li><a href="/notSpeak/page" id="/notSpeak/page"> 网++禁言管理</a></li> |
| 102 | - <li><a href="/activity/page" id="/activity/page"> 活动管理</a></li> | |
| 102 | +<!-- <li><a href="/activity/page" id="/activity/page"> 活动管理</a></li>--> | |
| 103 | 103 | </ul> |
| 104 | 104 | </li> |
| 105 | 105 | </ul> | ... | ... |
src/main/resources/templates/page/activity.html
| ... | ... | @@ -101,7 +101,7 @@ |
| 101 | 101 | </div> |
| 102 | 102 | <div class="col-md-6 pull-right" style="padding: 0; width: 5%;"> |
| 103 | 103 | <button class="btn btn-default" type="button" name="refresh" |
| 104 | - title="搜索" id="emailQuery">搜索 | |
| 104 | + title="搜索" id="QueryAll">搜索 | |
| 105 | 105 | </button> |
| 106 | 106 | </div> |
| 107 | 107 | <div class="col-md-6 pull-right" style="padding: 0; width: 20%;"> |
| ... | ... | @@ -109,15 +109,18 @@ |
| 109 | 109 | style="font-size: 15px; top: 8px; font-weight: 100;">活动名称:</label> |
| 110 | 110 | <div class="col-sm-7" style="padding: 0;"> |
| 111 | 111 | <input class="form-control" type="text" th:value="${param.activity}" |
| 112 | - id="email_query"> | |
| 112 | + id="activity_query"> | |
| 113 | 113 | </div> |
| 114 | 114 | </div> |
| 115 | 115 | <div class="col-md-5 pull-right" style="padding: 0; width: 15%;"> |
| 116 | 116 | <label for="sp_id" class="control-label cb-toolbar" |
| 117 | 117 | style="font-size: 15px; top: 8px; font-weight: 100;">是否审核:</label> |
| 118 | 118 | <div class="col-sm-7" style="padding: 0;"> |
| 119 | - <input class="form-control" type="text" th:value="${param.exempt_from_trial}" | |
| 120 | - id="remark_query"> | |
| 119 | + <select class="form-control" id="exempt_from_trial_query" name="exempt_from_trial"> | |
| 120 | + <option value="" name="-选择审核类型-">-选择审核类型-</option> | |
| 121 | + <option value="0" name="未审核">未审免</option> | |
| 122 | + <option value="1" name="已经审核">已经审免</option> | |
| 123 | + </select> | |
| 121 | 124 | </div> |
| 122 | 125 | </div> |
| 123 | 126 | </div> |
| ... | ... | @@ -213,10 +216,11 @@ |
| 213 | 216 | th:text="'共 '+${ShyActivitylist.total}+' 条记录,每页显示'">共 0 条记录</span> |
| 214 | 217 | <select class="" id="pageSize" name="pageSize" |
| 215 | 218 | onchange="selectPageSize()"> |
| 216 | - <option value="10" th:selected="${pageSize==10}">10</option> | |
| 217 | - <option value="20" th:selected="${pageSize==20}">20</option> | |
| 218 | - <option value="50" th:selected="${pageSize==50}">50</option> | |
| 219 | - <option value="100" th:selected="${pageSize==100}">100</option> | |
| 219 | + <option value="10" th:selected="${ShyActivitylist.pageSize==10}">10</option> | |
| 220 | + <option value="20" th:selected="${ShyActivitylist.pageSize==20}">20</option> | |
| 221 | + <option value="50" th:selected="${ShyActivitylist.pageSize==50}">50</option> | |
| 222 | + <option value="100" th:selected="${ShyActivitylist.pageSize==100}">100 | |
| 223 | + </option> | |
| 220 | 224 | </select> <span class="pagination-info">条记录</span> |
| 221 | 225 | </div> |
| 222 | 226 | <div class="pull-right pagination"> |
| ... | ... | @@ -297,11 +301,19 @@ |
| 297 | 301 | </div> |
| 298 | 302 | |
| 299 | 303 | <div class="form-group"> |
| 300 | - <label class="control-label col-sm-3" style="font-size: 15px;">审核类型(0|1):</label> | |
| 304 | + <label class="control-label col-sm-3" style="font-size: 15px;">审核类型:</label> | |
| 301 | 305 | <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> |
| 302 | - <input class="form-control" style="width:40%;" type="text" value="" | |
| 303 | - id="exempt_from_trial" | |
| 304 | - name="exempt_from_trial"> | |
| 306 | + | |
| 307 | + <select class="" id="exempt_from_trial" name="exempt_from_trial"> | |
| 308 | + <option value="" name="-选择审核类型-">-选择审核类型-</option> | |
| 309 | + <option value="0" name="未审核">未审免</option> | |
| 310 | + <option value="1" name="已经审核">已经审免</option> | |
| 311 | + </select> | |
| 312 | + | |
| 313 | + | |
| 314 | + <!-- <input class="form-control" style="width:40%;" type="text" value=""--> | |
| 315 | + <!-- id="exempt_from_trial"--> | |
| 316 | + <!-- name="exempt_from_trial">--> | |
| 305 | 317 | </div> |
| 306 | 318 | </div> |
| 307 | 319 | |
| ... | ... | @@ -344,8 +356,14 @@ |
| 344 | 356 | </div> |
| 345 | 357 | |
| 346 | 358 | <div class="form-group"> |
| 347 | - <label class="control-label col-sm-3" style="font-size: 15px;">审核类型(0|1):</label> | |
| 359 | + <label class="control-label col-sm-3" style="font-size: 15px;">审核类型:</label> | |
| 348 | 360 | <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> |
| 361 | + <!-- <select class="" id="exempt_from_trial1" name="exempt_from_trial">--> | |
| 362 | + <!-- <option value="" name="选择审核类型">审核类型</option>--> | |
| 363 | + <!-- <option value="0" name="未审核">未审核</option>--> | |
| 364 | + <!-- <option value="1" name="已经审核">已经审核</option>--> | |
| 365 | + <!-- </select>--> | |
| 366 | + | |
| 349 | 367 | <input class="form-control" style="width:40%;" type="text" value="0" |
| 350 | 368 | id="exempt_from_trial1" |
| 351 | 369 | name="exempt_from_trial"> |
| ... | ... | @@ -365,11 +383,11 @@ |
| 365 | 383 | </div> |
| 366 | 384 | |
| 367 | 385 | <script> |
| 368 | - | |
| 386 | + // 添加事件 | |
| 369 | 387 | function submitAdd() { |
| 370 | 388 | var activity1 = $("#activity1").val(); |
| 371 | 389 | var exempt_from_trial1 = $("#exempt_from_trial1").val(); |
| 372 | - $.post("/activity/add?activity=" + activity1+"&exempt_from_trial="+exempt_from_trial1, function (data) { | |
| 390 | + $.post("/activity/add?activity=" + activity1 + "&exempt_from_trial=" + exempt_from_trial1, function (data) { | |
| 373 | 391 | if (data.errorCode == 0) { |
| 374 | 392 | alert(data.errorMessage); |
| 375 | 393 | location.href = location.href; |
| ... | ... | @@ -378,11 +396,13 @@ |
| 378 | 396 | } |
| 379 | 397 | }) |
| 380 | 398 | } |
| 399 | + | |
| 400 | + // 修改事件 | |
| 381 | 401 | function submitUpate() { |
| 382 | 402 | var id = $("#id").val(); |
| 383 | 403 | var activity = $("#activity").val(); |
| 384 | 404 | var exempt_from_trial = $("#exempt_from_trial").val(); |
| 385 | - $.post("/activity/update?exempt_from_trial="+ exempt_from_trial+"&activity="+activity+"&id="+id, function (data) { | |
| 405 | + $.post("/activity/update?exempt_from_trial=" + exempt_from_trial + "&activity=" + activity + "&id=" + id, function (data) { | |
| 386 | 406 | if (data.errorCode == 0) { |
| 387 | 407 | alert(data.errorMessage); |
| 388 | 408 | location.href = location.href; |
| ... | ... | @@ -482,10 +502,10 @@ |
| 482 | 502 | } |
| 483 | 503 | } |
| 484 | 504 | |
| 485 | - //搜索 | |
| 486 | - $('#emailQuery').click(function () { | |
| 487 | - var activity = $("#email_query").val(); | |
| 488 | - var exempt_from_trial = $("#remark_query").val(); | |
| 505 | + //搜索事件 | |
| 506 | + $('#QueryAll').click(function () { | |
| 507 | + var activity = $("#activity_query").val(); | |
| 508 | + var exempt_from_trial = $("#exempt_from_trial_query").val(); | |
| 489 | 509 | var pageSize = $("#pageSize").val(); |
| 490 | 510 | window.location.href = "/activity/page?activity=" + activity + "&exempt_from_trial=" + exempt_from_trial + "&pageSize=" + pageSize; |
| 491 | 511 | }); | ... | ... |
src/main/resources/templates/page/video.html
| ... | ... | @@ -140,7 +140,6 @@ |
| 140 | 140 | <label for="state" class="control-label cb-toolbar">分类:</label> |
| 141 | 141 | <div class="col-sm-10" style="padding: 0;"> |
| 142 | 142 | <select class="form-control" id="source" name="source"> |
| 143 | - | |
| 144 | 143 | <option value="" >全部</option> |
| 145 | 144 | <option th:each="activitys : ${activityList}" |
| 146 | 145 | th:selected="${source}==${activitys.id}" | ... | ... |