|
|
@@ -1,16 +1,12 @@ |
|
|
|
package com.tuoheng.admin.service.permissions; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.tuoheng.admin.dto.RolePermissionDto; |
|
|
|
import com.tuoheng.admin.entity.Menu; |
|
|
|
import com.tuoheng.admin.entity.OpPermissions; |
|
|
|
import com.tuoheng.admin.entity.OpRolePermission; |
|
|
|
import com.tuoheng.admin.entity.RoleMenu; |
|
|
|
import com.tuoheng.admin.mapper.MenuMapper; |
|
|
|
import com.tuoheng.admin.mapper.OpPermissionsMapper; |
|
|
|
import com.tuoheng.admin.mapper.OpRolePermissionMapper; |
|
|
|
import com.tuoheng.admin.mapper.RoleMenuMapper; |
|
|
|
import com.tuoheng.admin.entity.*; |
|
|
|
import com.tuoheng.admin.enums.MarkEnum; |
|
|
|
import com.tuoheng.admin.mapper.*; |
|
|
|
import com.tuoheng.admin.query.RoleClientQuery; |
|
|
|
import com.tuoheng.admin.utils.CurrentUserUtil; |
|
|
|
import com.tuoheng.common.core.utils.DateUtils; |
|
|
@@ -31,7 +27,7 @@ import java.util.stream.Collectors; |
|
|
|
|
|
|
|
@Service |
|
|
|
@Slf4j |
|
|
|
public class OpPermissionsServiceImpl extends ServiceImpl<OpPermissionsMapper, OpPermissions> implements OpPermissionsService{ |
|
|
|
public class OpPermissionsServiceImpl extends ServiceImpl<OpPermissionsMapper, OpPermissions> implements OpPermissionsService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private MenuMapper menuMapper; |
|
|
@@ -44,6 +40,8 @@ public class OpPermissionsServiceImpl extends ServiceImpl<OpPermissionsMapper, O |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private OpRolePermissionMapper opRolePermissionMapper; |
|
|
|
@Autowired |
|
|
|
private RoleMapper roleMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@@ -81,9 +79,15 @@ public class OpPermissionsServiceImpl extends ServiceImpl<OpPermissionsMapper, O |
|
|
|
opPermissionsMapper.insert(opPermissions); |
|
|
|
//添加对应创建权限时的关联关系 |
|
|
|
OpRolePermission opRolePermission = new OpRolePermission(); |
|
|
|
opRolePermission.setRoleId(CurrentUserUtil.getUserInfo().getRoleId()); |
|
|
|
opRolePermission.setPermissionId(opPermissions.getId()); |
|
|
|
opRolePermissionMapper.insert(opRolePermission); |
|
|
|
//新增菜单直接讲菜单跟当前用户的租户进行关联 |
|
|
|
Role aSuper = roleMapper.selectOne(Wrappers.<Role>lambdaQuery() |
|
|
|
.eq(Role::getCode, "super") |
|
|
|
.eq(Role::getMark, MarkEnum.VALID.getCode())); |
|
|
|
if (null != aSuper) { |
|
|
|
opRolePermission.setRoleId(aSuper.getId()); |
|
|
|
opRolePermission.setPermissionId(opPermissions.getId()); |
|
|
|
opRolePermissionMapper.insert(opRolePermission); |
|
|
|
} |
|
|
|
} else { |
|
|
|
opPermissions.setUpdateUser(CurrentUserUtil.getUserId()); |
|
|
|
opPermissions.setUpdateTime(DateUtils.now()); |