权限bug修复
This commit is contained in:
parent
94022be3d7
commit
0ee8eb2c10
@ -40,15 +40,13 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getActionCodes" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseAction">
|
<select id="getActionCodes" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseAction">
|
||||||
SELECT * FROM base_action WHERE status = 1 AND EXISTS(
|
SELECT * FROM base_action WHERE status = 1 AND menu_id IN (
|
||||||
SELECT * FROM base_menu WHERE EXISTS(
|
SELECT menu_id FROM base_menu WHERE module_id IN (
|
||||||
SELECT module_id FROM base_module WHERE module_type = #{accountType}))
|
SELECT module_id FROM base_module WHERE module_type = #{accountType}))
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getActionCodeByRole" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseAction">
|
<select id="getActionCodeByRole" resultType="com.zhgd.xmgl.modules.basicdata.entity.BaseAction">
|
||||||
SELECT * FROM base_action WHERE status = 1 AND EXISTS(
|
SELECT * FROM base_action WHERE status = 1 AND action_id IN (SELECT authority_id FROM system_role_menu WHERE role_id = #{roleId} AND type = 2 )
|
||||||
SELECT * FROM base_menu WHERE EXISTS(
|
|
||||||
SELECT menu_id FROM system_role_menu WHERE role_id = #{roleId}))
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getMenuCode" resultType="java.lang.String">
|
<select id="getMenuCode" resultType="java.lang.String">
|
||||||
|
|||||||
@ -57,7 +57,7 @@ public class BaseActionServiceImpl extends ServiceImpl<BaseActionMapper, BaseAct
|
|||||||
public Set<String> queryBySelf(Long menuId) {
|
public Set<String> queryBySelf(Long menuId) {
|
||||||
SecurityUser user = SecurityUtil.getUser();
|
SecurityUser user = SecurityUtil.getUser();
|
||||||
Set<String> actionCodes = new HashSet<>();
|
Set<String> actionCodes = new HashSet<>();
|
||||||
if (user.isManager()) {
|
if (user.isManager() && user.getAccountType() != 3) {
|
||||||
actionCodes = baseActionMapper.getActionCodes(user.getAccountType()).stream().filter(a -> a.getMenuId().equals(menuId))
|
actionCodes = baseActionMapper.getActionCodes(user.getAccountType()).stream().filter(a -> a.getMenuId().equals(menuId))
|
||||||
.map(a -> a.getActionCode()).collect(Collectors.toSet());
|
.map(a -> a.getActionCode()).collect(Collectors.toSet());
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -166,8 +166,18 @@ public class BaseMenuServiceImpl extends ServiceImpl<BaseMenuMapper, BaseMenu> i
|
|||||||
if (systemUser == null) {
|
if (systemUser == null) {
|
||||||
throw new CustomException("用户不存在");
|
throw new CustomException("用户不存在");
|
||||||
}
|
}
|
||||||
List<BaseMenu> baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId)
|
List<BaseMenu> baseMenus = new ArrayList<>();
|
||||||
|
if (systemUser.getIsManager() && systemUser.getAccountType() != 3) {
|
||||||
|
// 查询相对应的菜单
|
||||||
|
baseMenus = baseMenuMapper.selectList(Wrappers.<BaseMenu>lambdaQuery().in(BaseMenu::getModuleId, moduleId)
|
||||||
.eq(BaseMenu::getStatus, 1).orderByAsc(BaseMenu::getPriority));
|
.eq(BaseMenu::getStatus, 1).orderByAsc(BaseMenu::getPriority));
|
||||||
|
} else {
|
||||||
|
Long roleId = systemUserRoleService.getOne(Wrappers.<SystemUserRole>lambdaQuery()
|
||||||
|
.eq(SystemUserRole::getUserId, systemUser.getUserId())).getRoleId();
|
||||||
|
if (roleId != null) {
|
||||||
|
baseMenus = baseMenuMapper.getMenuIdByFilter(roleId, moduleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
return TreeUtil.formatHz(baseMenus);
|
return TreeUtil.formatHz(baseMenus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user