DozerBeanMapper 配置
applicationContext.xml
<bean id="mapper" class="org.dozer.spring.DozerBeanMapperFactoryBean" scope="singleton">
<property name="mappingFiles">
<list>
<value>classpath*:/*mapping.xml</value>
</list>
</property>
</bean>
pom.xml
<!-- dozer -->
<dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer</artifactId>
<version>5.5.1</version>
</dependency> <dependency>
<groupId>net.sf.dozer</groupId>
<artifactId>dozer-spring</artifactId>
<version>5.5.1</version>
</dependency>
outboundnotice-mapping.xml
<class-a>指定所要复制的源对象,<class-b>复制的目标对象,<a>源对象的属性名, <b>目标对象的属性名。
wildcard默认为true,在此时默认对所有属性进行map,如果为false,则只对在xml文件中配置的属性进行map。
<?xml version="1.0" encoding="UTF-8"?>
<mappings xmlns="http://dozer.sourceforge.net"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://dozer.sourceforge.net http://dozer.sourceforge.net/schema/beanmapping.xsd"> <mapping wildcard="false" type="one-way">
<class-a>com.yundaex.wms.outbound.po.RivOutboundNoticeH</class-a>
<class-b>com.yundaex.wms.core.status.po.RivStatusHistory</class-b> <!-- 单头ID -->
<field>
<a>onhId</a>
<b>shHeaderId</b>
</field> </mapping> <mapping wildcard="false" type="one-way">
<class-a>com.yundaex.wms.outbound.po.RivPickL</class-a>
<class-b>com.yundaex.wms.core.status.po.RivStatusHistory</class-b> <!-- 单头ID -->
<field>
<a>pklId</a>
<b>shHeaderId</b>
</field> </mapping> <mapping type="one-way" wildcard="false">
<class-a>com.yundaex.wms.outbound.bo.SrcPickAllocateBO</class-a>
<class-b>com.yundaex.wms.core.store.bo.QuantWithDtl</class-b> <field>
<a>detail.pklSrcContainerId</a>
<b>qtContainerId</b>
</field> <field>
<a>detail.pklExpiryDate</a>
<b>qtExpiryDate</b>
</field> <field>
<a>detail.pklSrcLocationId</a>
<b>qtLocationId</b>
</field> <field>
<a>detail.pklLotItem1</a>
<b>qtLotItem1</b>
</field> <field>
<a>detail.pklLotItem2</a>
<b>qtLotItem2</b>
</field> <field>
<a>detail.pklLotItem3</a>
<b>qtLotItem3</b>
</field> <field>
<a>detail.pklLotNo</a>
<b>qtLotNo</b>
</field> <field>
<a>detail.pklLotString1</a>
<b>qtLotString1</b>
</field> <field>
<a>detail.pklLotString2</a>
<b>qtLotString2</b>
</field> <field>
<a>detail.pklLotString3</a>
<b>qtLotString3</b>
</field> <field>
<a>detail.pklLotString4</a>
<b>qtLotString4</b>
</field> <field>
<a>detail.pklLotString5</a>
<b>qtLotString5</b>
</field> <field>
<a>detail.pklSrcLpn</a>
<b>qtLpn</b>
</field> <field>
<a>detail.pklManufDate</a>
<b>qtManufDate</b>
</field> <field>
<a>detail.pklMaterialId</a>
<b>qtMaterialId</b>
</field> <field>
<a>detail.pklMaterialStatusId</a>
<b>qtMaterialStatusId</b>
</field> <field>
<a>head.onhOrgId</a>
<b>qtOrgId</b>
</field> <field>
<a>head.onhOwnerId</a>
<b>qtOwnerId</b>
</field> <field>
<a>detail.pklRecvDate</a>
<b>qtRecvDate</b>
</field> <!-- 推车格子号不作用于库存变动 拣货明细中格子号是一直为空的 -->
<!--
<field>
<a>detail.pklSrcTrolleyCellNo</a>
<b>qtTrolleyCellNo</b>
</field>
--> <field>
<a>detail.pklVoucherNo</a>
<b>qtVoucherNo</b>
</field> </mapping> <mapping type="one-way" wildcard="false">
<class-a>com.yundaex.wms.outbound.bo.DestPickAllocateBO</class-a>
<class-b>com.yundaex.wms.core.store.bo.QuantWithDtl</class-b> <field>
<a>detail.pklDestContainerId</a>
<b>qtContainerId</b>
</field> <field>
<a>detail.pklExpiryDate</a>
<b>qtExpiryDate</b>
</field> <field>
<a>detail.pklDestLocationId</a>
<b>qtLocationId</b>
</field> <field>
<a>detail.pklLotItem1</a>
<b>qtLotItem1</b>
</field> <field>
<a>detail.pklLotItem2</a>
<b>qtLotItem2</b>
</field> <field>
<a>detail.pklLotItem3</a>
<b>qtLotItem3</b>
</field> <field>
<a>detail.pklLotNo</a>
<b>qtLotNo</b>
</field> <field>
<a>detail.pklLotString1</a>
<b>qtLotString1</b>
</field> <field>
<a>detail.pklLotString2</a>
<b>qtLotString2</b>
</field> <field>
<a>detail.pklLotString3</a>
<b>qtLotString3</b>
</field> <field>
<a>detail.pklLotString4</a>
<b>qtLotString4</b>
</field> <field>
<a>detail.pklLotString5</a>
<b>qtLotString5</b>
</field> <field>
<a>detail.pklDestLpn</a>
<b>qtLpn</b>
</field> <field>
<a>detail.pklManufDate</a>
<b>qtManufDate</b>
</field> <field>
<a>detail.pklMaterialId</a>
<b>qtMaterialId</b>
</field> <field>
<a>detail.pklMaterialStatusId</a>
<b>qtMaterialStatusId</b>
</field> <field>
<a>head.onhOrgId</a>
<b>qtOrgId</b>
</field> <field>
<a>head.onhOwnerId</a>
<b>qtOwnerId</b>
</field> <field>
<a>detail.pklRecvDate</a>
<b>qtRecvDate</b>
</field> <!-- 推车格子号不作用于库存变动 拣货明细中格子号是一直为空的 -->
<!--
<field>
<a>detail.pklSrcTrolleyCellNo</a>
<b>qtTrolleyCellNo</b>
</field>
--> <field>
<a>detail.pklVoucherNo</a>
<b>qtVoucherNo</b>
</field> </mapping> <mapping wildcard="false" type="one-way">
<class-a>com.yundaex.wms.outbound.po.RivOutboundNoticeH</class-a>
<class-b>com.yundaex.wms.outbound.po.RivOutboundNoticeH</class-b> <field>
<a>onhCarrierId</a>
<b>onhCarrierId</b>
</field> <field>
<a>onhConsignee</a>
<b>onhConsignee</b>
</field> <field>
<a>onhConsigneeAddress</a>
<b>onhConsigneeAddress</b>
</field> <field>
<a>onhConsigneeMobile</a>
<b>onhConsigneeMobile</b>
</field> <field>
<a>onhConsigneePostCode</a>
<b>onhConsigneePostCode</b>
</field> <field>
<a>onhConsigneeTel</a>
<b>onhConsigneeTel</b>
</field> <field>
<a>onhExpectDatetime</a>
<b>onhExpectDatetime</b>
</field> <field>
<a>onhInputDatetime</a>
<b>onhInputDatetime</b>
</field> <field>
<a>onhInputUserId</a>
<b>onhInputUserId</b>
</field> <field>
<a>onhOrderDatetime</a>
<b>onhOrderDatetime</b>
</field> <field>
<a>onhOrgId</a>
<b>onhOrgId</b>
</field> <field>
<a>onhOwnerId</a>
<b>onhOwnerId</b>
</field> <field>
<a>onhTxType</a>
<b>onhTxType</b>
</field> <field>
<a>onhConsAddressCity</a>
<b>onhConsAddressCity</b>
</field> <field>
<a>onhConsAddressDistrict</a>
<b>onhConsAddressDistrict</b>
</field> <field>
<a>onhConsAddressProvince</a>
<b>onhConsAddressProvince</b>
</field> <field>
<a>onhShopName</a>
<b>onhShopName</b>
</field> <field>
<a>onhPlatformCode</a>
<b>onhPlatformCode</b>
</field> <field>
<a>onhPlatformName</a>
<b>onhPlatformName</b>
</field> <field>
<a>onhBuyerNickname</a>
<b>onhBuyerNickname</b>
</field> <field>
<a>onhTransactionNo</a>
<b>onhTransactionNo</b>
</field> <field>
<a>onhPickUpType</a>
<b>onhPickUpType</b>
</field> <field>
<a>onhSender</a>
<b>onhSender</b>
</field> <field>
<a>onhSenderAddress</a>
<b>onhSenderAddress</b>
</field> <field>
<a>onhSenderMobile</a>
<b>onhSenderMobile</b>
</field> <field>
<a>onhSenderPostCode</a>
<b>onhSenderPostCode</b>
</field> <field>
<a>onhSenderTel</a>
<b>onhSenderTel</b>
</field> <field>
<a>onhSetPackageDestination</a>
<b>onhSetPackageDestination</b>
</field> </mapping> <mapping wildcard="false" type="one-way">
<class-a>com.yundaex.wms.outbound.po.RivOutboundNoticeL</class-a>
<class-b>com.yundaex.wms.outbound.po.RivOutboundNoticeL</class-b> <field>
<a>onlMaterialId</a>
<b>onlMaterialId</b>
</field> <field>
<a>onlPrice</a>
<b>onlPrice</b>
</field> <field>
<a>onlNoticeQty</a>
<b>onlNoticeQty</b>
</field> <field>
<a>onlAllocQty</a>
<b>onlAllocQty</b>
</field> <field>
<a>onlRemark</a>
<b>onlRemark</b>
</field> </mapping> </mappings>
private static final Mapper mapper = (Mapper) SpringContext.getBean("mapper"); QuantWithDtl sourceQuant = mapper.map(source, QuantWithDtl.class);
DozerBeanMapper 配置的更多相关文章
- DozerBeanMapper + 对象转Map方法
1.简介 dozer是一种JavaBean的映射工具,类似于apache的BeanUtils.但是dozer更强大,它可以灵活的处理复杂类型之间的映射.不但可以进行简单的属性映射.复杂的类型映 ...
- 配置android sdk 环境
1:下载adnroid sdk安装包 官方下载地址无法打开,没有vpn,使用下面这个地址下载,地址:http://www.android-studio.org/
- Android Studio配置 AndroidAnnotations——Hi_博客 Android App 开发笔记
以前用Eclicps 用习惯了现在 想学学 用Android Studio 两天的钻研终于 在我电脑上装了一个Android Studio 并完成了AndroidAnnotations 的配置. An ...
- react-router 组件式配置与对象式配置小区别
1. react-router 对象式配置 和 组件式配置 组件式配置(Redirect) ----对应---- 对象式配置(onEnter钩子) IndexRedirect -----对应-- ...
- 总结:Mac前端开发环境的搭建(配置)
新年新气象,在2016年的第一天,我入手了人生中第一台自己的电脑(大一时好友赠送的电脑在一次无意中烧坏了主板,此后便不断借用别人的或者网站的).macbook air,身上已无分文...接下来半年的房 ...
- Android Studio 多个编译环境配置 多渠道打包 APK输出配置
看完这篇你学到什么: 熟悉gradle的构建配置 熟悉代码构建环境的目录结构,你知道的不仅仅是只有src/main 开发.生成环境等等环境可以任意切换打包 多渠道打包 APK输出文件配置 需求 一般我 ...
- Virtual Box配置CentOS7网络(图文教程)
之前很多次安装CentOS7虚拟机,每次配置网络在网上找教程,今天总结一下,全图文配置,方便以后查看. Virtual Box可选的网络接入方式包括: NAT 网络地址转换模式(NAT,Network ...
- [linux]阿里云主机的免登陆安全SSH配置与思考
公司服务器使用的第三方云端服务,即阿里云,而本地需要经常去登录到服务器做相应的配置工作,鉴于此,每次登录都要使用密码是比较烦躁的,本着极速思想,我们需要配置我们的免登陆. 一 理论概述 SSH介绍 S ...
- nginx配置反向代理或跳转出现400问题处理记录
午休完上班后,同事说测试站点访问接口出现400 Bad Request Request Header Or Cookie Too Large提示,心想还好是测试服务器出现问题,影响不大,不过也赶紧上 ...
随机推荐
- 【JVM】jvm垃圾回收器相关垃圾回收算法
引用计数法[原理]--->引用计数器是经典的也是最古老的垃圾收集防范.--->实现原理:对于对象A,只要有任何一个对象引用A,则计数器加1.当引用失效时,计数器减1.只要对象A的计数器值为 ...
- SYS/BIOS实例分析
SYS/BIOS简介 SYS/BIOS是一个可扩展的实时内核(或者说是操作系统),其提供了许多模块化的APIs(应用程序接口),支持抢占式多线程,硬件抽象,实时分析和配置工具,其设计目的是为了最大限度 ...
- HDU1042(N!:设4为基数)
N! Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submi ...
- HDOJ1073(gets 应用)
练习操作字符串的好题. #include<cstdio> #include<algorithm> #include<cstring> using namespace ...
- 【转】 Pro Android学习笔记(三二):Menu(3):Context菜单
目录(?)[-] 什么是Context menu 注册View带有Context menu 填Context菜单内容 Context菜单点击触发 什么是Context menu 在桌面电脑,我们都很熟 ...
- JQuery鼠标移动上去显示预览图
body中: <img src="../images/icon_view.gif" bigimg="../img.jpg" title="查看预 ...
- 值得细细品读的URL资源
Web安全渗透方面的资源指南: 知乎综合问答:https://www.zhihu.com/question/21914899 渗透测试经典演练系统:http://www.freebuf.com/sec ...
- fdisk查看硬盘分区表
fdisk [选项] <磁盘> 更改分区表 fdisk [选项] -l <磁盘> 列出分区表 fdisk -s <分区> 给出分区大小(块数) ...
- 全文检索技术---solr
1 Solr介绍 1.1 什么是solr Solr 是Apache下的一个顶级开源项目,采用Java开发,它是基于Lucene的全文搜索服务器.Solr可以独立运行在Jetty.Tom ...
- Makefiles
A tutorial by example Compiling your source code files can be tedious, specially when you want to in ...