Commit 5e7266ed338696cbae39728bd45561c461ccae12

Authored by maliang
1 parent 376099f9ce
Exists in master

删除部分实现方法

Showing 6 changed files with 35 additions and 66 deletions

center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java View file @ 5e7266e
... ... @@ -2,6 +2,7 @@
2 2  
3 3 import java.util.Map;
4 4  
  5 +import org.apache.commons.lang3.StringUtils;
5 6 import org.springframework.beans.factory.annotation.Autowired;
6 7 import org.springframework.stereotype.Controller;
7 8 import org.springframework.ui.Model;
... ... @@ -68,7 +69,7 @@
68 69 @ResponseBody
69 70 public Map<String, Object> list(Model model) {
70 71 Page<SysUsers> page = getPage();
71   - page = userService.getUserByPage(page);
  72 + page = userService.selectPage(page);
72 73 return toGridData(page);
73 74 }
74 75  
... ... @@ -79,8 +80,10 @@
79 80 */
80 81 @RequestMapping(value = { "/{id}/toEdit" }, method = RequestMethod.GET)
81 82 public String toEdit(@PathVariable String id, Model model) {
82   - SysUsers user = userService.getUserById(id);
83   - model.addAttribute("user", user);
  83 + if (!StringUtils.isBlank(id)) {
  84 + SysUsers user = userService.selectById(id);
  85 + model.addAttribute("user", user);
  86 + }
84 87 return "/user/user_edit";
85 88 }
86 89  
center.manager/src/main/java/com/lyms/cm/service/sys/SysRolesService.java View file @ 5e7266e
1 1 package com.lyms.cm.service.sys;
2 2  
3   -import com.baomidou.mybatisplus.plugins.Page;
4 3 import com.lyms.cm.entity.sys.SysRoles;
5 4 import com.lyms.exception.SystemException;
6 5 import com.lyms.web.service.BaseService;
... ... @@ -50,7 +49,8 @@
50 49 * @param page
51 50 * @return
52 51 */
53   - public Page<SysRoles> getRolesByPage(Page<SysRoles> page) throws SystemException;
  52 + // public Page<SysRoles> getRolesByPage(Page<SysRoles> page) throws
  53 + // SystemException;
54 54  
55 55 /**
56 56 * 根据roleId 获取角色信息
... ... @@ -59,7 +59,7 @@
59 59 * @return
60 60 * @throws SystemException
61 61 */
62   - public SysRoles getRoleById(String roleId) throws SystemException;
  62 + // public SysRoles getRoleById(String roleId) throws SystemException;
63 63  
64 64 /**
65 65 * 禁/启用角色
center.manager/src/main/java/com/lyms/cm/service/sys/SysUsersService.java View file @ 5e7266e
1 1 package com.lyms.cm.service.sys;
2 2  
3   -import com.baomidou.mybatisplus.plugins.Page;
4 3 import com.lyms.cm.entity.sys.SysUsers;
5 4 import com.lyms.exception.SystemException;
6 5 import com.lyms.web.service.BaseService;
... ... @@ -40,19 +39,7 @@
40 39 * @return
41 40 * @author maliang
42 41 */
43   - public SysUsers getUserById(String userId) throws SystemException;
44   -
45   - /**
46   - * 分页获取用户数据信息
47   - * <p>
48   - * 该方法不携带任何过滤信息
49   - *
50   - * @param page
51   - * 分页对象
52   - * @return
53   - * @throws SystemException
54   - */
55   - public Page<SysUsers> getUserByPage(Page<SysUsers> page) throws SystemException;
  42 + // public SysUsers getUserById(String userId) throws SystemException;
56 43  
57 44 /**
58 45 * 启用/停用
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysRolesServiceImpl.java View file @ 5e7266e
1 1 package com.lyms.cm.service.sys.impl;
2 2  
3   -import java.util.List;
4   -
5 3 import org.apache.commons.lang3.StringUtils;
6 4 import org.springframework.beans.factory.annotation.Autowired;
7 5 import org.springframework.stereotype.Service;
8 6 import org.springframework.transaction.annotation.Transactional;
9 7  
10   -import com.baomidou.mybatisplus.plugins.Page;
11 8 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
12 9 import com.lyms.cm.dao.sys.SysRolesMapper;
13 10 import com.lyms.cm.entity.sys.SysRoles;
14 11  
15 12  
16 13  
... ... @@ -80,30 +77,27 @@
80 77 return false;
81 78 }
82 79  
83   - @Override
84   - public Page<SysRoles> getRolesByPage(Page<SysRoles> page) throws SystemException {
  80 + /*
  81 + * @Override public Page<SysRoles> getRolesByPage(Page<SysRoles> page)
  82 + * throws SystemException {
  83 + *
  84 + * if (page == null) return null;
  85 + *
  86 + * // TODO 添加参数过滤 List<SysRoles> roles = roleMapper.selectPage(page, null);
  87 + * page.setRecords(roles);
  88 + *
  89 + * return page; }
  90 + *
  91 + * @Override public SysRoles getRoleById(String roleId) throws
  92 + * SystemException { if (StringUtils.isBlank(roleId)) return null; return
  93 + * roleMapper.selectById(roleId); }
  94 + */
85 95  
86   - if (page == null)
87   - return null;
88   -
89   - // TODO 添加参数过滤
90   - List<SysRoles> roles = roleMapper.selectPage(page, null);
91   - page.setRecords(roles);
92   -
93   - return page;
94   - }
95   -
  96 + @Transactional
96 97 @Override
97   - public SysRoles getRoleById(String roleId) throws SystemException {
98   - if (StringUtils.isBlank(roleId))
99   - return null;
100   - return roleMapper.selectById(roleId);
101   - }
102   -
103   - @Override
104 98 public boolean enable(String roleId) throws SystemException {
105 99  
106   - SysRoles role = this.getRoleById(roleId);
  100 + SysRoles role = this.selectById(roleId);
107 101  
108 102 if (empty(role))
109 103 return false;
center.manager/src/main/java/com/lyms/cm/service/sys/impl/SysUsersServiceImpl.java View file @ 5e7266e
1 1 package com.lyms.cm.service.sys.impl;
2 2  
3   -import java.util.List;
4   -
5 3 import org.apache.commons.lang3.StringUtils;
6 4 import org.springframework.beans.factory.annotation.Autowired;
7 5 import org.springframework.stereotype.Service;
8 6 import org.springframework.transaction.annotation.Transactional;
9 7  
10   -import com.baomidou.mybatisplus.plugins.Page;
11 8 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
12 9 import com.lyms.cm.dao.sys.SysUsersMapper;
13 10 import com.lyms.cm.entity.sys.SysUsers;
14 11  
... ... @@ -83,18 +80,17 @@
83 80 return tag != null && tag >= 1;
84 81 }
85 82  
86   - @Override
87   - public SysUsers getUserById(String userId) throws SystemException {
88   - if (StringUtils.isBlank(userId))
89   - return null;
90   - return userMapper.selectById(userId);
91   - }
  83 + /*
  84 + * @Override public SysUsers getUserById(String userId) throws
  85 + * SystemException { if (StringUtils.isBlank(userId)) return null; return
  86 + * userMapper.selectById(userId); }
  87 + */
92 88  
93 89 @Override
94 90 @Transactional
95 91 public boolean enabled(String userId) throws SystemException {
96 92 // TODO 编写SQL 修改
97   - SysUsers user = this.getUserById(userId);
  93 + SysUsers user = this.selectById(userId);
98 94 if (empty(user))
99 95 return false;
100 96  
... ... @@ -105,17 +101,6 @@
105 101 user.setEnable(StatusEnum.ENABLED.getStatus());
106 102 }
107 103 return this.updateUser(user);
108   - }
109   -
110   - @Override
111   - public Page<SysUsers> getUserByPage(Page<SysUsers> page) throws SystemException {
112   -
113   - if (page == null)
114   - return null;
115   - // TODO 添加过过滤条件
116   - List<SysUsers> users = userMapper.selectPage(page, null);
117   - page.setRecords(users);
118   - return page;
119 104 }
120 105  
121 106 @Override
center.manager/src/test/java/center/manager/test/user/UserTest.java View file @ 5e7266e
... ... @@ -38,7 +38,7 @@
38 38 @Test
39 39 public void updateUserTest() {
40 40  
41   - SysUsers user = userService.getUserById("6204903E7E1741688350349EF920ED88");
  41 + SysUsers user = userService.selectById("6204903E7E1741688350349EF920ED88");
42 42 user.setName("hellow");
43 43 boolean tag = userService.updateUser(user);
44 44 System.out.println(tag);
... ... @@ -53,7 +53,7 @@
53 53 @Test
54 54 public void selectUserByPage() {
55 55 Page<SysUsers> page = new Page<>(1, 1);
56   - Page<SysUsers> result = userService.getUserByPage(page);
  56 + Page<SysUsers> result = userService.selectPage(page);
57 57 System.out.println(result.getRecords().size());
58 58 System.out.println(ToStringBuilder.reflectionToString(result));
59 59 }