zoukankan      html  css  js  c++  java
  • mybatis 关联查询

    一对一

    <association property="dep" column="id" select="namespace.id"/>
    
    <association property="dep" javaType="com.baizhi.entity.Emp">
        <result column="id" property="id"/>
    </association>
    

    一对多

    <!--
    在关联查询时,如何传入多个参数给关联查询语句
    1. 确认被关联语句中的接受参数的属性名
    2. 在创建查询的语句中,构建虚拟列作为参数,如以下的:“#{id} as did,#{status} as statu” 这两个属性无需映射对象属性,就是作为参数传给关联对象
    3. 使用colume={id=did,status=statu}将对应参数传过去
    -->
    <select id="getDepVOByidAndType" parameterType="java.util.Map" resultMap="maps">
        select id as id ,depName as depName,#{id} as did,#{status} as statu from dep where id = #{id}
    </select>
    <resultMap id="maps" type="com.baizhi.entity.Emp">
       <collection property="emps" column="{id=did,status=statu}" select="namespace.id"/>
    </resultMap>
    
  • 相关阅读:
    ehcache 使用
    android 换肤 apk
    ant 打不同渠道包
    strawberry perl
    rest 网络设计开发,降低复杂性设计方案
    android 进度条
    android 算定义布局xml
    ant 自动打包
    c# 调用cmd 输出 阻塞 解决
    web service2
  • 原文地址:https://www.cnblogs.com/raising/p/14531158.html
Copyright © 2011-2022 走看看