Commit 39a0aaff8e5289984f3a3614e015beb79dfe360c

Authored by fangcheng
1 parent fa2dc9559c
Exists in master

修改权限

Showing 9 changed files with 30 additions and 20 deletions

parent/base.common/src/main/java/com/lyms/base/common/dao/role/PermissionsMapper.java View file @ 39a0aaf
... ... @@ -3,6 +3,7 @@
3 3 import java.io.Serializable;
4 4 import java.util.List;
5 5  
  6 +import org.apache.ibatis.annotations.Param;
6 7 import org.springframework.stereotype.Repository;
7 8  
8 9 import com.baomidou.mybatisplus.mapper.BaseMapper;
... ... @@ -24,7 +25,7 @@
24 25  
25 26 List<TreeNode> getMenuTreeByPuri(String puri);
26 27  
27   - List<Permissions> getUserPermission(String uid);
  28 + List<Permissions> getUserPermission(@Param("uid")String uid,@Param("type")String type);
28 29  
29 30 }
parent/base.common/src/main/java/com/lyms/base/common/dao/role/PermissionsMapper.xml View file @ 39a0aaf
... ... @@ -33,7 +33,11 @@
33 33 select PERMISSION_ID from SYS_ROLE_PERMISSION_MAPS rp where ROLE_ID in (
34 34 select role_id from SYS_USER_ROLE_MAPS where user_id= #{uid}
35 35 )
36   - ) and type = 1 and ifDel = 0 and enable = 1
  36 + )
  37 + <if test="type!=null and type!=''">
  38 + and type = #{type}
  39 + </if>
  40 + and ifDel = 0 and enable = 1
37 41 </select>
38 42 </mapper>
parent/base.common/src/main/java/com/lyms/base/common/service/role/PermissionsService.java View file @ 39a0aaf
... ... @@ -41,24 +41,26 @@
41 41 /**
42 42 * <li>@Description:权限列表Set,方便Shiro使用
43 43 * <li>@param uid
  44 + * <li>@param type
44 45 * <li>@return
45 46 * <li>创建人:方承
46 47 * <li>创建时间:2017年3月9日
47 48 * <li>修改人:
48 49 * <li>修改时间:
49 50 */
50   - public Set<String> getUserPermissionSet(String uid);
  51 + public Set<String> getUserPermissionSet(String uid,String type);
51 52  
52   - /**
  53 + /**
53 54 * <li>@Description:权限列表Set,方便Shiro使用
54 55 * <li>@param uid
  56 + * <li>@param type
55 57 * <li>@return
56 58 * <li>创建人:方承
57   - * <li>创建时间:2017年3月9
  59 + * <li>创建时间:2017年4月20
58 60 * <li>修改人:
59 61 * <li>修改时间:
60   - */
61   - public List<Permissions> getUserPermission(String uid);
  62 + */
  63 + public List<Permissions> getUserPermission(String uid,String type);
62 64  
63 65 }
parent/base.common/src/main/java/com/lyms/base/common/service/role/impl/PermissionsServiceImpl.java View file @ 39a0aaf
... ... @@ -79,7 +79,7 @@
79 79 @Override
80 80 public List<TreeNode> getPermissionMenuTreeByPuri(String puri, Users user) {
81 81 // 用户权限列表
82   - Map<String, String> permissionsMap = getUserPermissionMap(getUserPermissionSet(user.getId()));
  82 + Map<String, String> permissionsMap = getUserPermissionMap(getUserPermissionSet(user.getId(),"1"));
83 83 // 所有菜单
84 84 List<TreeNode> allMenu = getAllMenuTreeByPuri(puri);
85 85 // 初始化要返回的有权限的菜单
86 86  
87 87  
... ... @@ -143,14 +143,14 @@
143 143 * <li>修改时间:
144 144 */
145 145 @Override
146   - public List<Permissions> getUserPermission(String uid) {
147   - return baseMapper.getUserPermission(uid);
  146 + public List<Permissions> getUserPermission(String uid,String type) {
  147 + return baseMapper.getUserPermission(uid,type);
148 148 }
149 149  
150 150 @Override
151   - public Set<String> getUserPermissionSet(String uid) {
  151 + public Set<String> getUserPermissionSet(String uid,String type) {
152 152 Set<String> pSet = InstanceUtils.newHashSet();
153   - List<Permissions> pList = getUserPermission(uid);
  153 + List<Permissions> pList = getUserPermission(uid,type);
154 154 for (Permissions p : pList) {
155 155 if (StrUtils.isNotEmpty(p.getUri()))
156 156 pSet.add(p.getUri());
parent/center.manager/pom.xml View file @ 39a0aaf
... ... @@ -130,6 +130,8 @@
130 130 <profile>
131 131 <id>online</id>
132 132 <build>
  133 + <plugins>
  134 + </plugins>
133 135 <resources>
134 136 <resource>
135 137 <directory>src/main/resources</directory>
parent/center.manager/src/main/java/com/lyms/cm/shiro/ShiroRealm.java View file @ 39a0aaf
... ... @@ -64,7 +64,7 @@
64 64 if (CollectionUtils.isNotEmpty(roleIdList)) {
65 65 authorizationInfo.setRoles(new HashSet<String>(roleIdList));
66 66 }
67   - authorizationInfo.setStringPermissions(sysPermissionsService.getUserPermissionSet(user.getId()));
  67 + authorizationInfo.setStringPermissions(sysPermissionsService.getUserPermissionSet(user.getId(),"1"));
68 68 return authorizationInfo;
69 69 }
70 70  
parent/core.sdk/src/main/java/com/lyms/web/controller/BaseController.java View file @ 39a0aaf
... ... @@ -11,6 +11,7 @@
11 11  
12 12 import javax.servlet.http.HttpServletRequest;
13 13 import javax.servlet.http.HttpServletResponse;
  14 +import javax.servlet.http.HttpSession;
14 15  
15 16 import org.slf4j.Logger;
16 17 import org.slf4j.LoggerFactory;
... ... @@ -80,6 +81,11 @@
80 81 protected String getParameter(String name) {
81 82 request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
82 83 return request.getParameter(name);
  84 + }
  85 +
  86 + protected HttpSession getSession(){
  87 + request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
  88 + return request.getSession();
83 89 }
84 90  
85 91 /**
parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java View file @ 39a0aaf
... ... @@ -3,6 +3,7 @@
3 3 import java.util.List;
4 4 import java.util.Map;
5 5  
  6 +import javax.servlet.http.HttpServletRequest;
6 7 import javax.servlet.http.HttpServletResponse;
7 8  
8 9 import org.apache.commons.lang3.StringUtils;
... ... @@ -127,7 +128,7 @@
127 128 Map<String, Object> result = InstanceUtils.newHashMap();
128 129 String token = tokenService.createToken(users);
129 130 List<Roles> roles = rolesService.selectBatchIds(usersService.getRoleIdListByUserid(users.getId()));
130   - List<Permissions> permissions = permissionsService.getUserPermission(users.getId());
  131 + List<Permissions> permissions = permissionsService.getUserPermission(users.getId(),null);
131 132 Organizations org = organizationsService.selectById(users.getOrgId());
132 133 result.put("token", token);
133 134 users.setLastLoginTime(DateTimeUtils.getNow());
parent/pom.xml View file @ 39a0aaf
... ... @@ -240,12 +240,6 @@
240 240 <artifactId>bcprov-jdk14</artifactId>
241 241 <version>${bcprov-jdk14.version}</version>
242 242 </dependency>
243   - <!-- 二维码 -->
244   - <dependency>
245   - <groupId>com.google.zxing</groupId>
246   - <artifactId>core</artifactId>
247   - <version>3.2.1</version>
248   - </dependency>
249 243 <!-- 图片处理\sftp\ftp -->
250 244 <dependency>
251 245 <groupId>net.coobird</groupId>