Commit 5687bfc4208be8192d8c294a514377640a2ad95b
1 parent
62692ed561
Exists in
master
and in
8 other branches
增加退出登录接口
Showing 1 changed file with 12 additions and 4 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
5687bfc
... | ... | @@ -13,8 +13,11 @@ |
13 | 13 | import com.lyms.platform.permission.model.*; |
14 | 14 | import com.lyms.platform.permission.service.*; |
15 | 15 | import org.apache.commons.lang.StringUtils; |
16 | +import org.slf4j.Logger; | |
17 | +import org.slf4j.LoggerFactory; | |
16 | 18 | import org.springframework.beans.factory.annotation.Autowired; |
17 | 19 | import org.springframework.stereotype.Controller; |
20 | +import org.springframework.util.StopWatch; | |
18 | 21 | import org.springframework.web.bind.annotation.*; |
19 | 22 | |
20 | 23 | import javax.servlet.http.HttpServletRequest; |
... | ... | @@ -26,7 +29,7 @@ |
26 | 29 | */ |
27 | 30 | @Controller |
28 | 31 | public class RolesController extends BaseController { |
29 | - | |
32 | + private Logger logger = LoggerFactory.getLogger("DAL-MONITOR"); | |
30 | 33 | @Autowired |
31 | 34 | private RolesService rolesService; |
32 | 35 | @Autowired |
33 | 36 | |
34 | 37 | |
... | ... | @@ -50,17 +53,19 @@ |
50 | 53 | @RequestParam(value = "id") Integer id, |
51 | 54 | @RequestParam(value = "ids") String ids) { |
52 | 55 | |
53 | - | |
56 | + StopWatch stopWatch = new StopWatch(); | |
57 | + stopWatch.start("get role by id"); | |
54 | 58 | //判断是否存在该角色 |
55 | 59 | Roles roles = rolesService.getRoles(id); |
56 | 60 | if(null == roles || id == null || StringUtils.isBlank(ids)) { |
57 | 61 | ResultUtils.buildParameterErrorResultAndWrite(response); |
58 | 62 | return; |
59 | 63 | } |
60 | - | |
64 | + stopWatch.stop(); | |
61 | 65 | //修改映射表数据,先删除后修改 |
62 | 66 | RolePermissionMapsQuery rolePermissionMapsQuery = new RolePermissionMapsQuery(); |
63 | 67 | rolePermissionMapsQuery.setRoleId(roles.getId()); |
68 | + stopWatch.start("get role by id"); | |
64 | 69 | List<RolePermissionMaps> rolePermissionMapses = rolePermissionMapsService.queryRolePermissionMaps(rolePermissionMapsQuery); |
65 | 70 | if(null != rolePermissionMapses) { |
66 | 71 | for(RolePermissionMaps rolePermissionMaps : rolePermissionMapses) { |
67 | 72 | |
68 | 73 | |
... | ... | @@ -68,10 +73,11 @@ |
68 | 73 | rolePermissionMapsService.updateRolePermissionMaps(rolePermissionMaps); |
69 | 74 | } |
70 | 75 | } |
76 | + stopWatch.stop(); | |
71 | 77 | |
72 | - | |
73 | 78 | RolePermissionMaps rolePermissionMaps = null; |
74 | 79 | String[] roleArrayIds = ids.split(","); |
80 | + stopWatch.start("permissionsService.getPermissions by id"); | |
75 | 81 | for (String tmp : roleArrayIds) { |
76 | 82 | Permissions permissions = permissionsService.getPermissions(Integer.valueOf(tmp)); |
77 | 83 | //权限是否存在 |
... | ... | @@ -87,6 +93,8 @@ |
87 | 93 | rolePermissionMapsService.addRolePermissionMaps(rolePermissionMaps); |
88 | 94 | } |
89 | 95 | } |
96 | + stopWatch.stop(); | |
97 | + logger.info(stopWatch.toString()); | |
90 | 98 | ResultUtils.buildSuccessResultAndWrite(response); |
91 | 99 | |
92 | 100 | } |