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> selectByRoleId(@Param("roleId") Long roleId);
|
||||
}
|
||||
|
||||
@@ -155,19 +155,22 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||
if (user.getIsAdmin()) {
|
||||
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());
|
||||
// 加入员工权限
|
||||
if (shopStaffPromissionList != null && !shopStaffPromissionList.isEmpty()) {
|
||||
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);
|
||||
String platformType = ServletUtil.getHeaderIgnoreCase(ServletUtil.getRequest(), "platformType");
|
||||
if (PlatformTypeEnum.PC_CLIENT.getValue().equals(platformType)) {
|
||||
@@ -216,14 +219,18 @@ public class AuthorizationServiceImpl implements AuthorizationService {
|
||||
if (sysUser.getIsAdmin()) {
|
||||
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());
|
||||
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);
|
||||
// 权限赋予
|
||||
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.addPermissionList(promissionList);
|
||||
StpKit.USER.addRoleList(roleNames);
|
||||
|
||||
@@ -15,4 +15,7 @@
|
||||
</if>
|
||||
order by menu_sort desc
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user