| | |
| | | |
| | | import org.jeecg.modules.tms.entity.OutboundOrder; |
| | | import org.jeecg.modules.tms.entity.dto.OutboundOrderAndDetailDto; |
| | | import org.mapstruct.BeanMapping; |
| | | import org.mapstruct.Mapper; |
| | | import org.mapstruct.NullValuePropertyMappingStrategy; |
| | | import org.mapstruct.ReportingPolicy; |
| | | import org.mapstruct.factory.Mappers; |
| | | |
| | | /** |
| | | * 使用 MapStruct 方式进行属性复制 |
| | | * 注意不能放在 mybatis扫描的mapper包下面,否则会报错 |
| | | */ |
| | | @Mapper |
| | | @Mapper( |
| | | unmappedTargetPolicy = ReportingPolicy.IGNORE, // 忽略目标中未被映射的字段 |
| | | componentModel = "spring" // 如果使用 Spring,可生成 Spring 管理的 Bean |
| | | ) |
| | | public interface OutboundOrderConvert { |
| | | |
| | | |
| | | OutboundOrderConvert INSTANCE = Mappers.getMapper(OutboundOrderConvert.class); |
| | | |
| | | @BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)// 忽略 null 字段 |
| | | OutboundOrder convert(OutboundOrderAndDetailDto dto); |
| | | } |