mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 04:29:21 +08:00
fix: 修复权限系统表重命名后的编译和运行问题
- PositionPermissionController 重命名为 PositionPermissionManagementController 解决 bean 命名冲突 - MenuMapper.xml 更新表名 sys_menu_permission_map → sys_menu_permission - 编译通过,API 测试验证成功
This commit is contained in:
-12
@@ -1,12 +0,0 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.position.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.po.PositionCompanyMenuPO;
|
||||
|
||||
/**
|
||||
* 岗位公司菜单权限Mapper接口
|
||||
*/
|
||||
@Mapper
|
||||
public interface PositionCompanyMenuMapper extends BaseMapper<PositionCompanyMenuPO> {
|
||||
}
|
||||
-52
@@ -1,52 +0,0 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.position.model.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 岗位与公司菜单权限关联实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@TableName("org_position_company_menu_map")
|
||||
public class PositionCompanyMenuPO {
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 岗位ID
|
||||
*/
|
||||
@TableField("position_id")
|
||||
private Long positionId;
|
||||
|
||||
/**
|
||||
* 公司菜单权限ID
|
||||
*/
|
||||
@TableField("company_menu_id")
|
||||
private Long companyMenuId;
|
||||
|
||||
/**
|
||||
* 状态(0-停用,1-启用)
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(value = "create_time", fill = FieldFill.INSERT)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
@TableField("create_by")
|
||||
private Long createBy;
|
||||
}
|
||||
-77
@@ -1,77 +0,0 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.position.service;
|
||||
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.dto.BatchAssignPositionMenuDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.vo.PositionMenuVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.menu.model.vo.MenuVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 岗位公司菜单权限服务接口
|
||||
*/
|
||||
public interface PositionCompanyMenuService {
|
||||
|
||||
/**
|
||||
* 批量分配岗位菜单权限
|
||||
*
|
||||
* @param batchAssignDTO 批量分配DTO
|
||||
*/
|
||||
void batchAssignPositionMenus(BatchAssignPositionMenuDTO batchAssignDTO);
|
||||
|
||||
/**
|
||||
* 取消岗位菜单权限
|
||||
*
|
||||
* @param positionId 岗位ID
|
||||
* @param companyMenuId 公司菜单权限ID
|
||||
*/
|
||||
void removePositionMenu(Long positionId, Long companyMenuId);
|
||||
|
||||
/**
|
||||
* 根据岗位ID查询菜单权限列表
|
||||
*
|
||||
* @param positionId 岗位ID
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
List<PositionMenuVO> getMenusByPositionId(Long positionId);
|
||||
|
||||
/**
|
||||
* 根据岗位ID列表查询菜单权限列表
|
||||
*
|
||||
* @param positionIds 岗位ID列表
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
List<PositionMenuVO> getMenusByPositionIds(List<Long> positionIds);
|
||||
|
||||
/**
|
||||
* 检查岗位是否有指定菜单权限
|
||||
*
|
||||
* @param positionId 岗位ID
|
||||
* @param companyMenuId 公司菜单权限ID
|
||||
* @return 是否有权限
|
||||
*/
|
||||
boolean hasPositionMenu(Long positionId, Long companyMenuId);
|
||||
|
||||
/**
|
||||
* 根据职位获取菜单(以MenuVO格式返回,用于动态路由)
|
||||
*
|
||||
* @param positionId 职位ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
List<MenuVO> getPositionMenusForRoute(Long positionId);
|
||||
|
||||
/**
|
||||
* 获取岗位所有公司菜单ID列表
|
||||
*
|
||||
* @param positionId 岗位ID
|
||||
* @return 公司菜单ID列表
|
||||
*/
|
||||
List<Long> getPositionCompanyMenuIds(Long positionId);
|
||||
|
||||
/**
|
||||
* 批量更新岗位公司菜单
|
||||
*
|
||||
* @param positionId 岗位ID
|
||||
* @param companyMenuIds 公司菜单ID列表
|
||||
*/
|
||||
void batchUpdatePositionCompanyMenus(Long positionId, List<Long> companyMenuIds);
|
||||
}
|
||||
-377
@@ -1,377 +0,0 @@
|
||||
package top.xyquan.ecomdmbbackend.modules.org.position.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import top.xyquan.ecomdmbbackend.common.exception.BusinessException;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.mapper.PositionCompanyMenuMapper;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.dto.BatchAssignPositionMenuDTO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.companymenu.model.po.CompanyMenuPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.po.PositionCompanyMenuPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.po.PositionPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.model.vo.PositionMenuVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.companymenu.service.CompanyMenuService;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.service.PositionCompanyMenuService;
|
||||
import top.xyquan.ecomdmbbackend.modules.org.position.service.PositionService;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.menu.model.po.MenuPO;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.menu.model.vo.MenuVO;
|
||||
import top.xyquan.ecomdmbbackend.modules.sys.menu.service.MenuService;
|
||||
import top.xyquan.ecomdmbbackend.utils.CurrentUserContext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 岗位公司菜单权限服务实现类
|
||||
*/
|
||||
@Service
|
||||
public class PositionCompanyMenuServiceImpl extends ServiceImpl<PositionCompanyMenuMapper, PositionCompanyMenuPO>
|
||||
implements PositionCompanyMenuService {
|
||||
|
||||
private final CurrentUserContext currentUserContext;
|
||||
private final PositionService positionService;
|
||||
private final CompanyMenuService companyMenuService;
|
||||
private final MenuService menuService;
|
||||
|
||||
public PositionCompanyMenuServiceImpl(CurrentUserContext currentUserContext,
|
||||
PositionService positionService,
|
||||
CompanyMenuService companyMenuService,
|
||||
MenuService menuService) {
|
||||
this.currentUserContext = currentUserContext;
|
||||
this.positionService = positionService;
|
||||
this.companyMenuService = companyMenuService;
|
||||
this.menuService = menuService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量分配岗位菜单权限
|
||||
* @param batchAssignDTO 批量分配DTO
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchAssignPositionMenus(BatchAssignPositionMenuDTO batchAssignDTO) {
|
||||
Long positionId = batchAssignDTO.getPositionId();
|
||||
List<Long> companyMenuIds = batchAssignDTO.getCompanyMenuIds();
|
||||
|
||||
// 先删除该岗位的所有菜单权限
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> deleteWrapper = new LambdaQueryWrapper<>();
|
||||
deleteWrapper.eq(PositionCompanyMenuPO::getPositionId, positionId);
|
||||
this.remove(deleteWrapper);
|
||||
|
||||
// 批量插入新的菜单权限
|
||||
List<PositionCompanyMenuPO> positionMenus = new ArrayList<>();
|
||||
for (Long companyMenuId : companyMenuIds) {
|
||||
PositionCompanyMenuPO positionMenu = new PositionCompanyMenuPO();
|
||||
positionMenu.setPositionId(positionId);
|
||||
positionMenu.setCompanyMenuId(companyMenuId);
|
||||
positionMenu.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
positionMenus.add(positionMenu);
|
||||
}
|
||||
|
||||
if (!positionMenus.isEmpty()) {
|
||||
this.saveBatch(positionMenus);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位菜单权限
|
||||
* @param positionId 岗位ID
|
||||
* @param companyMenuId 公司菜单权限ID
|
||||
*/
|
||||
@Override
|
||||
public void removePositionMenu(Long positionId, Long companyMenuId) {
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PositionCompanyMenuPO::getPositionId, positionId)
|
||||
.eq(PositionCompanyMenuPO::getCompanyMenuId, companyMenuId);
|
||||
|
||||
boolean result = this.remove(wrapper);
|
||||
if (!result) {
|
||||
throw new BusinessException("岗位菜单权限不存在");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位ID查询菜单权限列表
|
||||
* @param positionId 岗位ID
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
@Override
|
||||
public List<PositionMenuVO> getMenusByPositionId(Long positionId) {
|
||||
// 查询岗位菜单权限关联记录
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PositionCompanyMenuPO::getPositionId, positionId);
|
||||
List<PositionCompanyMenuPO> positionMenus = this.list(wrapper);
|
||||
|
||||
if (positionMenus.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 获取岗位信息
|
||||
PositionPO position = positionService.getById(positionId);
|
||||
if (position == null) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 获取公司菜单ID列表
|
||||
List<Long> companyMenuIds = positionMenus.stream()
|
||||
.map(PositionCompanyMenuPO::getCompanyMenuId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询公司菜单信息
|
||||
LambdaQueryWrapper<CompanyMenuPO> companyMenuWrapper = new LambdaQueryWrapper<>();
|
||||
companyMenuWrapper.in(CompanyMenuPO::getId, companyMenuIds);
|
||||
List<CompanyMenuPO> companyMenus = companyMenuService.list(companyMenuWrapper);
|
||||
|
||||
// 构建映射关系
|
||||
Map<Long, CompanyMenuPO> companyMenuMap = companyMenus.stream()
|
||||
.collect(Collectors.toMap(CompanyMenuPO::getId, cm -> cm));
|
||||
|
||||
// 转换为VO
|
||||
return positionMenus.stream()
|
||||
.map(pm -> {
|
||||
PositionMenuVO vo = new PositionMenuVO();
|
||||
vo.setId(pm.getId());
|
||||
vo.setPositionId(pm.getPositionId());
|
||||
vo.setPositionName(position.getName());
|
||||
vo.setCompanyMenuId(pm.getCompanyMenuId());
|
||||
vo.setCreateTime(pm.getCreateTime());
|
||||
|
||||
CompanyMenuPO companyMenu = companyMenuMap.get(pm.getCompanyMenuId());
|
||||
if (companyMenu != null) {
|
||||
vo.setMenuName(companyMenu.getCustomName());
|
||||
vo.setMenuTitle(companyMenu.getCustomTitle());
|
||||
}
|
||||
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位ID列表查询菜单权限列表
|
||||
* @param positionIds 岗位ID列表
|
||||
* @return 菜单权限列表
|
||||
*/
|
||||
@Override
|
||||
public List<PositionMenuVO> getMenusByPositionIds(List<Long> positionIds) {
|
||||
if (positionIds == null || positionIds.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 查询岗位菜单权限关联记录
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.in(PositionCompanyMenuPO::getPositionId, positionIds);
|
||||
List<PositionCompanyMenuPO> positionMenus = this.list(wrapper);
|
||||
|
||||
if (positionMenus.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 获取岗位信息
|
||||
List<PositionPO> positions = positionService.listByIds(positionIds);
|
||||
Map<Long, PositionPO> positionMap = positions.stream()
|
||||
.collect(Collectors.toMap(PositionPO::getId, p -> p));
|
||||
|
||||
// 获取公司菜单ID列表
|
||||
List<Long> companyMenuIds = positionMenus.stream()
|
||||
.map(PositionCompanyMenuPO::getCompanyMenuId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询公司菜单信息
|
||||
LambdaQueryWrapper<CompanyMenuPO> companyMenuWrapper = new LambdaQueryWrapper<>();
|
||||
companyMenuWrapper.in(CompanyMenuPO::getId, companyMenuIds);
|
||||
List<CompanyMenuPO> companyMenus = companyMenuService.list(companyMenuWrapper);
|
||||
|
||||
// 构建映射关系
|
||||
Map<Long, CompanyMenuPO> companyMenuMap = companyMenus.stream()
|
||||
.collect(Collectors.toMap(CompanyMenuPO::getId, cm -> cm));
|
||||
|
||||
// 转换为VO
|
||||
return positionMenus.stream()
|
||||
.map(pm -> {
|
||||
PositionMenuVO vo = new PositionMenuVO();
|
||||
vo.setId(pm.getId());
|
||||
vo.setPositionId(pm.getPositionId());
|
||||
vo.setCompanyMenuId(pm.getCompanyMenuId());
|
||||
vo.setCreateTime(pm.getCreateTime());
|
||||
|
||||
PositionPO position = positionMap.get(pm.getPositionId());
|
||||
if (position != null) {
|
||||
vo.setPositionName(position.getName());
|
||||
}
|
||||
|
||||
CompanyMenuPO companyMenu = companyMenuMap.get(pm.getCompanyMenuId());
|
||||
if (companyMenu != null) {
|
||||
vo.setMenuName(companyMenu.getCustomName());
|
||||
vo.setMenuTitle(companyMenu.getCustomTitle());
|
||||
}
|
||||
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查岗位是否有指定菜单权限
|
||||
* @param positionId 岗位ID
|
||||
* @param companyMenuId 公司菜单权限ID
|
||||
* @return 是否有权限
|
||||
*/
|
||||
@Override
|
||||
public boolean hasPositionMenu(Long positionId, Long companyMenuId) {
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PositionCompanyMenuPO::getPositionId, positionId)
|
||||
.eq(PositionCompanyMenuPO::getCompanyMenuId, companyMenuId);
|
||||
|
||||
return this.count(wrapper) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据职位获取菜单(以MenuVO格式返回,用于动态路由)
|
||||
* @param positionId 职位ID
|
||||
* @return 菜单列表
|
||||
*/
|
||||
@Override
|
||||
public List<MenuVO> getPositionMenusForRoute(Long positionId) {
|
||||
// 使用现有的方法获取职位菜单权限
|
||||
List<PositionMenuVO> positionMenus = this.getMenusByPositionId(positionId);
|
||||
|
||||
if (positionMenus.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 获取公司菜单ID列表
|
||||
List<Long> companyMenuIds = positionMenus.stream()
|
||||
.map(PositionMenuVO::getCompanyMenuId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询公司菜单信息
|
||||
LambdaQueryWrapper<CompanyMenuPO> companyMenuWrapper = new LambdaQueryWrapper<>();
|
||||
companyMenuWrapper.in(CompanyMenuPO::getId, companyMenuIds)
|
||||
.eq(CompanyMenuPO::getStatus, 1) // 只查询启用的菜单
|
||||
.orderByAsc(CompanyMenuPO::getCustomOrder);
|
||||
|
||||
List<CompanyMenuPO> companyMenus = companyMenuService.list(companyMenuWrapper);
|
||||
|
||||
if (companyMenus.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 获取菜单ID列表
|
||||
List<Long> menuIds = companyMenus.stream()
|
||||
.map(CompanyMenuPO::getMenuId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 查询系统菜单信息
|
||||
LambdaQueryWrapper<MenuPO> menuWrapper = new LambdaQueryWrapper<>();
|
||||
menuWrapper.in(MenuPO::getId, menuIds)
|
||||
.eq(MenuPO::getStatus, 1) // 只查询启用的菜单
|
||||
.orderByAsc(MenuPO::getOrder);
|
||||
|
||||
List<MenuPO> menus = menuService.list(menuWrapper);
|
||||
|
||||
// 构建公司菜单ID到公司菜单的映射
|
||||
Map<Long, CompanyMenuPO> companyMenuMap = companyMenus.stream()
|
||||
.collect(Collectors.toMap(CompanyMenuPO::getId, cm -> cm));
|
||||
|
||||
// 转换为MenuVO,使用公司自定义字段
|
||||
return menus.stream()
|
||||
.map(menu -> {
|
||||
MenuVO menuVO = new MenuVO();
|
||||
BeanUtils.copyProperties(menu, menuVO);
|
||||
|
||||
// 查找对应的公司菜单
|
||||
CompanyMenuPO companyMenu = companyMenuMap.values().stream()
|
||||
.filter(cm -> cm.getMenuId().equals(menu.getId()))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (companyMenu != null) {
|
||||
if (companyMenu.getCustomName() != null) {
|
||||
menuVO.setName(companyMenu.getCustomName());
|
||||
}
|
||||
if (companyMenu.getCustomTitle() != null) {
|
||||
menuVO.setTitle(companyMenu.getCustomTitle());
|
||||
}
|
||||
if (companyMenu.getCustomIcon() != null) {
|
||||
menuVO.setIcon(companyMenu.getCustomIcon());
|
||||
}
|
||||
if (companyMenu.getCustomOrder() != null) {
|
||||
menuVO.setOrder(companyMenu.getCustomOrder());
|
||||
}
|
||||
}
|
||||
|
||||
return menuVO;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位所有公司菜单ID列表
|
||||
* @param positionId 岗位ID
|
||||
* @return 公司菜单ID列表
|
||||
*/
|
||||
@Override
|
||||
public List<Long> getPositionCompanyMenuIds(Long positionId) {
|
||||
// 查询岗位菜单权限关联记录
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(PositionCompanyMenuPO::getPositionId, positionId);
|
||||
|
||||
List<PositionCompanyMenuPO> positionMenus = this.list(wrapper);
|
||||
|
||||
// 返回公司菜单ID列表
|
||||
return positionMenus.stream()
|
||||
.map(PositionCompanyMenuPO::getCompanyMenuId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新岗位菜单权限
|
||||
* @param positionId 岗位ID
|
||||
* @param companyMenuIds 公司菜单ID列表
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void batchUpdatePositionCompanyMenus(Long positionId, List<Long> companyMenuIds) {
|
||||
// 先删除该岗位的所有菜单权限
|
||||
LambdaQueryWrapper<PositionCompanyMenuPO> deleteWrapper = new LambdaQueryWrapper<>();
|
||||
deleteWrapper.eq(PositionCompanyMenuPO::getPositionId, positionId);
|
||||
this.remove(deleteWrapper);
|
||||
|
||||
// 批量插入新的菜单权限(先验证 companyMenuId 是否存在且属于当前公司)
|
||||
if (companyMenuIds != null && !companyMenuIds.isEmpty()) {
|
||||
// 获取当前用户的公司ID
|
||||
Long companyId = currentUserContext.getCurrentCompanyId();
|
||||
|
||||
// 查询当前公司所有有效的公司菜单ID
|
||||
LambdaQueryWrapper<CompanyMenuPO> menuWrapper = new LambdaQueryWrapper<>();
|
||||
menuWrapper.eq(CompanyMenuPO::getCompanyId, companyId)
|
||||
.eq(CompanyMenuPO::getStatus, 1);
|
||||
List<CompanyMenuPO> validCompanyMenus = companyMenuService.list(menuWrapper);
|
||||
List<Long> validMenuIds = validCompanyMenus.stream()
|
||||
.map(CompanyMenuPO::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 只插入存在的公司菜单ID
|
||||
List<PositionCompanyMenuPO> positionMenus = new ArrayList<>();
|
||||
for (Long companyMenuId : companyMenuIds) {
|
||||
if (validMenuIds.contains(companyMenuId)) {
|
||||
PositionCompanyMenuPO positionMenu = new PositionCompanyMenuPO();
|
||||
positionMenu.setPositionId(positionId);
|
||||
positionMenu.setCompanyMenuId(companyMenuId);
|
||||
positionMenu.setCreateBy(currentUserContext.getCurrentUserId());
|
||||
positionMenus.add(positionMenu);
|
||||
}
|
||||
}
|
||||
|
||||
if (!positionMenus.isEmpty()) {
|
||||
this.saveBatch(positionMenus);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -19,11 +19,11 @@ import java.util.List;
|
||||
@Tag(name = "组织-岗位权限管理", description = "岗位权限的分配和管理接口")
|
||||
@RestController
|
||||
@RequestMapping("/position-permission")
|
||||
public class PositionPermissionController {
|
||||
public class PositionPermissionManagementController {
|
||||
|
||||
private final PositionPermissionService positionPermissionService;
|
||||
|
||||
public PositionPermissionController(PositionPermissionService positionPermissionService) {
|
||||
public PositionPermissionManagementController(PositionPermissionService positionPermissionService) {
|
||||
this.positionPermissionService = positionPermissionService;
|
||||
}
|
||||
|
||||
+3
@@ -10,6 +10,9 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 菜单权限关联Mapper接口
|
||||
* 注意:sys_menu_permission 表使用 menu_id + permission_id 联合主键,
|
||||
* 不支持 MyBatis-Plus 的 xxById 方法,因此此类继承 BaseMapper
|
||||
* 但实际业务只使用 selectOne/insert/delete + LambdaQueryWrapper,不依赖 ID
|
||||
*/
|
||||
@Mapper
|
||||
public interface MenuPermissionMapper extends BaseMapper<MenuPermissionPO> {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
p.create_time,
|
||||
p.update_time
|
||||
FROM sys_permission p
|
||||
INNER JOIN sys_menu_permission_map mpm ON p.id = mpm.permission_id
|
||||
INNER JOIN sys_menu_permission mpm ON p.id = mpm.permission_id
|
||||
WHERE mpm.menu_id = #{menuId}
|
||||
AND p.status = 1
|
||||
ORDER BY p.create_time ASC
|
||||
|
||||
Reference in New Issue
Block a user