fix:系统管理相关接口报错修复
parent
4822a8ee50
commit
3632d15485
|
@ -32,8 +32,10 @@ public class MapstructUtils {
|
|||
* @return desc
|
||||
*/
|
||||
public static <T, V> V convert(T source, Class<V> desc) {
|
||||
Assert.notNull(source, "source is null");
|
||||
Assert.notNull(desc, "desc is null");
|
||||
if (source == null) {
|
||||
return null;
|
||||
}
|
||||
return CONVERTER.convert(source, desc);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,13 +61,12 @@ public class SysRoleDataImpl implements ISysRoleData, IJPACommData<SysRole, Long
|
|||
|
||||
@Override
|
||||
public SysRole findById(Long id) {
|
||||
return MapstructUtils.convert(sysRoleRepository.findById(id), SysRole.class);
|
||||
return MapstructUtils.convert(sysRoleRepository.findById(id).orElse(null), SysRole.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> selectMenuListByRoleId(Long roleId, boolean menuCheckStrictly) {
|
||||
|
||||
List<Long> roleIds = jpaQueryFactory.select(Projections.bean(Long.class, tbSysMenu.id))
|
||||
List<Long> roleIds = jpaQueryFactory.select(Projections.fields(tbSysMenu.id))
|
||||
.from(tbSysMenu)
|
||||
.innerJoin(tbSysRoleMenu).on(tbSysMenu.id.eq(tbSysRoleMenu.menuId))
|
||||
.where(PredicateBuilder.instance()
|
||||
|
|
|
@ -74,8 +74,8 @@ public class SysMenuController extends BaseController {
|
|||
TenantConstants.TENANT_ADMIN_ROLE_KEY
|
||||
}, mode = SaMode.OR)
|
||||
@SaCheckPermission("system:menu:query")
|
||||
@PostMapping(value = "/getDetail")
|
||||
public SysMenuVo getInfo(@PathVariable Request<Long> menuId) {
|
||||
@PostMapping(value = "/getInfo")
|
||||
public SysMenuVo getInfo(@RequestBody Request<Long> menuId) {
|
||||
return menuService.selectMenuById(menuId.getData());
|
||||
}
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ public class SysPostController extends BaseController {
|
|||
*/
|
||||
@ApiOperation("根据岗位编号获取详细信息")
|
||||
@SaCheckPermission("system:post:query")
|
||||
@PostMapping(value = "/getDetail")
|
||||
public SysPostVo getInfo(@PathVariable Request<Long> postId) {
|
||||
@PostMapping(value = "/getInfo")
|
||||
public SysPostVo getInfo(@RequestBody @Validated Request<Long> postId) {
|
||||
return postService.selectPostById(postId.getData());
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class SysPostController extends BaseController {
|
|||
@SaCheckPermission("system:post:add")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
public void add(@RequestBody @Validated(EditGroup.class)Request<SysPostBo> post) {
|
||||
public void add(@RequestBody @Validated(EditGroup.class) Request<SysPostBo> post) {
|
||||
if (!postService.checkPostNameUnique(post.getData())) {
|
||||
fail("新增岗位'" + post.getData().getPostName() + "'失败,岗位名称已存在");
|
||||
} else if (!postService.checkPostCodeUnique(post.getData())) {
|
||||
|
@ -111,8 +111,8 @@ public class SysPostController extends BaseController {
|
|||
@ApiOperation("删除岗位")
|
||||
@SaCheckPermission("system:post:remove")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping("/{postIds}")
|
||||
public void remove(@PathVariable @Validated(EditGroup.class) Request<Collection> postIds) {
|
||||
@PostMapping("/delete")
|
||||
public void remove(@RequestBody @Validated Request<List<Long>> postIds) {
|
||||
postService.deletePostByIds(postIds.getData());
|
||||
}
|
||||
|
||||
|
|
|
@ -58,20 +58,19 @@ public class SysRoleController extends BaseController {
|
|||
@ApiOperation(value = "导出角色信息列表", notes = "导出角色信息列表")
|
||||
@SaCheckPermission("system:role:export")
|
||||
@PostMapping("/export")
|
||||
public void export(@RequestBody @Validated Request<SysRoleBo> role, HttpServletResponse response) {
|
||||
public void export(@RequestBody @Validated Request<SysRoleBo> role, HttpServletResponse response) {
|
||||
List<SysRoleVo> list = roleService.selectRoleList(role.getData());
|
||||
ExcelUtil.exportExcel(list, "角色数据", SysRoleVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
*/
|
||||
@ApiOperation(value = "根据角色编号获取详细信息", notes = "根据角色编号获取详细信息")
|
||||
@SaCheckPermission("system:role:query")
|
||||
@PostMapping(value = "/{roleId}")
|
||||
public SysRoleVo getInfo(@PathVariable Long roleId) {
|
||||
@PostMapping(value = "/getInfo")
|
||||
public SysRoleVo getInfo(@Validated @RequestBody Request<Long> bo) {
|
||||
Long roleId = bo.getData();
|
||||
roleService.checkRoleDataScope(roleId);
|
||||
return roleService.selectRoleById(roleId);
|
||||
}
|
||||
|
@ -149,8 +148,6 @@ public class SysRoleController extends BaseController {
|
|||
|
||||
/**
|
||||
* 删除角色
|
||||
*
|
||||
|
||||
*/
|
||||
@ApiOperation(value = "删除角色", notes = "删除角色")
|
||||
@SaCheckPermission("system:role:remove")
|
||||
|
@ -186,8 +183,8 @@ public class SysRoleController extends BaseController {
|
|||
@ApiOperation(value = "查询未分配用户角色列表", notes = "查询未分配用户角色列表")
|
||||
@SaCheckPermission("system:role:list")
|
||||
@PostMapping("/authUser/unallocatedList")
|
||||
public Paging<SysUserVo> unallocatedList( PageRequest<SysUserBo> query) {
|
||||
return userService.selectUnallocatedList( query);
|
||||
public Paging<SysUserVo> unallocatedList(PageRequest<SysUserBo> query) {
|
||||
return userService.selectUnallocatedList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -125,7 +125,8 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
|||
@Override
|
||||
public List<Long> selectMenuListByRoleId(Long roleId) {
|
||||
SysRole role = sysRoleData.findById(roleId);
|
||||
return sysRoleData.selectMenuListByRoleId(roleId, role.getMenuCheckStrictly());
|
||||
Boolean flag = role.getMenuCheckStrictly();
|
||||
return sysRoleData.selectMenuListByRoleId(roleId, flag != null && flag);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue