mybatis的resultMap配置详解

1、mybatis的实体类继承

参考资料:
1、mybatis中实体类,po类继承另一个po类的情况
2、mybatis中resultMap配置细则

实体类的继承的作用是:可以通过继承减少代码在实体类中的重复使用,比如数据库的表中常常出现的字段所对应的实体类中的属性。

2、mybatis的resultMap标签中的属性extends,可以继承另外一个命名空间的resultMap标签。

<mapper namespace="xuecheng.dao.ACVSFundTest">

    <resultMap id="res" extends="xuecheng.dao.BaseEntityTest.baseCol" type="xuecheng.domain.ACVSFund">
        <!--<id column="id" property="id"/>-->
        <result column="fund_code" property="fundCode"/>
        <result column="fund_name" property="fundName"/>
        <result column="gmt_Create" property="gmtCreate"/>

    </resultMap>

继承另一个

<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="xuecheng.dao.BaseEntityTest">
    <resultMap id="baseCol" type="xuecheng.domain.BaseEntity">
        <id column="id" property="id"/>
        <result column="username" property="username"/>
        <result column="age" property="age"/>
    </resultMap>

一、mybatis的属性标签

<resultMap>
        <constructor>
            <idArg/>
            
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值