System:获取PDA菜单接口
master
xins 12 months ago
parent 422446e090
commit 57a47a7855

@ -24,7 +24,7 @@ import com.hw.system.service.ISysMenuService;
/**
*
*
*
* @author ruoyi
*/
@RestController
@ -146,7 +146,7 @@ public class SysMenuController extends BaseController
/**
*
*
*
* @return
*/
@GetMapping("getRouters")
@ -156,4 +156,18 @@ public class SysMenuController extends BaseController
List<SysMenu> menus = menuService.selectMenuTreeByUserId(userId);
return success(menuService.buildMenus(menus));
}
}
/**
*
*
* @return
*/
@GetMapping("getPdaRouters")
public AjaxResult getPdaRouters()
{
Long userId = SecurityUtils.getUserId();
List<SysMenu> menus = menuService.selectPdaMenuTreeByUserId(userId);
return success(menus);
}
}

@ -6,14 +6,14 @@ import com.hw.system.domain.SysMenu;
/**
*
*
*
* @author ruoyi
*/
public interface SysMenuMapper
{
/**
*
*
*
* @param menu
* @return
*/
@ -21,14 +21,14 @@ public interface SysMenuMapper
/**
*
*
*
* @return
*/
public List<String> selectMenuPerms();
/**
*
*
*
* @param menu
* @return
*/
@ -36,7 +36,7 @@ public interface SysMenuMapper
/**
* ID
*
*
* @param roleId ID
* @return
*/
@ -44,7 +44,7 @@ public interface SysMenuMapper
/**
* ID
*
*
* @param userId ID
* @return
*/
@ -52,14 +52,14 @@ public interface SysMenuMapper
/**
* ID
*
*
* @return
*/
public List<SysMenu> selectMenuTreeAll();
/**
* ID
*
*
* @param userId ID
* @return
*/
@ -67,7 +67,7 @@ public interface SysMenuMapper
/**
* ID
*
*
* @param roleId ID
* @param menuCheckStrictly
* @return
@ -76,7 +76,7 @@ public interface SysMenuMapper
/**
* ID
*
*
* @param menuId ID
* @return
*/
@ -84,7 +84,7 @@ public interface SysMenuMapper
/**
*
*
*
* @param menuId ID
* @return
*/
@ -92,7 +92,7 @@ public interface SysMenuMapper
/**
*
*
*
* @param menu
* @return
*/
@ -100,7 +100,7 @@ public interface SysMenuMapper
/**
*
*
*
* @param menu
* @return
*/
@ -108,7 +108,7 @@ public interface SysMenuMapper
/**
*
*
*
* @param menuId ID
* @return
*/
@ -116,10 +116,35 @@ public interface SysMenuMapper
/**
*
*
*
* @param menuName
* @param parentId ID
* @return
*/
public SysMenu checkMenuNameUnique(@Param("menuName") String menuName, @Param("parentId") Long parentId);
/**
* IDPDA
*
* @return
*/
public List<SysMenu> selectPdaMenuTreeAll();
/**
* IDPDA
*
* @param userId ID
* @return
*/
public List<SysMenu> selectPdaMenuTreeByUserId(Long userId);
}

@ -8,14 +8,14 @@ import com.hw.system.domain.vo.TreeSelect;
/**
*
*
*
* @author ruoyi
*/
public interface ISysMenuService
{
/**
*
*
*
* @param userId ID
* @return
*/
@ -23,7 +23,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menu
* @param userId ID
* @return
@ -32,7 +32,7 @@ public interface ISysMenuService
/**
* ID
*
*
* @param userId ID
* @return
*/
@ -40,7 +40,7 @@ public interface ISysMenuService
/**
* ID
*
*
* @param roleId ID
* @return
*/
@ -48,7 +48,7 @@ public interface ISysMenuService
/**
* ID
*
*
* @param userId ID
* @return
*/
@ -56,7 +56,7 @@ public interface ISysMenuService
/**
* ID
*
*
* @param roleId ID
* @return
*/
@ -64,7 +64,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menus
* @return
*/
@ -72,7 +72,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menus
* @return
*/
@ -80,7 +80,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menus
* @return
*/
@ -88,7 +88,7 @@ public interface ISysMenuService
/**
* ID
*
*
* @param menuId ID
* @return
*/
@ -96,7 +96,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menuId ID
* @return true false
*/
@ -104,7 +104,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menuId ID
* @return true false
*/
@ -112,7 +112,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -120,7 +120,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -128,7 +128,7 @@ public interface ISysMenuService
/**
*
*
*
* @param menuId ID
* @return
*/
@ -136,9 +136,18 @@ public interface ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
public boolean checkMenuNameUnique(SysMenu menu);
/**
* IDPDA
*
* @param userId
* @return
*/
public List<SysMenu> selectPdaMenuTreeByUserId(Long userId);
}

@ -27,7 +27,7 @@ import com.hw.system.service.ISysMenuService;
/**
*
*
*
* @author ruoyi
*/
@Service
@ -46,7 +46,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param userId ID
* @return
*/
@ -58,7 +58,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -81,7 +81,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* ID
*
*
* @param userId ID
* @return
*/
@ -102,7 +102,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* ID
*
*
* @param roleId ID
* @return
*/
@ -123,7 +123,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* ID
*
*
* @param userId
* @return
*/
@ -144,7 +144,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* ID
*
*
* @param roleId ID
* @return
*/
@ -157,7 +157,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menus
* @return
*/
@ -215,7 +215,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menus
* @return
*/
@ -243,7 +243,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menus
* @return
*/
@ -256,7 +256,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* ID
*
*
* @param menuId ID
* @return
*/
@ -268,7 +268,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menuId ID
* @return
*/
@ -281,7 +281,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* 使
*
*
* @param menuId ID
* @return
*/
@ -294,7 +294,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -306,7 +306,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -318,7 +318,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menuId ID
* @return
*/
@ -330,7 +330,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -348,7 +348,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -365,7 +365,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -393,7 +393,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -417,7 +417,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -429,7 +429,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param menu
* @return
*/
@ -440,7 +440,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* parent_view
*
*
* @param menu
* @return
*/
@ -451,7 +451,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
* ID
*
*
* @param list
* @param parentId ID
* @return String
@ -474,7 +474,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @param list
* @param t
*/
@ -520,7 +520,7 @@ public class SysMenuServiceImpl implements ISysMenuService
/**
*
*
*
* @return
*/
public String innerLinkReplaceEach(String path)
@ -528,4 +528,33 @@ public class SysMenuServiceImpl implements ISysMenuService
return StringUtils.replaceEach(path, new String[] { Constants.HTTP, Constants.HTTPS, Constants.WWW, ".", ":" },
new String[] { "", "", "", "/", "/" });
}
/**
* IDPDA
*
* @param userId
* @return
*/
@Override
public List<SysMenu> selectPdaMenuTreeByUserId(Long userId)
{
int pdaParentId = 2562;
List<SysMenu> menus = null;
if (SecurityUtils.isAdmin(userId))
{
menus = menuMapper.selectPdaMenuTreeAll();
}
else
{
menus = menuMapper.selectPdaMenuTreeByUserId(userId);
}
return getChildPerms(menus, pdaParentId);
}
}

@ -28,10 +28,10 @@
</resultMap>
<sql id="selectMenuVo">
select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
select menu_id, menu_name, parent_id, order_num, path, component, `query`, is_frame, is_cache, menu_type, visible, status, ifnull(perms,'') as perms, icon, create_time
from sys_menu
</sql>
<select id="selectMenuList" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
<where>
@ -47,13 +47,13 @@
</where>
order by parent_id, order_num
</select>
<select id="selectMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type in ('M', 'C') and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByUserId" parameterType="SysMenu" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
@ -72,7 +72,7 @@
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
@ -83,7 +83,7 @@
where u.user_id = #{userId} and m.menu_type in ('M', 'C') and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectMenuListByRoleId" resultType="Long">
select m.menu_id
from sys_menu m
@ -94,7 +94,7 @@
</if>
order by m.parent_id, m.order_num
</select>
<select id="selectMenuPerms" resultType="String">
select distinct m.perms
from sys_menu m
@ -110,28 +110,28 @@
left join sys_role r on r.role_id = ur.role_id
where m.status = '0' and r.status = '0' and ur.user_id = #{userId}
</select>
<select id="selectMenuPermsByRoleId" parameterType="Long" resultType="String">
select distinct m.perms
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
where m.status = '0' and rm.role_id = #{roleId}
</select>
<select id="selectMenuById" parameterType="Long" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_id = #{menuId}
</select>
<select id="hasChildByMenuId" resultType="Integer">
select count(1) from sys_menu where parent_id = #{menuId}
select count(1) from sys_menu where parent_id = #{menuId}
</select>
<select id="checkMenuNameUnique" parameterType="SysMenu" resultMap="SysMenuResult">
<include refid="selectMenuVo"/>
where menu_name=#{menuName} and parent_id = #{parentId} limit 1
</select>
<update id="updateMenu" parameterType="SysMenu">
update sys_menu
<set>
@ -194,9 +194,37 @@
sysdate()
)
</insert>
<delete id="deleteMenuById" parameterType="Long">
delete from sys_menu where menu_id = #{menuId}
</delete>
</mapper>
<select id="selectPdaMenuTreeAll" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m where m.menu_type = 'P' and m.parent_id!=0 and m.status = 0
order by m.parent_id, m.order_num
</select>
<select id="selectPdaMenuTreeByUserId" parameterType="Long" resultMap="SysMenuResult">
select distinct m.menu_id, m.parent_id, m.menu_name, m.path, m.component, m.`query`, m.visible, m.status, ifnull(m.perms,'') as perms, m.is_frame, m.is_cache, m.menu_type, m.icon, m.order_num, m.create_time
from sys_menu m
left join sys_role_menu rm on m.menu_id = rm.menu_id
left join sys_user_role ur on rm.role_id = ur.role_id
left join sys_role ro on ur.role_id = ro.role_id
left join sys_user u on ur.user_id = u.user_id
where u.user_id = #{userId} and m.parent_id!=0 and m.menu_type ='P' and m.status = 0 AND ro.status = 0
order by m.parent_id, m.order_num
</select>
</mapper>

Loading…
Cancel
Save