Merge branch 'master' of gitee.com:youlaitech/youlai-mall

This commit is contained in:
haoxr 2023-04-12 00:00:15 +08:00
commit c651cf4995
3 changed files with 15 additions and 3 deletions

View File

@ -23,7 +23,7 @@ public @interface DataPermission {
String deptIdColumnName() default "dept_id";
String userAlias() default "";
String userIdColumnName() default "create_by";
String userIdColumnName() default "id";
}

View File

@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.youlai.common.result.ResultCode;
import com.youlai.system.dto.UserAuthInfo;
import com.youlai.system.pojo.dto.UserImportDTO;
import com.youlai.system.pojo.entity.SysUser;
@ -21,6 +22,7 @@ import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.simpleframework.xml.core.Validate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.util.StopWatch;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@ -49,7 +51,11 @@ public class SysUserController {
@ApiOperation(value = "用户分页列表")
@GetMapping("/pages")
public PageResult<UserVO> listUserPages(UserPageQuery queryParams) {
StopWatch stopWatch = new StopWatch();
stopWatch.start();
IPage<UserVO> result = userService.listUserPages(queryParams);
stopWatch.stop();
System.out.println("耗时:" + stopWatch.getTotalTimeMillis());
return PageResult.success(result);
}
@ -164,6 +170,10 @@ public class SysUserController {
@ApiParam("用户名") @PathVariable String username
) {
UserAuthInfo user = userService.getUserAuthInfo(username);
return Result.success(user);
if(user==null){
return Result.failed(ResultCode.USER_NOT_EXIST);
}else{
return Result.success(user);
}
}
}

View File

@ -210,7 +210,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
@Override
public UserAuthInfo getUserAuthInfo(String username) {
UserAuthInfo userAuthInfo = this.baseMapper.getUserAuthInfo(username);
if (userAuthInfo == null) {
return null;
}
Set<String> roles = userAuthInfo.getRoles();
if (CollectionUtil.isNotEmpty(roles)) {
Set<String> perms = menuService.listRolePerms(roles);