package com.moral.api.pojo.vo;
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.moral.api.pojo.dto.AccountInfoDTO;
|
import com.moral.api.pojo.dto.LoginDTO;
|
import lombok.Data;
|
import org.springframework.util.ObjectUtils;
|
|
/**
|
* @ClassName LoginVo
|
* @Description TODO
|
* @Author 陈凯裕
|
* @Date 2021/3/13 16:09
|
* @Version TODO
|
**/
|
|
@Data
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
public class LoginVO {
|
/*
|
* 登陆成功
|
* */
|
public static final String SUCCESS = "0";
|
|
/*
|
* 用户不存在
|
* */
|
public static final String NOT_EXIST = "-1";
|
|
/*
|
* 用户已被封禁
|
* */
|
public static final String IS_DELETE = "-2";
|
|
/*
|
* 密码错误
|
* */
|
public static final String PASSWORD_ERROR = "-3";
|
|
/*
|
* 角色尚未分配
|
* */
|
public static final String ROLE_EMPTY = "-4";
|
|
/*
|
* 菜单尚未分配
|
* */
|
public static final String MENU_EMPTY = "-5";
|
|
/*
|
* 状态码
|
* */
|
private String code;
|
|
/*
|
*用户token
|
* */
|
private String token;
|
|
/*
|
* 用户基本信息
|
* */
|
private AccountInfoVO accountInfoVO;
|
|
/**
|
* @Description: DTO转换VO
|
* @Param: [dto]
|
* @return: com.moral.api.pojo.vo.LoginVO
|
* @Author: 陈凯裕
|
* @Date: 2021/3/13
|
*/
|
public static LoginVO convert(LoginDTO dto) {
|
LoginVO vo = new LoginVO();
|
String code = dto.getCode();
|
String token = dto.getToken();
|
AccountInfoDTO accountInfoDTO = dto.getAccountInfoDTO();
|
if (!ObjectUtils.isEmpty(accountInfoDTO)) {
|
AccountInfoVO accountInfoVO = AccountInfoVO.convert(accountInfoDTO);
|
vo.setAccountInfoVO(accountInfoVO);
|
}
|
vo.setToken(token);
|
vo.setCode(code);
|
return vo;
|
}
|
}
|