mybatis中如何查询一对多的关联列表数据

来源:互联网 发布:dnf不停的网络连接中断 编辑:程序博客网 时间:2024/06/10 05:04
(1)查询方法< select id="selectAllToolsModule"  resultMap="toolsModuleTypes" ><span style="white-space:pre"></span>select t.id as "id", t.name as "name", t.status as "status" from  teacher t < /select >(2)返回类型   < resultMap id="toolsModuleTypes" type="map" >   <span style="white-space:pre"></span><  id column="id" property="id" />   <span style="white-space:pre"></span>< result column="name" property="name"  />   <span style="white-space:pre"></span>< result column="status" property="status" />   <span style="white-space:pre"></span>< collection property="clss" column="id" ofType="java.util.HashMap"   <span style="white-space:pre"></span> select="com.data.dao.ClsMapper.selectClsByTId" javaType="ArrayList" > 注:collection标签,property属性名称,column参数字段, ofType查询返回类型,select查询方法,javaType方法的返回类型(3)返回类型中调用的查询方法< select id="selectClsById"  resultMap="cls" ><span style="white-space:pre"></span>select t.id as "clsid", t.name as "clsname", t.status as "clsstatus" from  clstab t < /select >

0 0
原创粉丝点击