|
@@ -1,5 +1,7 @@
|
|
|
package com.ruoyi.system.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.ruoyi.common.annotation.DataScope;
|
|
|
import com.ruoyi.common.constant.UserConstants;
|
|
@@ -17,6 +19,7 @@ import com.ruoyi.system.mapper.SysRoleMapper;
|
|
|
import com.ruoyi.system.mapper.SysRoleMenuMapper;
|
|
|
import com.ruoyi.system.mapper.SysUserRoleMapper;
|
|
|
import com.ruoyi.system.service.ISysRoleService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -29,6 +32,7 @@ import java.util.*;
|
|
|
* @author ruoyi
|
|
|
*/
|
|
|
@Service
|
|
|
+@Slf4j
|
|
|
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements ISysRoleService {
|
|
|
|
|
|
@Autowired
|
|
@@ -221,6 +225,12 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int updateRole(SysRole role) {
|
|
|
+
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ String tenantId = SecurityUtils.getTenantId();
|
|
|
+ log.error("调用方法:updateRole,tenantId:{},userId:{},date:{},data;{}",
|
|
|
+ tenantId, userId, DateUtil.formatDateTime(new Date()), JSONObject.toJSONString(role));
|
|
|
+
|
|
|
// 修改角色信息
|
|
|
roleMapper.updateRole(role);
|
|
|
// 删除角色与菜单关联
|
|
@@ -311,6 +321,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
|
@Override
|
|
|
@Transactional
|
|
|
public int deleteRoleById(Long roleId) {
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ String tenantId = SecurityUtils.getTenantId();
|
|
|
+ log.error("调用方法:deleteRoleById,tenantId:{},userId:{},date:{},data;{}",
|
|
|
+ tenantId, userId, DateUtil.formatDateTime(new Date()), JSONObject.toJSONString(roleId));
|
|
|
+
|
|
|
// 删除角色与菜单关联
|
|
|
roleMenuMapper.deleteRoleMenuByRoleId(roleId);
|
|
|
// 删除角色与部门关联
|
|
@@ -387,6 +402,11 @@ public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> impl
|
|
|
|
|
|
@Override
|
|
|
public void editRoleMenu(SysRole role) {
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
+ String tenantId = SecurityUtils.getTenantId();
|
|
|
+ log.error("调用方法:editRoleMenu,tenantId:{},userId:{},date:{},data;{}",
|
|
|
+ tenantId, userId, DateUtil.formatDateTime(new Date()), JSONObject.toJSONString(role));
|
|
|
+
|
|
|
// 删除角色与菜单关联
|
|
|
roleMenuMapper.deleteRoleMenuByRoleId(role.getRoleId());
|
|
|
int num = insertRoleMenu(role);
|