Home > Database > Mysql Tutorial > body text

iBatis多表查询

WBOY
Release: 2016-06-07 16:01:18
Original
1178 people have browsed it

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=prona

<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>
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template