Search in sources :

Example 76 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project hocassian-media-matrix by hokaso.

the class SysUserServiceImpl method checkEmailUnique.

/**
 * 校验email是否唯一
 *
 * @param user 用户信息
 * @return
 */
@Override
public String checkEmailUnique(SysUser user) {
    Long userId = StringUtils.isNull(user.getUserId()) ? -1L : user.getUserId();
    SysUser info = userMapper.checkEmailUnique(user.getEmail());
    if (StringUtils.isNotNull(info) && info.getUserId().longValue() != userId.longValue()) {
        return UserConstants.NOT_UNIQUE;
    }
    return UserConstants.UNIQUE;
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser)

Example 77 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project hocassian-media-matrix by hokaso.

the class SysUserServiceImpl method deleteUserByIds.

/**
 * 批量删除用户信息
 *
 * @param userIds 需要删除的用户ID
 * @return 结果
 */
@Override
@Transactional
public int deleteUserByIds(Long[] userIds) {
    for (Long userId : userIds) {
        checkUserAllowed(new SysUser(userId));
    }
    // 删除用户与角色关联
    userRoleMapper.deleteUserRole(userIds);
    // 删除用户与岗位关联
    userPostMapper.deleteUserPost(userIds);
    return userMapper.deleteUserByIds(userIds);
}
Also used : SysUser(com.ruoyi.common.core.domain.entity.SysUser) Transactional(org.springframework.transaction.annotation.Transactional)

Example 78 with SysUser

use of com.ruoyi.common.core.domain.entity.SysUser in project hocassian-media-matrix by hokaso.

the class SysLoginController method getInfo.

/**
 * 获取用户信息
 *
 * @return 用户信息
 */
@GetMapping("getInfo")
public AjaxResult getInfo() {
    LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
    SysUser user = loginUser.getUser();
    // 角色集合
    Set<String> roles = permissionService.getRolePermission(user);
    // 权限集合
    Set<String> permissions = permissionService.getMenuPermission(user);
    AjaxResult ajax = AjaxResult.success();
    ajax.put("user", user);
    ajax.put("roles", roles);
    ajax.put("permissions", permissions);
    return ajax;
}
Also used : AjaxResult(com.ruoyi.common.core.domain.AjaxResult) SysUser(com.ruoyi.common.core.domain.entity.SysUser) LoginUser(com.ruoyi.common.core.domain.model.LoginUser) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Aggregations

SysUser (com.ruoyi.common.core.domain.entity.SysUser)78 Log (com.ruoyi.common.annotation.Log)16 SysRole (com.ruoyi.common.core.domain.entity.SysRole)13 LoginUser (com.ruoyi.common.core.domain.model.LoginUser)13 GetMapping (org.springframework.web.bind.annotation.GetMapping)11 AjaxResult (com.ruoyi.common.core.domain.AjaxResult)10 ServiceException (com.ruoyi.common.exception.ServiceException)10 SaCheckPermission (cn.dev33.satoken.annotation.SaCheckPermission)8 ExcelUtil (com.ruoyi.common.utils.poi.ExcelUtil)8 Transactional (org.springframework.transaction.annotation.Transactional)8 UserConstants (com.ruoyi.common.constant.UserConstants)7 BaseController (com.ruoyi.common.core.controller.BaseController)7 TableDataInfo (com.ruoyi.common.core.page.TableDataInfo)7 BusinessType (com.ruoyi.common.enums.BusinessType)7 StringUtils (com.ruoyi.common.utils.StringUtils)7 ISysPostService (com.ruoyi.system.service.ISysPostService)7 ISysRoleService (com.ruoyi.system.service.ISysRoleService)7 ISysUserService (com.ruoyi.system.service.ISysUserService)7 List (java.util.List)7 Collectors (java.util.stream.Collectors)7