Commit f27a09d9791a95b606aae49e63e915e021374022

Authored by 郑超
1 parent c59632c7

update

src/main/java/com/cnlive/shenhe/controller/ShyActivityController.java
@@ -53,17 +53,17 @@ public class ShyActivityController { @@ -53,17 +53,17 @@ public class ShyActivityController {
53 @ResponseBody 53 @ResponseBody
54 public ResponseBean updateShyActivity(ShyActivity shyActivity) { 54 public ResponseBean updateShyActivity(ShyActivity shyActivity) {
55 55
56 - int i = shyActivityImpl.updateShyActivity(shyActivity);  
57 - if (i > 0) {  
58 - return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "修改当前活动成功");  
59 - }  
60 - return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "修改失败,请重试"); 56 + int i = shyActivityImpl.updateShyActivity(shyActivity);
  57 + if (i > 0) {
  58 + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "修改当前活动成功");
  59 + }
  60 + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "修改失败,请重试");
61 61
62 } 62 }
63 63
64 @GetMapping("/page") 64 @GetMapping("/page")
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); 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);
67 model.addAttribute("ShyActivitylist", shyActivityPageInfo); 67 model.addAttribute("ShyActivitylist", shyActivityPageInfo);
68 return "page/activity.html"; 68 return "page/activity.html";
69 } 69 }
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;  
5 import com.cnlive.shenhe.entity.ShyActivity; 4 import com.cnlive.shenhe.entity.ShyActivity;
6 import com.cnlive.shenhe.mapper.ShyActivityMapper; 5 import com.cnlive.shenhe.mapper.ShyActivityMapper;
7 import com.cnlive.shenhe.utils.CommonUtils; 6 import com.cnlive.shenhe.utils.CommonUtils;
8 -import com.github.pagehelper.Page;  
9 import com.github.pagehelper.PageHelper; 7 import com.github.pagehelper.PageHelper;
10 import com.github.pagehelper.PageInfo; 8 import com.github.pagehelper.PageInfo;
11 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.stereotype.Service; 10 import org.springframework.stereotype.Service;
13 -import org.springframework.web.bind.annotation.RequestParam;  
14 import tk.mybatis.mapper.entity.Example; 11 import tk.mybatis.mapper.entity.Example;
15 12
16 -import java.security.PublicKey;  
17 import java.util.Date; 13 import java.util.Date;
18 import java.util.List; 14 import java.util.List;
19 15
@@ -72,11 +68,12 @@ public class ShyActivityImpl { @@ -72,11 +68,12 @@ public class ShyActivityImpl {
72 68
73 /** 69 /**
74 * 查询活动 70 * 查询活动
  71 + *
75 * @param pageNum 72 * @param pageNum
76 * @param pageSize 73 * @param pageSize
77 * @return 74 * @return
78 */ 75 */
79 - public PageInfo<ShyActivity> selectByExample(Integer pageNum, Integer pageSize,String activity,String exempt_from_trial) { 76 + public PageInfo<ShyActivity> selectByExample(Integer pageNum, Integer pageSize, String activity, String exemptFromTrial) {
80 Example example = new Example(ShyActivity.class); 77 Example example = new Example(ShyActivity.class);
81 //如果为空 按照倒序排序 分页查询所有 78 //如果为空 按照倒序排序 分页查询所有
82 //以创建时间为条件进行倒序 79 //以创建时间为条件进行倒序
@@ -85,8 +82,8 @@ public class ShyActivityImpl { @@ -85,8 +82,8 @@ public class ShyActivityImpl {
85 Example.Criteria criteria = example.createCriteria(); 82 Example.Criteria criteria = example.createCriteria();
86 83
87 // 如果查询条件不为空 按照条件走模糊查询 84 // 如果查询条件不为空 按照条件走模糊查询
88 - if (CommonUtils.isNotEmpty(String.valueOf(exempt_from_trial))) {  
89 - criteria.andLike("exempt_from_trial", "%" + exempt_from_trial + "%"); 85 + if (CommonUtils.isNotEmpty(exemptFromTrial)) {
  86 + criteria.andLike("exemptFromTrial", "%" + exemptFromTrial + "%");
90 } 87 }
91 // 如果查询条件不为空 按照条件走模糊查询 88 // 如果查询条件不为空 按照条件走模糊查询
92 if (CommonUtils.isNotEmpty(activity)) { 89 if (CommonUtils.isNotEmpty(activity)) {