【8.0】【sys】【role】删掉角色绑定菜单功能的无用方法

pull/57/head
fengshuonan 2023-07-14 23:20:52 +08:00
parent 9e45c6bc8a
commit 4d2fcc0c27
2 changed files with 0 additions and 133 deletions

View File

@ -1,9 +1,7 @@
package cn.stylefeng.roses.kernel.sys.modular.role.service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenuOptions;
import cn.stylefeng.roses.kernel.sys.modular.role.entity.SysRoleMenuOptions;
import cn.stylefeng.roses.kernel.sys.modular.role.pojo.request.SysRoleMenuOptionsRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@ -16,62 +14,6 @@ import java.util.List;
*/
public interface SysRoleMenuOptionsService extends IService<SysRoleMenuOptions> {
/**
*
*
* @param sysRoleMenuOptionsRequest
* @author fengshuonan
* @date 2023/06/10 21:29
*/
void add(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest);
/**
*
*
* @param sysRoleMenuOptionsRequest
* @author fengshuonan
* @date 2023/06/10 21:29
*/
void del(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest);
/**
*
*
* @param sysRoleMenuOptionsRequest
* @author fengshuonan
* @date 2023/06/10 21:29
*/
void edit(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest);
/**
*
*
* @param sysRoleMenuOptionsRequest
* @author fengshuonan
* @date 2023/06/10 21:29
*/
SysRoleMenuOptions detail(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest);
/**
*
*
* @param sysRoleMenuOptionsRequest
* @return List<SysRoleMenuOptions>
* @author fengshuonan
* @date 2023/06/10 21:29
*/
List<SysRoleMenuOptions> findList(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest);
/**
*
*
* @param sysRoleMenuOptionsRequest
* @return PageResult<SysRoleMenuOptions>
* @author fengshuonan
* @date 2023/06/10 21:29
*/
PageResult<SysRoleMenuOptions> findPage(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest);
/**
*
*

View File

@ -1,25 +1,17 @@
package cn.stylefeng.roses.kernel.sys.modular.role.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import cn.stylefeng.roses.kernel.sys.api.callback.RemoveMenuCallbackApi;
import cn.stylefeng.roses.kernel.sys.api.callback.RemoveRoleCallbackApi;
import cn.stylefeng.roses.kernel.sys.modular.menu.entity.SysMenuOptions;
import cn.stylefeng.roses.kernel.sys.modular.role.action.RoleAssignOperateAction;
import cn.stylefeng.roses.kernel.sys.modular.role.entity.SysRoleMenuOptions;
import cn.stylefeng.roses.kernel.sys.modular.role.enums.PermissionNodeTypeEnum;
import cn.stylefeng.roses.kernel.sys.modular.role.enums.exception.SysRoleMenuOptionsExceptionEnum;
import cn.stylefeng.roses.kernel.sys.modular.role.mapper.SysRoleMenuOptionsMapper;
import cn.stylefeng.roses.kernel.sys.modular.role.pojo.request.RoleBindPermissionRequest;
import cn.stylefeng.roses.kernel.sys.modular.role.pojo.request.SysRoleMenuOptionsRequest;
import cn.stylefeng.roses.kernel.sys.modular.role.service.SysRoleMenuOptionsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
@ -38,38 +30,6 @@ import java.util.stream.Collectors;
public class SysRoleMenuOptionsServiceImpl extends ServiceImpl<SysRoleMenuOptionsMapper, SysRoleMenuOptions> implements
SysRoleMenuOptionsService, RemoveRoleCallbackApi, RoleAssignOperateAction, RemoveMenuCallbackApi {
@Override
public void add(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
SysRoleMenuOptions sysRoleMenuOptions = new SysRoleMenuOptions();
BeanUtil.copyProperties(sysRoleMenuOptionsRequest, sysRoleMenuOptions);
this.save(sysRoleMenuOptions);
}
@Override
public void del(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
SysRoleMenuOptions sysRoleMenuOptions = this.querySysRoleMenuOptions(sysRoleMenuOptionsRequest);
this.removeById(sysRoleMenuOptions.getRoleMenuOptionId());
}
@Override
public void edit(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
SysRoleMenuOptions sysRoleMenuOptions = this.querySysRoleMenuOptions(sysRoleMenuOptionsRequest);
BeanUtil.copyProperties(sysRoleMenuOptionsRequest, sysRoleMenuOptions);
this.updateById(sysRoleMenuOptions);
}
@Override
public SysRoleMenuOptions detail(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
return this.querySysRoleMenuOptions(sysRoleMenuOptionsRequest);
}
@Override
public PageResult<SysRoleMenuOptions> findPage(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
LambdaQueryWrapper<SysRoleMenuOptions> wrapper = createWrapper(sysRoleMenuOptionsRequest);
Page<SysRoleMenuOptions> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
return PageResultFactory.createPageResult(sysRolePage);
}
@Override
public void removeRoleBindOptions(Long optionsId) {
LambdaQueryWrapper<SysRoleMenuOptions> sysRoleMenuOptionsLambdaQueryWrapper = new LambdaQueryWrapper<>();
@ -121,12 +81,6 @@ public class SysRoleMenuOptionsServiceImpl extends ServiceImpl<SysRoleMenuOption
return roleMenuOptions.stream().map(SysRoleMenuOptions::getMenuOptionId).collect(Collectors.toList());
}
@Override
public List<SysRoleMenuOptions> findList(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
LambdaQueryWrapper<SysRoleMenuOptions> wrapper = this.createWrapper(sysRoleMenuOptionsRequest);
return this.list(wrapper);
}
@Override
public void validateHaveRoleBind(Set<Long> beRemovedRoleIdList) {
// none
@ -170,33 +124,4 @@ public class SysRoleMenuOptionsServiceImpl extends ServiceImpl<SysRoleMenuOption
this.remove(queryWrapper);
}
/**
*
*
* @author fengshuonan
* @date 2023/06/10 21:29
*/
private SysRoleMenuOptions querySysRoleMenuOptions(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
SysRoleMenuOptions sysRoleMenuOptions = this.getById(sysRoleMenuOptionsRequest.getRoleMenuOptionId());
if (ObjectUtil.isEmpty(sysRoleMenuOptions)) {
throw new ServiceException(SysRoleMenuOptionsExceptionEnum.SYS_ROLE_MENU_OPTIONS_NOT_EXISTED);
}
return sysRoleMenuOptions;
}
/**
* wrapper
*
* @author fengshuonan
* @date 2023/06/10 21:29
*/
private LambdaQueryWrapper<SysRoleMenuOptions> createWrapper(SysRoleMenuOptionsRequest sysRoleMenuOptionsRequest) {
LambdaQueryWrapper<SysRoleMenuOptions> queryWrapper = new LambdaQueryWrapper<>();
Long roleId = sysRoleMenuOptionsRequest.getRoleId();
queryWrapper.eq(ObjectUtil.isNotNull(roleId), SysRoleMenuOptions::getRoleId, roleId);
return queryWrapper;
}
}