Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -16,4 +16,5 @@ public interface SysMenuMapper extends BaseMapper<SysMenu> {
|
|||||||
|
|
||||||
List<SysMenu> selectByUserId(@Param("userId") Long userId, @Param("type") Integer type);
|
List<SysMenu> selectByUserId(@Param("userId") Long userId, @Param("type") Integer type);
|
||||||
|
|
||||||
|
List<SysMenu> selectByRoleId(@Param("roleId") Long roleId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,19 +155,22 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
if (user.getIsAdmin()) {
|
if (user.getIsAdmin()) {
|
||||||
roleNames.add("admin");
|
roleNames.add("admin");
|
||||||
}
|
}
|
||||||
boolean isEnableSync = StpKit.USER.isEnableSync(shopInfo.getId());
|
|
||||||
if (isEnableSync && CollUtil.contains(roleNames, "商户")) {
|
|
||||||
roleNames.remove("商户");
|
|
||||||
roleNames.add("分店商户");
|
|
||||||
}
|
|
||||||
StpKit.USER.addRoleList(roleNames);
|
|
||||||
// 权限赋予
|
// 权限赋予
|
||||||
List<String> promissionList = sysMenuMapper.selectByUserId(user.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
List<String> promissionList = sysMenuMapper.selectByUserId(user.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).collect(Collectors.toList());
|
||||||
// 加入员工权限
|
// 加入员工权限
|
||||||
if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) {
|
if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) {
|
||||||
promissionList.addAll(shopStaffPromissionList);
|
promissionList.addAll(shopStaffPromissionList);
|
||||||
}
|
}
|
||||||
|
boolean isEnableSync = StpKit.USER.isEnableSync(shopInfo.getId());
|
||||||
|
if (isEnableSync && CollUtil.contains(roleNames, "商户")) {
|
||||||
|
roleNames.remove("商户");
|
||||||
|
roleNames.add("分店商户");
|
||||||
|
List<String> headShopPromissionList = sysMenuMapper.selectByRoleId(2L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
|
List<String> branchShopPromissionList = sysMenuMapper.selectByRoleId(3L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
|
promissionList.removeAll(headShopPromissionList);
|
||||||
|
promissionList.addAll(branchShopPromissionList);
|
||||||
|
}
|
||||||
|
StpKit.USER.addRoleList(roleNames);
|
||||||
StpKit.USER.addPermissionList(promissionList);
|
StpKit.USER.addPermissionList(promissionList);
|
||||||
String platformType = ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType");
|
String platformType = ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType");
|
||||||
if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platformType)) {
|
if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platformType)) {
|
||||||
@@ -216,14 +219,18 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
|||||||
if (sysUser.getIsAdmin()) {
|
if (sysUser.getIsAdmin()) {
|
||||||
roleNames.add("admin");
|
roleNames.add("admin");
|
||||||
}
|
}
|
||||||
|
// 权限赋予
|
||||||
|
List<String> promissionList = sysMenuMapper.selectByUserId(sysUser.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
boolean isEnableSync = StpKit.USER.isEnableSync(shopInfo.getId());
|
boolean isEnableSync = StpKit.USER.isEnableSync(shopInfo.getId());
|
||||||
if (isEnableSync && CollUtil.contains(roleNames, "商户")) {
|
if (isEnableSync && CollUtil.contains(roleNames, "商户")) {
|
||||||
roleNames.remove("商户");
|
roleNames.remove("商户");
|
||||||
roleNames.add("分店商户");
|
roleNames.add("分店商户");
|
||||||
|
List<String> headShopPromissionList = sysMenuMapper.selectByRoleId(2L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
|
List<String> branchShopPromissionList = sysMenuMapper.selectByRoleId(3L).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
||||||
|
promissionList.removeAll(headShopPromissionList);
|
||||||
|
promissionList.addAll(branchShopPromissionList);
|
||||||
}
|
}
|
||||||
StpKit.USER.addRoleList(roleNames);
|
StpKit.USER.addRoleList(roleNames);
|
||||||
// 权限赋予
|
|
||||||
List<String> promissionList = sysMenuMapper.selectByUserId(sysUser.getId(), null).stream().map(SysMenu::getPermission).filter(StrUtil::isNotBlank).toList();
|
|
||||||
StpKit.USER.switchTo(sysUser.getId().equals(headId), sysUser.getId(), sysUser.getAccount(), shopInfo.getId(), shopInfo.getShopName(), MyStpLogic.LoginType.MANAGER, sysUser.getIsAdmin());
|
StpKit.USER.switchTo(sysUser.getId().equals(headId), sysUser.getId(), sysUser.getAccount(), shopInfo.getId(), shopInfo.getShopName(), MyStpLogic.LoginType.MANAGER, sysUser.getIsAdmin());
|
||||||
StpKit.USER.addPermissionList(promissionList);
|
StpKit.USER.addPermissionList(promissionList);
|
||||||
StpKit.USER.addRoleList(roleNames);
|
StpKit.USER.addRoleList(roleNames);
|
||||||
|
|||||||
@@ -15,4 +15,7 @@
|
|||||||
</if>
|
</if>
|
||||||
order by menu_sort desc
|
order by menu_sort desc
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectByRoleId" resultType="com.czg.account.entity.SysMenu">
|
||||||
|
select * from sys_menu where menu_id in (select menu_id from sys_roles_menus where role_id = #{roleId})
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user