package com.jilongda.manage.utils;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.jilongda.common.security.JwtTokenUtils;
|
import com.jilongda.manage.authority.mapper.SecUserMapper;
|
import com.jilongda.manage.authority.model.SecUser;
|
import lombok.Data;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Component;
|
|
import java.io.Serializable;
|
|
/**
|
* @Description
|
* @Author xiaochen
|
* @Date 2022/5/6/00618:48
|
*/
|
@Data
|
@Slf4j
|
@Component
|
public class UserUtil implements Serializable {
|
|
@Autowired
|
private SecUserMapper secUserMapper;
|
|
/**
|
* 获取后台用户信息
|
*
|
* @return
|
*/
|
public SecUser getSecUser() {
|
String username = JwtTokenUtils.getUsername();
|
log.info("用户账号名:{}", username);
|
SecUser secUser = secUserMapper.selectOne(Wrappers.lambdaQuery(SecUser.class)
|
.eq(SecUser::getAccount, username));
|
return secUser;
|
}
|
|
/**
|
* 获取h5用户信息
|
* @return
|
*/
|
/*public WxUserInfo getWxUser(HttpServletRequest request){
|
String openid = JwtTokenUtils.getUsername();
|
WxUserInfo wxUserInfo = wxUserInfoMapper.selectOne(Wrappers.lambdaQuery(WxUserInfo.class)
|
.eq(WxUserInfo::getOpenid, openid)
|
.last("LIMIT 1"));
|
log.info("token取出的用户信息为:{}",wxUserInfo);
|
return wxUserInfo;
|
}*/
|
|
}
|