|
|
@ -27,6 +27,7 @@ import org.dromara.system.domain.SysUser;
|
|
|
|
import org.dromara.system.domain.SysUserPost;
|
|
|
|
import org.dromara.system.domain.SysUserPost;
|
|
|
|
import org.dromara.system.domain.SysUserRole;
|
|
|
|
import org.dromara.system.domain.SysUserRole;
|
|
|
|
import org.dromara.system.domain.bo.SysUserBo;
|
|
|
|
import org.dromara.system.domain.bo.SysUserBo;
|
|
|
|
|
|
|
|
import org.dromara.system.domain.vo.SysDeptVo;
|
|
|
|
import org.dromara.system.domain.vo.SysPostVo;
|
|
|
|
import org.dromara.system.domain.vo.SysPostVo;
|
|
|
|
import org.dromara.system.domain.vo.SysRoleVo;
|
|
|
|
import org.dromara.system.domain.vo.SysRoleVo;
|
|
|
|
import org.dromara.system.domain.vo.SysUserVo;
|
|
|
|
import org.dromara.system.domain.vo.SysUserVo;
|
|
|
@ -264,6 +265,25 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 校验部门是否有数据权限
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @param deptId 部门id
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void checkDeptDataScope(Long deptId) {
|
|
|
|
|
|
|
|
if (ObjectUtil.isNull(deptId)) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (LoginHelper.isSuperAdmin()) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
SysDeptVo dept = deptMapper.selectDeptById(deptId);
|
|
|
|
|
|
|
|
if (ObjectUtil.isNull(dept)) {
|
|
|
|
|
|
|
|
throw new ServiceException("没有权限访问部门数据!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 新增保存用户信息
|
|
|
|
* 新增保存用户信息
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -273,6 +293,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public int insertUser(SysUserBo user) {
|
|
|
|
public int insertUser(SysUserBo user) {
|
|
|
|
|
|
|
|
this.checkDeptDataScope(user.getDeptId());
|
|
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
|
|
// 新增用户信息
|
|
|
|
// 新增用户信息
|
|
|
|
int rows = baseMapper.insert(sysUser);
|
|
|
|
int rows = baseMapper.insert(sysUser);
|
|
|
@ -308,6 +329,7 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public int updateUser(SysUserBo user) {
|
|
|
|
public int updateUser(SysUserBo user) {
|
|
|
|
|
|
|
|
this.checkDeptDataScope(user.getDeptId());
|
|
|
|
// 新增用户与角色管理
|
|
|
|
// 新增用户与角色管理
|
|
|
|
insertUserRole(user, true);
|
|
|
|
insertUserRole(user, true);
|
|
|
|
// 新增用户与岗位管理
|
|
|
|
// 新增用户与岗位管理
|
|
|
|