diff --git a/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/RoleVo.java b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/RoleVo.java new file mode 100644 index 000000000..29bb17952 --- /dev/null +++ b/pigx-upms/pigx-upms-api/src/main/java/com/pig4cloud/pigx/admin/api/vo/RoleVo.java @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2018-2025, lengleng All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * Neither the name of the pig4cloud.com developer nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * Author: lengleng (wangiegie@gmail.com) + */ + +package com.pig4cloud.pigx.admin.api.vo; + +import io.swagger.annotations.ApiModel; +import lombok.Data; + +/** + * @author lengleng + * @date 2020/2/10 + */ +@Data +@ApiModel(value = "前端角色展示对象") +public class RoleVo { + /** + * 角色id + */ + private Integer roleId; + + /** + * 菜单列表 + */ + private String menuIds; +} diff --git a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysRoleController.java b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysRoleController.java index db9ad7ff8..2fef70850 100644 --- a/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysRoleController.java +++ b/pigx-upms/pigx-upms-biz/src/main/java/com/pig4cloud/pigx/admin/controller/SysRoleController.java @@ -22,6 +22,7 @@ package com.pig4cloud.pigx.admin.controller; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.pig4cloud.pigx.admin.api.entity.SysRole; +import com.pig4cloud.pigx.admin.api.vo.RoleVo; import com.pig4cloud.pigx.admin.service.SysRoleMenuService; import com.pig4cloud.pigx.admin.service.SysRoleService; import com.pig4cloud.pigx.common.core.util.R; @@ -36,7 +37,7 @@ import java.util.List; /** * @author lengleng - * @date 2017/11/5 + * @date 2020-02-10 */ @RestController @AllArgsConstructor @@ -120,16 +121,16 @@ public class SysRoleController { /** * 更新角色菜单 * - * @param roleId 角色ID - * @param menuIds 菜单ID拼成的字符串,每个id之间根据逗号分隔 + * @param roleVo 角色对象 * @return success、false */ @SysLog("更新角色菜单") @PutMapping("/menu") @PreAuthorize("@pms.hasPermission('sys_role_perm')") - public R saveRoleMenus(Integer roleId, @RequestParam(value = "menuIds", required = false) String menuIds) { - SysRole sysRole = sysRoleService.getById(roleId); - return R.ok(sysRoleMenuService.saveRoleMenus(sysRole.getRoleCode(), roleId, menuIds)); + public R saveRoleMenus(@RequestBody RoleVo roleVo) { + SysRole sysRole = sysRoleService.getById(roleVo.getRoleId()); + return R.ok(sysRoleMenuService.saveRoleMenus(sysRole.getRoleCode() + , roleVo.getRoleId(), roleVo.getMenuIds())); } /**