码迷,mamicode.com
首页 > 其他好文 > 详细

iBatis多表查询

时间:2014-08-27 22:03:28      阅读:283      评论:0      收藏:0      [点我收藏+]

标签:java   ibatis   select   

<typeAlias alias="Product" type="com.shopping.entity.Product"/>     
    <typeAlias alias="ProductType" type="com.shopping.entity.ProductType"/>      
    
    <resultMap id="queryAllProduct" class="Product">     
     <result property="proId" column="proid"/>
     <result property="proName" column="proname"/>
     <result property="proDesc" column="prodesc"/>
     <result property="price" column="price"/>
     <result property="img" column="img"/>
     <result property="proTime" column="protime"/>
     <result property="size" column="size"/>
     <result property="type" column="typeid" select="queryProductTypeById"/>     
    </resultMap>  

<select id="queryProductTypeById" parameterClass="int" resultClass="ProductType" >
  select typeid,typename from producttype where typeid=#typeid#
<select>

<select id="queryAllProducts" resultMap="queryAllProduct">
  select proid,proname,prodesc,price,img,protime,size,typeid from product
<select>
bubuko.com,布布扣

iBatis多表查询

标签:java   ibatis   select   

原文地址:http://blog.csdn.net/u010056403/article/details/38875997

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!