Commit d82c2710 by 袁伟铭

1.0.0

parent c689db66
......@@ -25,6 +25,7 @@ import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
......@@ -32,7 +33,6 @@ import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;
......
......@@ -109,7 +109,7 @@ public class UserService {
private ApiTokenVo getApiToken(AppUser appUser) {
ApiTokenVo tokenVo = ApiTokenVo.builder()
.userId(appUser.getId())
.userId(appUser.getId().toString())
.account(appUser.getAccount())
.phone(appUser.getPhone())
.realname(appUser.getRealname())
......
......@@ -27,7 +27,7 @@ public class ContextUtils {
return ThreadContext.get(APP_TOKEN_CONTEXT_KEY);
}
public static Long getUserUserId() {
public static String getUserUserId() {
ApiTokenVo apiTokenVo = ThreadContext.get(APP_TOKEN_CONTEXT_KEY);
return apiTokenVo == null ? null : apiTokenVo.getUserId();
}
......
......@@ -7,7 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.zq.common.exception.BusinessException;
import com.zq.common.vo.PageReqVo;
import com.zq.common.vo.PageVo;
......@@ -49,13 +48,8 @@ public class PagingUtils {
* @return
*/
public static <R, Q extends PageReqVo> PageVo<R> paging(Q reqVo, BaseMapper<R> mapper, Class<R> clazz) {
R instance;
try {
instance = clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new BusinessException("分页类型转换错误");
}
BeanUtil.copyProperties(reqVo, instance);
R instance = BeanUtil.copyProperties(reqVo, clazz);
IPage<R> page = new Page<>(reqVo.getPage(), reqVo.getSize());
page = mapper.selectPage(page, Wrappers.lambdaQuery(instance));
return PageVo.ofReqVo(reqVo, page.getRecords(), Long.valueOf(page.getTotal()).intValue());
......@@ -90,13 +84,8 @@ public class PagingUtils {
*/
@SuppressWarnings("all")
public static <R, Q extends PageReqVo> PageVo<R> paging(Q reqVo, BaseMapper<R> mapper, Class<R> clazz, LambdaQueryWrapper<R> lambdaQuery) {
R instance;
try {
instance = clazz.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new BusinessException("分页类型转换错误");
}
BeanUtil.copyProperties(reqVo, instance);
R instance = BeanUtil.copyProperties(reqVo, clazz);
IPage<R> page = new Page<>(reqVo.getPage(), reqVo.getSize());
page = mapper.selectPage(page, lambdaQuery.setEntity(instance));
return PageVo.ofReqVo(reqVo, page.getRecords(), Long.valueOf(page.getTotal()).intValue());
......
......@@ -5,13 +5,17 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author wilmiam
* @since 2022-01-27 11:13
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class ApiTokenVo {
private Long userId;
private String userId;
private String account;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment