From 7bad1a49ff295fb7f2a44c859d7f3b5c9dd6d20f Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Tue, 26 May 2020 18:22:36 +0800 Subject: [PATCH] 20200526 代码提交 --- src/test/java/com/xcong/excoin/mapper/MapStructMapper.java | 191 +++++++++++++++++++++++++---------------------- 1 files changed, 102 insertions(+), 89 deletions(-) diff --git a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java index 97436ae..08beda8 100644 --- a/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java +++ b/src/test/java/com/xcong/excoin/mapper/MapStructMapper.java @@ -1,89 +1,102 @@ -package com.xcong.excoin.mapper; - -import lombok.extern.slf4j.Slf4j; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; - -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -/** - * @author wzy - * @date 2020-05-05 10:59 - **/ -@Slf4j -@SpringBootTest -public class MapStructMapper { - - - @Test - public void mapperConvert() { - Car car = new Car(); - car.setColor("123"); - car.setName("321"); - car.setCreateTime(new Date()); - CarDto carDto = CarMapper.INSTANCE.carToCarDto(car); - log.info(carDto.toString()); - } - - @Test - public void carDtoToCarConvert() { - CarDto carDto = new CarDto(); - carDto.setName("dddd"); - carDto.setColor("aaaa"); - carDto.setCreateTime("2020-12-12 12:22:22"); - Car car = CarMapper.INSTANCE.carDtoToCar(carDto); - log.info(car.toString()); - } - - @Test - public void carToCarEntity() { - Car car = new Car(); - car.setName("123"); - car.setColor("33333"); - car.setCreateTime(new Date()); - CarEntity carEntity = CarMapper.INSTANCE.carToCarEntity(car); - log.info(carEntity.toString()); - } - - @Test - public void carEntityToCar() { - CarEntity carEntity = new CarEntity(); - carEntity.setUserName("11111"); - carEntity.setUserColor("33333"); - carEntity.setTime("2020-12-12 12:22:22"); - Car car = CarMapper.INSTANCE.carEntityToCar(carEntity); - log.info(car.toString()); - } - - @Test - public void carEntityListToCarList() { - List<CarEntity> list = new ArrayList<>(); - for (int i = 0; i < 4; i++) { - CarEntity carEntity = new CarEntity(); - carEntity.setTime("2020-12-12 12:22:33"); - carEntity.setUserName("zs" + i); - carEntity.setUserColor("red" + i); - list.add(carEntity); - } - List<Car> cars = CarMapper.INSTANCE.carsToCarEntities(list); - log.info(cars.toString()); - } - - @Test - public void carToCarEntityList() { - List<Car> list = new ArrayList<>(); - for (int i = 0; i < 4; i++) { - Car car = new Car(); - car.setName("zs"+i); - car.setColor("black" + i); - car.setCreateTime(new Date()); - list.add(car); - } - - List<CarEntity> entities = CarMapper.INSTANCE.carEntitiesToCarList(list); - log.info(entities.toString()); - } - -} +package com.xcong.excoin.mapper; + +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; + +import com.xcong.excoin.modules.coin.entity.OrderCoinsDealEntity; +import com.xcong.excoin.modules.coin.mapper.OrderWalletCoinDealMapper; +import com.xcong.excoin.modules.coin.parameter.vo.OrderWalletCoinDealVo; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +/** + * @author wzy + * @date 2020-05-05 10:59 + **/ +@Slf4j +@SpringBootTest +public class MapStructMapper { + + + @Test + public void mapperConvert() { + Car car = new Car(); + car.setColor("123"); + car.setName("321"); + car.setCreateTime(new Date()); + CarDto carDto = CarMapper.INSTANCE.carToCarDto(car); + log.info(carDto.toString()); + } + + @Test + public void carDtoToCarConvert() { + CarDto carDto = new CarDto(); + carDto.setName("dddd"); + carDto.setColor("aaaa"); + carDto.setCreateTime("2020-12-12 12:22:22"); + Car car = CarMapper.INSTANCE.carDtoToCar(carDto); + log.info(car.toString()); + } + + @Test + public void carToCarEntity() { + Car car = new Car(); + car.setName("123"); + car.setColor("33333"); + car.setCreateTime(new Date()); + CarEntity carEntity = CarMapper.INSTANCE.carToCarEntity(car); + log.info(carEntity.toString()); + } + + @Test + public void carEntityToCar() { + CarEntity carEntity = new CarEntity(); + carEntity.setUserName("11111"); + carEntity.setUserColor("33333"); + carEntity.setTime("2020-12-12 12:22:22"); + Car car = CarMapper.INSTANCE.carEntityToCar(carEntity); + log.info(car.toString()); + } + + @Test + public void carEntityListToCarList() { + List<CarEntity> list = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + CarEntity carEntity = new CarEntity(); + carEntity.setTime("2020-12-12 12:22:33"); + carEntity.setUserName("zs" + i); + carEntity.setUserColor("red" + i); + list.add(carEntity); + } + List<Car> cars = CarMapper.INSTANCE.carsToCarEntities(list); + log.info(cars.toString()); + } + + @Test + public void carToCarEntityList() { + List<Car> list = new ArrayList<>(); + for (int i = 0; i < 4; i++) { + Car car = new Car(); + car.setName("zs"+i); + car.setColor("black" + i); + car.setCreateTime(new Date()); + list.add(car); + } + + List<CarEntity> entities = CarMapper.INSTANCE.carEntitiesToCarList(list); + log.info(entities.toString()); + } + + @Test + public void walletCoinTest() { + OrderCoinsDealEntity orderCoinsDealEntity = new OrderCoinsDealEntity(); + orderCoinsDealEntity.setMemberId(1L); + orderCoinsDealEntity.setOrderNo("123445"); + OrderWalletCoinDealVo entityToVo = OrderWalletCoinDealMapper.INSTANCE.entityToVoOrder(orderCoinsDealEntity); + System.out.println(entityToVo); + } + +} -- Gitblit v1.9.1