mirror of
https://gitee.com/youlaitech/youlai-mall.git
synced 2024-12-23 13:03:43 +08:00
feat(RoleController.java):保存角色的权限接口重构
This commit is contained in:
parent
7ba31ca204
commit
f9c75b6239
@ -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();
|
||||
|
@ -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;
|
@ -22,7 +22,7 @@ import java.util.List;
|
||||
@RestController
|
||||
@RequestMapping("/api/v2/menus")
|
||||
@RequiredArgsConstructor
|
||||
public class V2MenuController {
|
||||
public class MenuV2Controller {
|
||||
|
||||
private final ISysMenuService menuService;
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user