feat(menu): 优化菜单路径唯一性校验并更新前端界面
- 在SysLoginController中添加optionMap数据返回 - 添加JSQLParser依赖支持MyBatis Plus功能 - 实现selectMenuByPathExcludeId方法用于排除当前菜单的路径唯一性校验 - 在SysMenuServiceImpl中添加日志记录并优化路径唯一性判断逻辑 - 在SysMenuMapper.xml中添加LIMIT 1限制并实现排除ID查询 - 在前端路由中注释患者管理相关路由配置 - 在用户store中添加optionMap配置项并优先从optionMap获取医院名称 - 重构检查项目设置页面的操作按钮样式为统一的圆形按钮设计 - 更新检查项目设置页面的导航栏样式和交互体验 - 优化门诊记录页面的搜索条件和表格展示功能 - 添加性别和状态筛选条件并改进数据加载逻辑
This commit is contained in:
@@ -91,6 +91,15 @@ public interface SysMenuMapper {
|
||||
*/
|
||||
public SysMenu selectMenuByPath(String path);
|
||||
|
||||
/**
|
||||
* 根据路径Path查询信息(排除指定菜单ID)
|
||||
*
|
||||
* @param path 路径
|
||||
* @param menuId 菜单ID
|
||||
* @return 菜单信息
|
||||
*/
|
||||
public SysMenu selectMenuByPathExcludeId(@Param("path") String path, @Param("menuId") Long menuId);
|
||||
|
||||
/**
|
||||
* 是否存在菜单子节点
|
||||
*
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.core.system.mapper.SysMenuMapper;
|
||||
import com.core.system.mapper.SysRoleMapper;
|
||||
import com.core.system.mapper.SysRoleMenuMapper;
|
||||
import com.core.system.service.ISysMenuService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -27,6 +29,7 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
public class SysMenuServiceImpl implements ISysMenuService {
|
||||
private static final Logger log = LoggerFactory.getLogger(SysMenuServiceImpl.class);
|
||||
public static final String PREMISSION_STRING = "perms[\"{0}\"]";
|
||||
|
||||
@Autowired
|
||||
@@ -281,12 +284,13 @@ public class SysMenuServiceImpl implements ISysMenuService {
|
||||
*/
|
||||
@Override
|
||||
public int updateMenu(SysMenu menu) {
|
||||
//路径Path唯一性判断
|
||||
//路径Path唯一性判断(排除当前菜单本身)
|
||||
String path = menu.getPath();
|
||||
if (StringUtils.isNotBlank(path)) {
|
||||
SysMenu sysMenu = menuMapper.selectMenuByPath(menu.getPath());
|
||||
// 先判断sysMenu是否不为null,再比较menuId
|
||||
if (sysMenu != null && !menu.getMenuId().equals(sysMenu.getMenuId())) {
|
||||
SysMenu sysMenu = menuMapper.selectMenuByPathExcludeId(menu.getPath(), menu.getMenuId());
|
||||
if (sysMenu != null) {
|
||||
log.warn("路由地址已存在 - menuId: {}, path: {}, 存在的menuId: {}",
|
||||
menu.getMenuId(), menu.getPath(), sysMenu.getMenuId());
|
||||
return -1; // 路由地址已存在
|
||||
}
|
||||
}
|
||||
|
||||
@@ -177,6 +177,12 @@
|
||||
<select id="selectMenuByPath" parameterType="String" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where path = #{path}
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<select id="selectMenuByPathExcludeId" resultMap="SysMenuResult">
|
||||
<include refid="selectMenuVo"/>
|
||||
where path = #{path} and menu_id != #{menuId}
|
||||
</select>
|
||||
|
||||
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
|
||||
|
||||
Reference in New Issue
Block a user