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,6 +3,7 @@ package com.cnlive.shenhe.controller; | ||
| 3 | 3 | ||
| 4 | import com.cnlive.shenhe.bean.ErrorEnum; | 4 | import com.cnlive.shenhe.bean.ErrorEnum; |
| 5 | import com.cnlive.shenhe.bean.ResponseBean; | 5 | import com.cnlive.shenhe.bean.ResponseBean; |
| 6 | +import com.cnlive.shenhe.dto.ShyActivityDTO; | ||
| 6 | import com.cnlive.shenhe.entity.ShyActivity; | 7 | import com.cnlive.shenhe.entity.ShyActivity; |
| 7 | import com.cnlive.shenhe.serviceImpl.ShyActivityImpl; | 8 | import com.cnlive.shenhe.serviceImpl.ShyActivityImpl; |
| 8 | import com.cnlive.shenhe.utils.CommonConst; | 9 | import com.cnlive.shenhe.utils.CommonConst; |
| @@ -61,8 +62,8 @@ public class ShyActivityController { | @@ -61,8 +62,8 @@ public class ShyActivityController { | ||
| 61 | } | 62 | } |
| 62 | 63 | ||
| 63 | @GetMapping("/page") | 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 | model.addAttribute("ShyActivitylist", shyActivityPageInfo); | 67 | model.addAttribute("ShyActivitylist", shyActivityPageInfo); |
| 67 | return "page/activity.html"; | 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 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.cnlive.shenhe.dto.ShyActivityDTO; | ||
| 4 | import com.cnlive.shenhe.entity.ShyActivity; | 5 | import com.cnlive.shenhe.entity.ShyActivity; |
| 5 | import com.cnlive.shenhe.mapper.ShyActivityMapper; | 6 | import com.cnlive.shenhe.mapper.ShyActivityMapper; |
| 6 | import com.cnlive.shenhe.utils.CommonUtils; | 7 | import com.cnlive.shenhe.utils.CommonUtils; |
| @@ -71,15 +72,26 @@ public class ShyActivityImpl { | @@ -71,15 +72,26 @@ public class ShyActivityImpl { | ||
| 71 | 72 | ||
| 72 | /** | 73 | /** |
| 73 | * 查询活动 | 74 | * 查询活动 |
| 74 | - * | ||
| 75 | * @param pageNum | 75 | * @param pageNum |
| 76 | * @param pageSize | 76 | * @param pageSize |
| 77 | * @return | 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 | Example example = new Example(ShyActivity.class); | 80 | Example example = new Example(ShyActivity.class); |
| 81 | + //如果为空 按照倒序排序 分页查询所有 | ||
| 82 | + //以创建时间为条件进行倒序 | ||
| 83 | + example.setOrderByClause("`create_time` desc"); | ||
| 84 | + | ||
| 81 | Example.Criteria criteria = example.createCriteria(); | 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 | PageHelper.startPage(pageNum, pageSize, true); | 95 | PageHelper.startPage(pageNum, pageSize, true); |
| 84 | List<ShyActivity> shyActivities = ShyActivityMapper.selectByExample(example); | 96 | List<ShyActivity> shyActivities = ShyActivityMapper.selectByExample(example); |
| 85 | PageInfo<ShyActivity> shyActivityPageInfo = new PageInfo<>(shyActivities); | 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,7 +99,7 @@ line-height: 2em; margin: 0 auto;font-size: 2em" | ||
| 99 | <li><a href="/email/page" id="/email/page"> 邮件消息管理</a></li> | 99 | <li><a href="/email/page" id="/email/page"> 邮件消息管理</a></li> |
| 100 | <li><a href="/usersFree/page" id="/usersFree/page"> 网++白名单管理</a></li> | 100 | <li><a href="/usersFree/page" id="/usersFree/page"> 网++白名单管理</a></li> |
| 101 | <li><a href="/notSpeak/page" id="/notSpeak/page"> 网++禁言管理</a></li> | 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 | </ul> | 103 | </ul> |
| 104 | </li> | 104 | </li> |
| 105 | </ul> | 105 | </ul> |
src/main/resources/templates/page/activity.html
| @@ -101,7 +101,7 @@ | @@ -101,7 +101,7 @@ | ||
| 101 | </div> | 101 | </div> |
| 102 | <div class="col-md-6 pull-right" style="padding: 0; width: 5%;"> | 102 | <div class="col-md-6 pull-right" style="padding: 0; width: 5%;"> |
| 103 | <button class="btn btn-default" type="button" name="refresh" | 103 | <button class="btn btn-default" type="button" name="refresh" |
| 104 | - title="搜索" id="emailQuery">搜索 | 104 | + title="搜索" id="QueryAll">搜索 |
| 105 | </button> | 105 | </button> |
| 106 | </div> | 106 | </div> |
| 107 | <div class="col-md-6 pull-right" style="padding: 0; width: 20%;"> | 107 | <div class="col-md-6 pull-right" style="padding: 0; width: 20%;"> |
| @@ -109,15 +109,18 @@ | @@ -109,15 +109,18 @@ | ||
| 109 | style="font-size: 15px; top: 8px; font-weight: 100;">活动名称:</label> | 109 | style="font-size: 15px; top: 8px; font-weight: 100;">活动名称:</label> |
| 110 | <div class="col-sm-7" style="padding: 0;"> | 110 | <div class="col-sm-7" style="padding: 0;"> |
| 111 | <input class="form-control" type="text" th:value="${param.activity}" | 111 | <input class="form-control" type="text" th:value="${param.activity}" |
| 112 | - id="email_query"> | 112 | + id="activity_query"> |
| 113 | </div> | 113 | </div> |
| 114 | </div> | 114 | </div> |
| 115 | <div class="col-md-5 pull-right" style="padding: 0; width: 15%;"> | 115 | <div class="col-md-5 pull-right" style="padding: 0; width: 15%;"> |
| 116 | <label for="sp_id" class="control-label cb-toolbar" | 116 | <label for="sp_id" class="control-label cb-toolbar" |
| 117 | style="font-size: 15px; top: 8px; font-weight: 100;">是否审核:</label> | 117 | style="font-size: 15px; top: 8px; font-weight: 100;">是否审核:</label> |
| 118 | <div class="col-sm-7" style="padding: 0;"> | 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 | </div> | 124 | </div> |
| 122 | </div> | 125 | </div> |
| 123 | </div> | 126 | </div> |
| @@ -213,10 +216,11 @@ | @@ -213,10 +216,11 @@ | ||
| 213 | th:text="'共 '+${ShyActivitylist.total}+' 条记录,每页显示'">共 0 条记录</span> | 216 | th:text="'共 '+${ShyActivitylist.total}+' 条记录,每页显示'">共 0 条记录</span> |
| 214 | <select class="" id="pageSize" name="pageSize" | 217 | <select class="" id="pageSize" name="pageSize" |
| 215 | onchange="selectPageSize()"> | 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 | </select> <span class="pagination-info">条记录</span> | 224 | </select> <span class="pagination-info">条记录</span> |
| 221 | </div> | 225 | </div> |
| 222 | <div class="pull-right pagination"> | 226 | <div class="pull-right pagination"> |
| @@ -297,11 +301,19 @@ | @@ -297,11 +301,19 @@ | ||
| 297 | </div> | 301 | </div> |
| 298 | 302 | ||
| 299 | <div class="form-group"> | 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 | <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | 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 | </div> | 317 | </div> |
| 306 | </div> | 318 | </div> |
| 307 | 319 | ||
| @@ -344,8 +356,14 @@ | @@ -344,8 +356,14 @@ | ||
| 344 | </div> | 356 | </div> |
| 345 | 357 | ||
| 346 | <div class="form-group"> | 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 | <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | 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 | <input class="form-control" style="width:40%;" type="text" value="0" | 367 | <input class="form-control" style="width:40%;" type="text" value="0" |
| 350 | id="exempt_from_trial1" | 368 | id="exempt_from_trial1" |
| 351 | name="exempt_from_trial"> | 369 | name="exempt_from_trial"> |
| @@ -365,11 +383,11 @@ | @@ -365,11 +383,11 @@ | ||
| 365 | </div> | 383 | </div> |
| 366 | 384 | ||
| 367 | <script> | 385 | <script> |
| 368 | - | 386 | + // 添加事件 |
| 369 | function submitAdd() { | 387 | function submitAdd() { |
| 370 | var activity1 = $("#activity1").val(); | 388 | var activity1 = $("#activity1").val(); |
| 371 | var exempt_from_trial1 = $("#exempt_from_trial1").val(); | 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 | if (data.errorCode == 0) { | 391 | if (data.errorCode == 0) { |
| 374 | alert(data.errorMessage); | 392 | alert(data.errorMessage); |
| 375 | location.href = location.href; | 393 | location.href = location.href; |
| @@ -378,11 +396,13 @@ | @@ -378,11 +396,13 @@ | ||
| 378 | } | 396 | } |
| 379 | }) | 397 | }) |
| 380 | } | 398 | } |
| 399 | + | ||
| 400 | + // 修改事件 | ||
| 381 | function submitUpate() { | 401 | function submitUpate() { |
| 382 | var id = $("#id").val(); | 402 | var id = $("#id").val(); |
| 383 | var activity = $("#activity").val(); | 403 | var activity = $("#activity").val(); |
| 384 | var exempt_from_trial = $("#exempt_from_trial").val(); | 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 | if (data.errorCode == 0) { | 406 | if (data.errorCode == 0) { |
| 387 | alert(data.errorMessage); | 407 | alert(data.errorMessage); |
| 388 | location.href = location.href; | 408 | location.href = location.href; |
| @@ -482,10 +502,10 @@ | @@ -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 | var pageSize = $("#pageSize").val(); | 509 | var pageSize = $("#pageSize").val(); |
| 490 | window.location.href = "/activity/page?activity=" + activity + "&exempt_from_trial=" + exempt_from_trial + "&pageSize=" + pageSize; | 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,7 +140,6 @@ | ||
| 140 | <label for="state" class="control-label cb-toolbar">分类:</label> | 140 | <label for="state" class="control-label cb-toolbar">分类:</label> |
| 141 | <div class="col-sm-10" style="padding: 0;"> | 141 | <div class="col-sm-10" style="padding: 0;"> |
| 142 | <select class="form-control" id="source" name="source"> | 142 | <select class="form-control" id="source" name="source"> |
| 143 | - | ||
| 144 | <option value="" >全部</option> | 143 | <option value="" >全部</option> |
| 145 | <option th:each="activitys : ${activityList}" | 144 | <option th:each="activitys : ${activityList}" |
| 146 | th:selected="${source}==${activitys.id}" | 145 | th:selected="${source}==${activitys.id}" |