zoukankan      html  css  js  c++  java
  • IBaits联合查询

    1、复杂类型查询

    <resultMap id=”get-product-result” class=”com.ibatis.example.Product”>
    <result property=”id” column=”PRD_ID”/>
    <result property=”description” column=”PRD_DESCRIPTION”/>
    <result property=”category” column=”PRD_CAT_ID” select=”getCategory”/>
    </resultMap>
    <resultMap id=”get-category-result” class=”com.ibatis.example.Category”>
    <result property=”id” column=”CAT_ID”/>
    <result property=”description” column=”CAT_DESCRIPTION”/>
    </resultMap>
    <statement id=”getProduct” parameterClass=”int” resultMap=”get-product-result”>
    select * from PRODUCT where PRD_ID = #value#
    </statement>
    <statement id=”getCategory” parameterClass=”int” resultMap=”get-category-result”>
    select * from CATEGORY where CAT_ID = #value#
    </statement>

    2、联合查询

    <resultMap id=”get-product-result” class=”com.ibatis.example.Product”>
    <result property=”id” column=”PRD_ID”/>
    <result property=”description” column=”PRD_DESCRIPTION”/>
    <result property=”category.id” column=”CAT_ID” />
    <result property=”category.description” column=”CAT_DESCRIPTION” />
    </resultMap>
    <statement id=”getProduct” parameterClass=”int” resultMap=”get-product-result”>
    select *
    from PRODUCT, CATEGORY
    where PRD_CAT_ID=CAT_ID
    and PRD_ID = #value#
    </statement>
  • 相关阅读:
    Vuejs模板绑定
    Vuejs基本使用
    Vuejs简介
    echarts 使用配置模式(含事件)
    JS 对象(Object)和字符串(String)互转
    HTML Meta中添加X-UA-Compatible和IE=Edge,chrome=1有什么作用
    highcharts点击事件系列
    servlet填充Response时,数据转换之content-type
    leetcode-70. Climbing Stairs
    deep copy and shallow copy
  • 原文地址:https://www.cnblogs.com/Shadow3627/p/2990038.html
Copyright © 2011-2022 走看看