|  |  | 
 |  |  | 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);
 | 
 |  |  |     }
 | 
 |  |  | 
 | 
 |  |  | }
 |