feat(RoleController.java):保存角色的权限接口重构

This commit is contained in:
有来技术 2021-12-23 00:34:22 +08:00
parent 7ba31ca204
commit f9c75b6239
5 changed files with 9 additions and 5 deletions

View File

@ -152,7 +152,6 @@ public class RoleController {
}
@ApiOperation(value = "修改角色菜单")
@CacheEvict(cacheNames = "system", key = "'routeList'")
@PutMapping(value = "/{roleId}/menus")
public Result updateRoleMenu(
@ -170,7 +169,10 @@ public class RoleController {
@ApiOperation(value = "修改角色权限")
@PutMapping(value = "/{roleId}/permissions")
public Result saveRolePerms(@RequestBody RolePermsForm rolePerms) {
public Result saveRolePerms(
@ApiParam("角色ID") @PathVariable Long roleId,
@RequestBody RolePermsForm rolePerms) {
rolePerms.setRoleId(roleId);
boolean result = iSysRolePermissionService.saveRolePerms(rolePerms);
if (result) {
iSysPermissionService.refreshPermRolesRules();

View File

@ -22,7 +22,7 @@ import java.util.List;
@RestController
@RequestMapping("/api/v2/dict")
@RequiredArgsConstructor
public class V2DictController {
public class DictV2Controller {
private final ISysDictService iSysDictService;
private final ISysDictItemService iSysDictItemService;

View File

@ -22,7 +22,7 @@ import java.util.List;
@RestController
@RequestMapping("/api/v2/menus")
@RequiredArgsConstructor
public class V2MenuController {
public class MenuV2Controller {
private final ISysMenuService menuService;

View File

@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/api/v2/users")
@Slf4j
@RequiredArgsConstructor
public class V2UserController {
public class UserV2Controller {
private final ISysUserService iSysUserService;

View File

@ -7,6 +7,7 @@ import com.youlai.admin.pojo.entity.SysRoleMenu;
import com.youlai.admin.mapper.SysRoleMenuMapper;
import com.youlai.admin.service.ISysRoleMenuService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
@ -21,6 +22,7 @@ public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuMapper, SysRo
}
@Override
@Transactional
public boolean update(Long roleId, List<Long> menuIds) {
boolean result = true;
List<Long> dbMenuIds = this.list(new LambdaQueryWrapper<SysRoleMenu>().eq(SysRoleMenu::getRoleId, roleId))