菜单按钮
This commit is contained in:
@@ -214,6 +214,7 @@ public class SysMenuRest {
|
||||
}
|
||||
sysRoleAuthorizeQuery.setRoleSids(roleSids);
|
||||
sysRoleAuthorizeQuery.setSourceSid(query.getSourceSid());
|
||||
sysRoleAuthorizeQuery.setMenuType("2");
|
||||
list = sysRoleAuthorizeService.getSourceMenuTreeOfRoles(sysRoleAuthorizeQuery, null);
|
||||
return rb.success().setData(list);
|
||||
}
|
||||
@@ -279,6 +280,11 @@ public class SysMenuRest {
|
||||
if (sysSource == null) {
|
||||
return rb.setMsg("资源不存在");
|
||||
}
|
||||
if(!dto.getMenuType().equals("0")){
|
||||
if(StringUtils.isBlank(dto.getName())){
|
||||
return rb.setMsg("菜单名不能为空");
|
||||
}
|
||||
}
|
||||
// dto.setMenuType("0");
|
||||
sysMenuService.saveMenu(dto);
|
||||
return rb.success();
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.yxt.portal.biz.sysauthorizegroupdetail;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.yxt.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@ApiModel(value = "权限组表", description = "权限组表")
|
||||
@TableName("sys_authorize_group_detail")
|
||||
@Data
|
||||
public class SysAuthorizeGroupDetail extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
@ApiModelProperty("权限组名")
|
||||
private String groupName;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.yxt.portal.biz.sysauthorizegroupdetail;
|
||||
|
||||
|
||||
import com.yxt.common.core.dto.Dto;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
@ApiModel(value = "权限组表 数据传输对象", description = "权限组表 数据传输对象")
|
||||
@Data
|
||||
public class SysAuthorizeGroupDetailDto implements Dto {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -8143707488992909267L;
|
||||
@ApiModelProperty(value = "菜单名称", required = true)
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("菜单路由路径(VUE)")
|
||||
private String menuUrl;
|
||||
|
||||
@ApiModelProperty("菜单对应的前端页面路径")
|
||||
private String pageUrl;
|
||||
|
||||
@ApiModelProperty("菜单图标地址")
|
||||
private String iconUrl;
|
||||
|
||||
@ApiModelProperty(value = "资源sid", required = true)
|
||||
@NotBlank(message = "资源不能为空")
|
||||
private String sourceSid;
|
||||
|
||||
@ApiModelProperty(value = "是否显示,默认为1显示,0为不显示", required = true)
|
||||
@NotBlank(message = "是否显示不能为空")
|
||||
private String isShow;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNo;
|
||||
|
||||
@ApiModelProperty(value = "上级sid", example = "0", required = true)
|
||||
@NotBlank(message = "上级菜单不能为空")
|
||||
private String pSid;
|
||||
|
||||
@ApiModelProperty(value = "前端页面路径重定向", required = false)
|
||||
private Integer pageUrlRedirect;
|
||||
|
||||
@ApiModelProperty("前端页面名称(vue组件名)")
|
||||
private String pageName;
|
||||
|
||||
@ApiModelProperty(value = "前端页面别名", required = false)
|
||||
private String pageAliasName;
|
||||
|
||||
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)")
|
||||
private String menuType="0";
|
||||
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
private String cid;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.yxt.portal.biz.sysauthorizegroupdetail;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Project: anrui_portal(门户建设) <br/>
|
||||
* File: SysMenuMapper.java <br/>
|
||||
* Class: com.yxt.anrui.portal.biz.sysmenu.SysMenuMapper <br/>
|
||||
* Description: 菜单表. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2021-08-03 00:24:28 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface SysAuthorizeGroupDetailMapper extends BaseMapper<SysAuthorizeGroupDetail> {
|
||||
|
||||
|
||||
List<SysAuthorizeGroupDetailVo> getGroupByOrgSid(@Param("orgSid") String orgSid, @Param("sourceSid") String sourceSid);
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.yxt.portal.biz.sysauthorizegroupdetail.SysAuthorizeGroupDetailMapper">
|
||||
<!-- <where> ${ew.sqlSegment} </where>-->
|
||||
<!-- ${ew.customSqlSegment} -->
|
||||
|
||||
<!--将该资源下的所有一级菜单列表-->
|
||||
<select id="getGroupByOrgSid" resultType="com.yxt.portal.biz.sysmenu.SysMenuTreeVo">
|
||||
SELECT *
|
||||
FROM sys_authorize_group gr
|
||||
LEFT JOIN sys_org_authorize au ON gr.sid = au.ahthorizeGroupSid
|
||||
WHERE source.sid = #{sourceSid} AND menu.psid='0' and menu.isDelete!=1
|
||||
ORDER BY menu.sortNo ASC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.yxt.portal.biz.sysauthorizegroupdetail;
|
||||
|
||||
|
||||
import com.yxt.common.core.query.Query;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@ApiModel(value = "权限组表 查询条件 功能菜单设置查询用", description = "权限组表 查询条件 功能菜单设置查询用")
|
||||
@Data
|
||||
public class SysAuthorizeGroupDetailQuery implements Query {
|
||||
|
||||
|
||||
@ApiModelProperty("资源sid")
|
||||
private String sourceSid;
|
||||
private String orgSid;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.yxt.portal.biz.sysauthorizegroupdetail;
|
||||
|
||||
import com.yxt.common.base.service.MybatisBaseService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Project: anrui_portal(门户建设) <br/>
|
||||
* File: SysMenuService.java <br/>
|
||||
* Class: com.yxt.user.biz.sysmenu.SysMenuService <br/>
|
||||
* Description: 菜单表 业务逻辑. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2021-08-03 00:24:28 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@Service
|
||||
public class SysAuthorizeGroupDetailService extends MybatisBaseService<SysAuthorizeGroupDetailMapper, SysAuthorizeGroupDetail> {
|
||||
|
||||
|
||||
|
||||
|
||||
public List<SysAuthorizeGroupDetailVo> getGroupByOrgSid(SysAuthorizeGroupDetailQuery query) {
|
||||
|
||||
return baseMapper.getGroupByOrgSid(query.getOrgSid(),query.getSourceSid());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.yxt.portal.biz.sysauthorizegroupdetail;
|
||||
|
||||
|
||||
import com.yxt.common.core.vo.Vo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Project: anrui_portal(门户建设) <br/>
|
||||
* File: SysMenuVo.java <br/>
|
||||
* Class: com.yxt.anrui.portal.api.sysmenu.SysMenuVo <br/>
|
||||
* Description: 菜单表 视图数据对象. <br/>
|
||||
* Copyright: Copyright (c) 2011 <br/>
|
||||
* Company: https://gitee.com/liuzp315 <br/>
|
||||
* Makedate: 2021-08-03 00:24:28 <br/>
|
||||
*
|
||||
* @author liupopo
|
||||
* @version 1.0
|
||||
* @since 1.0
|
||||
*/
|
||||
@ApiModel(value = "菜单表 视图数据对象", description = "菜单表 视图数据对象")
|
||||
@Data
|
||||
public class SysAuthorizeGroupDetailVo implements Vo {
|
||||
|
||||
|
||||
@ApiModelProperty("菜单名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("菜单路由路径(VUE)")
|
||||
private String menuUrl;
|
||||
|
||||
@ApiModelProperty("菜单对应的前端页面路径")
|
||||
private String pageUrl;
|
||||
|
||||
@ApiModelProperty("菜单图标地址")
|
||||
private String iconUrl;
|
||||
|
||||
@ApiModelProperty("资源sid")
|
||||
private String sourceSid;
|
||||
|
||||
@ApiModelProperty("是否显示,默认为1显示,0为不显示")
|
||||
private String isShow;
|
||||
|
||||
@ApiModelProperty("排序号")
|
||||
private Integer sortNo;
|
||||
|
||||
@ApiModelProperty("上级sid")
|
||||
private String pSid;
|
||||
@ApiModelProperty("上级名称")
|
||||
private String pName;
|
||||
@ApiModelProperty("sid")
|
||||
private String sid;
|
||||
|
||||
@ApiModelProperty("前端页面路径重定向")
|
||||
private Integer pageUrlRedirect;
|
||||
|
||||
@ApiModelProperty("前端页面名称(vue组件名)")
|
||||
private String pageName;
|
||||
|
||||
@ApiModelProperty("前端页面别名")
|
||||
private String pageAliasName;
|
||||
|
||||
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)")
|
||||
private String menuType;
|
||||
@ApiModelProperty("子菜单")
|
||||
private List<SysAuthorizeGroupDetailVo> children;
|
||||
@ApiModelProperty("是否选中,1:未选中,0:选中")
|
||||
private String checked;
|
||||
@ApiModelProperty("资源名称")
|
||||
private String sourceName;
|
||||
private String cid;
|
||||
}
|
||||
@@ -62,4 +62,5 @@ public class SysMenu extends BaseEntity {
|
||||
@ApiModelProperty("菜单类型(0左侧当行菜单,1页面中功能)")
|
||||
private String menuType;
|
||||
private String cid;
|
||||
private String btnKey;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class SysMenuDto implements Dto {
|
||||
|
||||
private static final long serialVersionUID = -8143707488992909267L;
|
||||
@ApiModelProperty(value = "菜单名称", required = true)
|
||||
@NotBlank(message = "菜单名称不能为空")
|
||||
// @NotBlank(message = "菜单名称不能为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("菜单路由路径(VUE)")
|
||||
@@ -70,4 +70,5 @@ public class SysMenuDto implements Dto {
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
private String cid;
|
||||
private String btnKey;
|
||||
}
|
||||
@@ -33,8 +33,9 @@
|
||||
SELECT menu.*, ISNULL(menuRole.sid) as checked
|
||||
FROM sys_menu menu
|
||||
left join sys_role_authorize menuRole on menu.sid = menuRole.menuSid AND menuRole.roleSid = #{param1}
|
||||
left join sys_authorize_group a on a.menuSid=menu.sid
|
||||
left join sys_org_authorize b on b.ahthorizeGroupSid=a.sid
|
||||
left join sys_authorize_group_detail a on a.menuSid=menu.sid
|
||||
left join sys_authorize_group c on c.sid =a.groupSid
|
||||
left join sys_org_authorize b on b.ahthorizeGroupSid=c.sid
|
||||
where menu.pSid = #{param2}
|
||||
<if test="sourceSid != null">
|
||||
and a.sourceSid = #{sourceSid}
|
||||
@@ -80,7 +81,7 @@
|
||||
when 2 then '按钮'
|
||||
end as menuTypeValue,
|
||||
menu.isShow,
|
||||
menu.cId as cId,
|
||||
menu.cId as cId,menu.btnKey,
|
||||
(select name from sys_menu where sid=menu.pSid) as pName
|
||||
FROM sys_menu menu
|
||||
left join sys_source source on source.sid = menu.sourceSid
|
||||
@@ -122,7 +123,7 @@
|
||||
when 2 then '按钮'
|
||||
end as menuTypeValue,
|
||||
menu.isShow,
|
||||
menu.cId as cId,
|
||||
menu.cId as cId,menu.btnKey,
|
||||
if(menu.pSid=0,'顶级菜单','' )as pName
|
||||
FROM sys_menu menu
|
||||
LEFT JOIN sys_source source ON menu.sourceSid = source.sid
|
||||
|
||||
@@ -135,11 +135,11 @@ public class SysMenuService extends MybatisBaseService<SysMenuMapper, SysMenu> {
|
||||
}*/
|
||||
public List<SysMenuTreeVo> listAllVoForSource(SysMenuQuery query) {
|
||||
//查询所有的资源列表
|
||||
List<SysMenuTreeVo> sysSourceVos = sysSourceService.listMenuTreeVo(query.getSourceSid());
|
||||
List<SysMenuTreeVo> sysSourceVos = sysSourceService.listMenuTreeVo("");
|
||||
for (SysMenuTreeVo s : sysSourceVos) {
|
||||
//根据资源sid查询该资源下的所有一级菜单
|
||||
//List<SysMenuTreeVo> sysMenuVoList = sysSourceMenuService.fetchRootMenuBySourceSid(s.getSourceSid());
|
||||
List<SysMenuTreeVo> sysMenuVoList = sysMenuService.fetchRootMenuBySourceSid("");
|
||||
List<SysMenuTreeVo> sysMenuVoList = sysMenuService.fetchRootMenuBySourceSid(s.getSourceSid());
|
||||
s.setChildren(sysMenuVoList);
|
||||
s.setIsSource("1");
|
||||
//判断该资源下的菜单是否有可用的状态
|
||||
@@ -437,8 +437,6 @@ public class SysMenuService extends MybatisBaseService<SysMenuMapper, SysMenu> {
|
||||
sysRoleAuthorize.setSourceSid(dto.getSourceSid());
|
||||
sysRoleAuthorizeService.save(sysRoleAuthorize);
|
||||
}
|
||||
SysRoleAuthorize sysRoleAuthorize=new SysRoleAuthorize();
|
||||
sysRoleAuthorizeService.save(sysRoleAuthorize);
|
||||
}
|
||||
|
||||
public List<SysMenu> selectByMenuUrl(String menuUrl) {
|
||||
|
||||
@@ -61,4 +61,5 @@ public class SysMenuTreeVo implements Vo {
|
||||
@ApiModelProperty("子菜单")
|
||||
private List<SysMenuTreeVo> children;
|
||||
private String orgSid;
|
||||
private String btnKey;
|
||||
}
|
||||
|
||||
@@ -72,4 +72,5 @@ public class SysMenuVo implements Vo {
|
||||
@ApiModelProperty("资源名称")
|
||||
private String sourceName;
|
||||
private String cid;
|
||||
private String btnKey;
|
||||
}
|
||||
|
||||
@@ -36,5 +36,6 @@ public class SysRoleAuthorizeQuery implements Query {
|
||||
private String sourceSid;
|
||||
@ApiModelProperty("是否是系统管理员")
|
||||
private String isAdmin;
|
||||
private String menuType;
|
||||
|
||||
}
|
||||
|
||||
@@ -62,6 +62,9 @@ public class SysRoleAuthorizeService extends MybatisBaseService<SysRoleAuthorize
|
||||
if (query.getRoleSids() != null && query.getRoleSids().size() > 0) {
|
||||
qw.in("rm.roleSid", query.getRoleSids());
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getMenuType())) {
|
||||
qw.ne("m.menuType", query.getMenuType());
|
||||
}
|
||||
qw.eq("m.isShow", 1);
|
||||
qw.orderByAsc("m.sortNo");
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface SysSourceMapper extends BaseMapper<SysSource> {
|
||||
|
||||
List<SysSourceVo> selectListAllVo(@Param(Constants.WRAPPER) Wrapper<SysSource> qw);
|
||||
|
||||
@Select("select * from sys_source where sid=#{sourceSid}")
|
||||
// @Select("select * from sys_source where sid=#{sourceSid}")
|
||||
List<SysSourceVo> selectListVo(@Param("sourceSid") String sourceSid);
|
||||
|
||||
@Select("select * from sys_source where sid=#{sid}")
|
||||
@@ -48,7 +48,7 @@ public interface SysSourceMapper extends BaseMapper<SysSource> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SysMenuTreeVo> listMenuTreeVo(String sourceSid);
|
||||
List<SysMenuTreeVo> listMenuTreeVo(@Param("sourceSid") String sourceSid);
|
||||
|
||||
List<SysFunctionTreeVo> listFunctionTreeVo(String name);
|
||||
}
|
||||
@@ -22,7 +22,7 @@
|
||||
SELECT *
|
||||
FROM sys_source
|
||||
<if test="sourceSid !=null and sourceSid !=''">
|
||||
sid=#{sourceSid}
|
||||
where sid=#{sourceSid}
|
||||
</if>
|
||||
</select>
|
||||
<select id="listAllByRoleSid" resultType="com.yxt.portal.biz.syssource.SysSourceVo">
|
||||
@@ -48,6 +48,8 @@
|
||||
<!--菜单sid-->
|
||||
sid as sid
|
||||
from sys_source
|
||||
where sid=#{sourceSid}
|
||||
<if test="sourceSid !=null and sourceSid !=''">
|
||||
where sid=#{sourceSid}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user