zelong.shao

manager|权限接口调整

...@@ -91,6 +91,8 @@ C:BRANCH 分支 ...@@ -91,6 +91,8 @@ C:BRANCH 分支
91 */ 91 */
92 private String modifyUserName; 92 private String modifyUserName;
93 93
94 + private String hidden;
95 +
94 private static final long serialVersionUID = 1L; 96 private static final long serialVersionUID = 1L;
95 97
96 public Long getId() { 98 public Long getId() {
...@@ -221,6 +223,18 @@ C:BRANCH 分支 ...@@ -221,6 +223,18 @@ C:BRANCH 分支
221 this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim(); 223 this.modifyUserName = modifyUserName == null ? null : modifyUserName.trim();
222 } 224 }
223 225
226 + public String getHidden() {
227 + return hidden;
228 + }
229 +
230 + public void setHidden(String hidden) {
231 + this.hidden = hidden;
232 + }
233 +
234 + public static long getSerialVersionUID() {
235 + return serialVersionUID;
236 + }
237 +
224 @Override 238 @Override
225 public String toString() { 239 public String toString() {
226 StringBuilder sb = new StringBuilder(); 240 StringBuilder sb = new StringBuilder();
......
1 package com.fedex.connect.manager.controller.sys; 1 package com.fedex.connect.manager.controller.sys;
2 2
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 -import org.springframework.web.bind.annotation.PathVariable;
5 4
6 public interface ISysPrivilegeController { 5 public interface ISysPrivilegeController {
7 - ResponseVo getPrivilege(@PathVariable Long userId); 6 + ResponseVo getPrivilege();
8 } 7 }
......
1 package com.fedex.connect.manager.controller.sys.impl; 1 package com.fedex.connect.manager.controller.sys.impl;
2 2
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 +import com.fedex.connect.common.model.sys.User;
4 import com.fedex.connect.manager.controller.base.BaseController; 5 import com.fedex.connect.manager.controller.base.BaseController;
5 import com.fedex.connect.manager.controller.sys.ISysPrivilegeController; 6 import com.fedex.connect.manager.controller.sys.ISysPrivilegeController;
6 import io.swagger.annotations.Api; 7 import io.swagger.annotations.Api;
7 import io.swagger.annotations.ApiOperation; 8 import io.swagger.annotations.ApiOperation;
8 import lombok.extern.slf4j.Slf4j; 9 import lombok.extern.slf4j.Slf4j;
9 import org.springframework.web.bind.annotation.GetMapping; 10 import org.springframework.web.bind.annotation.GetMapping;
10 -import org.springframework.web.bind.annotation.PathVariable;
11 import org.springframework.web.bind.annotation.RequestMapping; 11 import org.springframework.web.bind.annotation.RequestMapping;
12 import org.springframework.web.bind.annotation.RestController; 12 import org.springframework.web.bind.annotation.RestController;
13 13
...@@ -18,9 +18,13 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,9 +18,13 @@ import org.springframework.web.bind.annotation.RestController;
18 public class SysPrivilegeController extends BaseController implements ISysPrivilegeController { 18 public class SysPrivilegeController extends BaseController implements ISysPrivilegeController {
19 19
20 @Override 20 @Override
21 - @GetMapping(value = {"/{userId}"}) 21 + @GetMapping(value = {"/getPrivilege"})
22 - @ApiOperation(value = "根据用户ID获取菜单") 22 + @ApiOperation(value = "获取菜单")
23 - public ResponseVo getPrivilege(@PathVariable Long userId){ 23 + public ResponseVo getPrivilege(){
24 - return privilegeService.getPrivilegeByUserId(userId); 24 + /**
25 + * 获取当前用户信息
26 + */
27 + User user = this.getCurrentUserInfo();
28 + return privilegeService.getPrivilege(user);
25 } 29 }
26 } 30 }
......
1 package com.fedex.connect.manager.service.sys; 1 package com.fedex.connect.manager.service.sys;
2 2
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 +import com.fedex.connect.common.model.sys.User;
4 5
5 public interface IPrivilegeService { 6 public interface IPrivilegeService {
6 - ResponseVo getPrivilegeByUserId(Long id); 7 + ResponseVo getPrivilege(User user);
7 } 8 }
......
...@@ -3,6 +3,7 @@ package com.fedex.connect.manager.service.sys.impl; ...@@ -3,6 +3,7 @@ package com.fedex.connect.manager.service.sys.impl;
3 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 3 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
5 import com.fedex.connect.common.model.sys.Privilege; 5 import com.fedex.connect.common.model.sys.Privilege;
6 +import com.fedex.connect.common.model.sys.User;
6 import com.fedex.connect.common.model.sys.UserRole; 7 import com.fedex.connect.common.model.sys.UserRole;
7 import com.fedex.connect.common.model.sys.UserRoleExample; 8 import com.fedex.connect.common.model.sys.UserRoleExample;
8 import com.fedex.connect.manager.service.base.BaseService; 9 import com.fedex.connect.manager.service.base.BaseService;
...@@ -18,14 +19,14 @@ import java.util.stream.Collectors; ...@@ -18,14 +19,14 @@ import java.util.stream.Collectors;
18 @Slf4j 19 @Slf4j
19 public class PrivilegeServiceImpl extends BaseService implements IPrivilegeService { 20 public class PrivilegeServiceImpl extends BaseService implements IPrivilegeService {
20 21
21 - public ResponseVo getPrivilegeByUserId(Long id){ 22 + public ResponseVo getPrivilege(User user){
22 /** 23 /**
23 * 获取到该用户的角色 24 * 获取到该用户的角色
24 */ 25 */
25 UserRoleExample example = new UserRoleExample(); 26 UserRoleExample example = new UserRoleExample();
26 UserRoleExample.Criteria criteria = example.createCriteria(); 27 UserRoleExample.Criteria criteria = example.createCriteria();
27 criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID); 28 criteria.andStatusEqualTo(DatabaseConstants.GLOBAL_STATUS_VALID);
28 - criteria.andUserIdEqualTo(id); 29 + criteria.andUserIdEqualTo(user.getId());
29 List<UserRole> userRoles = userRoleRepository.selectByExample(example); 30 List<UserRole> userRoles = userRoleRepository.selectByExample(example);
30 /** 31 /**
31 * 根据角色获取菜单权限 32 * 根据角色获取菜单权限
...@@ -40,6 +41,9 @@ public class PrivilegeServiceImpl extends BaseService implements IPrivilegeServi ...@@ -40,6 +41,9 @@ public class PrivilegeServiceImpl extends BaseService implements IPrivilegeServi
40 * 获取权限 41 * 获取权限
41 */ 42 */
42 List<Privilege> privilegesByIds = privilegeRepository.findPrivilegesByIds(byRoleIds); 43 List<Privilege> privilegesByIds = privilegeRepository.findPrivilegesByIds(byRoleIds);
44 + for (Privilege privilegesById : privilegesByIds) {
45 + privilegesById.setHidden("false");
46 + }
43 return responseUtils.success(privilegesByIds); 47 return responseUtils.success(privilegesByIds);
44 } 48 }
45 49
......