Commit 095a01aa341c9360902d5e59ab41e6b125ed154d
1 parent
277a42406b
Exists in
master
and in
1 other branch
platform permission
add paging
Showing 2 changed files with 13 additions and 18 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/PermissionsController.java
View file @
095a01a
| ... | ... | @@ -61,14 +61,16 @@ |
| 61 | 61 | */ |
| 62 | 62 | @RequestMapping(value = "/permissions", method = RequestMethod.GET) |
| 63 | 63 | @TokenRequired |
| 64 | - public void getPermissions(HttpServletResponse response, @RequestParam(value = "type") Integer type) { | |
| 64 | + public void getPermissions(HttpServletResponse response) { | |
| 65 | 65 | PermissionsQuery permissionsQuery = new PermissionsQuery(); |
| 66 | - permissionsQuery.setType(type); | |
| 67 | 66 | permissionsQuery.setYn(YnEnums.YES.getId()); |
| 68 | 67 | List<Permissions> permissionses = permissionsService.queryPermissions(permissionsQuery); |
| 69 | 68 | ResultUtils.buildSuccessResultAndWrite(response, permissionses); |
| 70 | 69 | } |
| 71 | 70 | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 72 | 74 | @TokenRequired |
| 73 | 75 | @RequestMapping(value = "/accesspermissions", method = RequestMethod.GET) |
| 74 | 76 | @ResponseBody |
| ... | ... | @@ -103,9 +105,7 @@ |
| 103 | 105 | @RequestParam(value = "permissionName") String permissionName, |
| 104 | 106 | @RequestParam(value = "action") String action, |
| 105 | 107 | @RequestParam(value = "ext", required = false) String ext, |
| 106 | - @RequestParam(value = "url", required = false) String url, | |
| 107 | - @RequestParam("functionCode") String functionCode, | |
| 108 | - @RequestParam("moduleCode") String moduleCode) { | |
| 108 | + @RequestParam(value = "weight") Integer weight) { | |
| 109 | 109 | if (StringUtils.isEmpty(moduleName) || StringUtils.isEmpty(functionName) || StringUtils.isEmpty(permissionName) || StringUtils.isEmpty(action)) { |
| 110 | 110 | ResultUtils.buildParameterErrorResultAndWrite(response); |
| 111 | 111 | return; |
| 112 | 112 | |
| 113 | 113 | |
| 114 | 114 | |
| ... | ... | @@ -115,20 +115,17 @@ |
| 115 | 115 | LoginContext loginState = (LoginContext) request.getAttribute("loginContext"); |
| 116 | 116 | Users users = usersService.getUsersByLoginCenterId(loginState.getId()); |
| 117 | 117 | |
| 118 | - | |
| 119 | 118 | Permissions permissions = new Permissions(); |
| 120 | 119 | |
| 121 | 120 | permissions.setType(TYPE); |
| 122 | - permissions.setFunctionCode(functionCode); | |
| 123 | - permissions.setModuleCode(moduleCode); | |
| 124 | 121 | permissions.setModuleName(moduleName); |
| 125 | 122 | permissions.setFunctionName(functionName); |
| 126 | 123 | permissions.setPermissionName(permissionName); |
| 127 | 124 | permissions.setAction(action); |
| 128 | 125 | permissions.setExt(ext); |
| 129 | - permissions.setUrl(url); | |
| 130 | 126 | permissions.setPublishId(users.getId()); |
| 131 | 127 | permissions.setPublishName(users.getName()); |
| 128 | + permissions.setWeight(weight); | |
| 132 | 129 | permissions.setYn(YnEnums.YES.getId()); |
| 133 | 130 | permissions.setModified(new Date()); |
| 134 | 131 | permissions.setCreated(new Date()); |
| 135 | 132 | |
| 136 | 133 | |
| ... | ... | @@ -142,14 +139,13 @@ |
| 142 | 139 | @RequestMapping(value = "/permissions/{id}", method = RequestMethod.PUT) |
| 143 | 140 | @TokenRequired |
| 144 | 141 | public void updatePermissions(HttpServletResponse response, |
| 142 | + @PathVariable Integer id, | |
| 145 | 143 | @RequestParam(value = "moduleName") String moduleName, |
| 146 | 144 | @RequestParam(value = "functionName") String functionName, |
| 147 | - @PathVariable Integer id, String permissionName, | |
| 145 | + @RequestParam(value = "permissionName") String permissionName, | |
| 148 | 146 | @RequestParam(value = "action") String action, |
| 149 | 147 | @RequestParam(value = "ext", required = false) String ext, |
| 150 | - @RequestParam(value = "url", required = false) String url, | |
| 151 | - @RequestParam("functionCode") String functionCode, | |
| 152 | - @RequestParam("moduleCode") String moduleCode) { | |
| 148 | + @RequestParam(value = "weight") Integer weight) { | |
| 153 | 149 | |
| 154 | 150 | Permissions permissions = permissionsService.getPermissions(id); |
| 155 | 151 | |
| 156 | 152 | |
| 157 | 153 | |
| ... | ... | @@ -162,16 +158,15 @@ |
| 162 | 158 | ResultUtils.buildParameterErrorResultAndWrite(response); |
| 163 | 159 | return; |
| 164 | 160 | } |
| 165 | - permissions.setFunctionCode(functionCode); | |
| 166 | - permissions.setModuleCode(moduleCode); | |
| 167 | - permissions.setId(id); | |
| 168 | 161 | permissions.setModuleName(moduleName); |
| 169 | 162 | permissions.setFunctionName(functionName); |
| 170 | 163 | permissions.setPermissionName(permissionName); |
| 171 | 164 | permissions.setAction(action); |
| 172 | 165 | permissions.setExt(ext); |
| 173 | - permissions.setUrl(url); | |
| 166 | + permissions.setWeight(weight); | |
| 167 | + permissions.setYn(YnEnums.YES.getId()); | |
| 174 | 168 | permissions.setModified(new Date()); |
| 169 | + | |
| 175 | 170 | permissionsService.updatePermissions(permissions); |
| 176 | 171 | ResultUtils.buildSuccessResultAndWrite(response); |
| 177 | 172 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/RolesController.java
View file @
095a01a