mybatis mapper.xml 配置文件多表级联查询返回值映射问题

<resultMap id="BaseResultMap2" type="LossesAre">

<id column="lossesare_id" property="id" jdbcType="INTEGER" />

<result column="lossesare_roomconfigid" property="roomconfigid" jdbcType="INTEGER" />

<result column="lossesare_shouldpay" property="shouldpay" jdbcType="DOUBLE" />

<result column="lossesare_pay" property="pay" jdbcType="DOUBLE" />

<result column="lossesare_paystatus" property="paystatus" jdbcType="INTEGER" />

<result column="lossesare_createdby" property="createdby" jdbcType="INTEGER" />

<result column="lossesare_createdtime" property="createdtime" jdbcType="TIMESTAMP" />

<result column="lossesare_createdby" property="createdby" jdbcType="INTEGER" />

<association property="supplier"  javaType="Supplier" resultMap="com.mogo.mapper.SupplierMapper.BaseResultMap1"  columnPrefix="supplier_" /> 

               1

<association property="flats"  javaType="Flats">

<id column="flats_id" property="id" jdbcType="INTEGER" />

<result column="flats_flatsnum" property="flatsnum" jdbcType="VARCHAR" />

<result column="flats_floornum" property="floornum" jdbcType="INTEGER" />

<association property="community" javaType="Community" resultMap="com.mogo.mapper.CommunityMapper.BaseResultMap" columnPrefix="community_" />

<association property="building" javaType="Building" resultMap="com.mogo.mapper.BuildingMapper.BaseResultMap" columnPrefix="building_" />

</association>

<association property="room"  javaType="Room" resultMap="com.mogo.mapper.RoomMapper.BaseResultMapRoom"  columnPrefix="room_"/>

<association property="product" javaType="Product" resultMap="com.mogo.mapper.ProductMapper.BaseResultMap1"  columnPrefix="product_"/>

<association property="purchaseAmtShould" javaType="PurchaseAmtShould">

<id column="pash_id" property="id" jdbcType="INTEGER"/>

<association property="purchaseOrder" javaType="PurchaseOrder"  >

<id column="purchaseorder_id" property="id" jdbcType="INTEGER" />

<result column="purchaseorder_ordercode" property="ordercode" jdbcType="VARCHAR" />

<association property="creator" javaType="Employee" resultMap="com.mogo.mapper.EmployeeMapper.BaseResultMapBase" columnPrefix="purchasecreated_" />

</association>

 

</association>

2

</resultMap> 

 

针对1,如果没有在<association> 内部自定义元素,则需要注明 resultMap的值,相反的,如果针对2,在<association>内部又自定义了返回值列字段,就无需在注明resultMap,不然的话,Mybatis返回值会对应不上这个对象,特此记录!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值