您好,欢迎来到爱玩科技网。
搜索
您的当前位置:首页使用resultMap实现ibatis复合数据结构查询(1.多重属性查询;2.属

使用resultMap实现ibatis复合数据结构查询(1.多重属性查询;2.属

来源:爱玩科技网


以订单为例,直接上代码: 1.多重属性查询 java实体 public class OrderDetail { @XmlElement(required = true) protected String orderSn; @XmlElement(required = true) protected String orderAmount; @XmlElement(required = true) protected String order

以订单为例,直接上代码:

1.多重属性查询

java实体

public class OrderDetail {

 @XmlElement(required = true)
 protected String orderSn;
 @XmlElement(required = true)
 protected String orderAmount;
 @XmlElement(required = true)
 protected String orderStatus;
 @XmlElement(required = true)
 protected String orderAddTime;
 @XmlElement(required = true)
 protected Logistics logistics;
 @XmlElement(required = true)
 protected OrderGoods orderGoods;
 @XmlElement(required = true)
 protected List listData;
 ... getter setter...
}

class="orderDetail" 即为上面的类,有个属性logistics的类型是复合类型Logistics

	
	
	
	
	
	
	
	 -->
	
	
	
	
	
	
	
	
	
sql查询语句如下:
 

2.属性中含有列表查询

orderDetail有个属性orderGoods的类型是List复合类型,应在resultMap的属性定义中给这个list做查询 :getOrderGoodsList

看下这个查询 getOrderGoodsList

 
 
返回结果也是一个resultMap -- orderGoodsMap

	
		

Copyright © 2019- aiwanbo.com 版权所有 赣ICP备2024042808号-3

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务