| | |
| | | import com.fasterxml.jackson.annotation.JsonInclude; |
| | | import com.moral.api.pojo.dto.account.AccountDTO; |
| | | import com.moral.api.pojo.dto.account.AccountQueryDTO; |
| | | import com.moral.constant.ResponseCodeEnum; |
| | | import lombok.Data; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | |
| | | |
| | | private List<AccountVO> accountVOs; |
| | | |
| | | public static AccountQueryVO convert(AccountQueryDTO dto){ |
| | | public static AccountQueryVO convert(AccountQueryDTO dto) { |
| | | if (dto.getCode() != ResponseCodeEnum.SUCCESS.getCode()) |
| | | return null; |
| | | |
| | | long total = dto.getTotal(); |
| | | long current = dto.getCurrent(); |
| | | long pages = dto.getPages(); |
| | | long size = dto.getSize(); |
| | | List<AccountVO> accountVOs = new ArrayList<>(); |
| | | List<AccountDTO> accountDTOs = dto.getAccountDTOS(); |
| | | for (AccountDTO accountDTO : accountDTOs) { |
| | | AccountVO vo = AccountVO.convert(accountDTO); |
| | | accountVOs.add(vo); |
| | | if (!ObjectUtils.isEmpty(accountDTOs)) { |
| | | for (AccountDTO accountDTO : accountDTOs) { |
| | | AccountVO vo = AccountVO.convert(accountDTO); |
| | | accountVOs.add(vo); |
| | | } |
| | | } |
| | | AccountQueryVO vo = new AccountQueryVO(); |
| | | vo.setTotal(total); |