package com.moral.api.pojo.vo.login;
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.moral.api.pojo.redisBean.AccountInfoDTO;
|
import com.moral.api.pojo.dto.login.LoginDTO;
|
import com.moral.constant.ResponseCodeEnum;
|
import lombok.Data;
|
|
/**
|
* @ClassName LoginVo
|
* @Description TODO
|
* @Author 陈凯裕
|
* @Date 2021/3/13 16:09
|
* @Version TODO
|
**/
|
|
@Data
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
public class LoginVO {
|
|
/*
|
*用户token
|
* */
|
private String token;
|
|
/*
|
* 用户基本信息
|
* */
|
private AccountInfoVO accountInfoVO;
|
|
/**
|
* @Description: DTO转换VO
|
* @Param: [dto]
|
* @return: com.moral.api.pojo.vo.login.LoginVO
|
* @Author: 陈凯裕
|
* @Date: 2021/3/13
|
*/
|
public static LoginVO convert(LoginDTO dto) {
|
if (dto.getCode() != ResponseCodeEnum.SUCCESS.getCode())
|
return null;
|
|
LoginVO vo = new LoginVO();
|
String token = dto.getToken();
|
AccountInfoDTO accountInfoDTO = dto.getAccountInfoDTO();
|
AccountInfoVO accountInfoVO = AccountInfoVO.convert(accountInfoDTO);
|
vo.setAccountInfoVO(accountInfoVO);
|
vo.setToken(token);
|
return vo;
|
}
|
}
|