网站首页 > 技术文章 正文
1.首先dao层mapper.java需要继承原来的接口
原dao层接口
public interface TagMapper { /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_tag * * @mbg.generated */ long countByExample(TagExample example); /** * This method was generated by MyBatis Generator. * This method corresponds to the database table t_tag * * @mbg.generated */ int deleteByExample(TagExample example); }
如果想学习Java工程化、高性能及分布式、深入浅出。微服务、Spring,MyBatis,Netty源码分析的朋友可以加我的Java高级交流:854630135,群里有阿里大牛直播讲解技术,以及Java大型互联网技术的视频免费分享给大家。
扩展后的dao层接口
public interface TagExtendMapper extends TagMapper { ... }
2.继承原始mapper.xml的结果映射
原始mapper.xml的结果映射
<mapper namespace="com.xxx.dao.mapper.TagMapper"> <resultMap id="BaseResultMap" type="com.xxx.dao.Tag"> <!-- WARNING - @mbg.generated This element is automatically generated by MyBatis Generator, do not modify. --> <id column="id" jdbcType="CHAR" property="id" /> <result column="tag_name" jdbcType="VARCHAR" property="tagName" /> <result column="tag_alias" jdbcType="VARCHAR" property="tagAlias" /> </resultMap> </mapper>
扩展mapper.xml的结果映射
<mapper namespace="com.xxx.dao.TagExtendMapper"> <select id="xxxxx" resultMap="com.xxx.dao.mapper.TagMapper.BaseResultMap"> <!-- 这里时原始命名空间加上结果集id --> </select> </mapper>
或者是
如果想学习Java工程化、高性能及分布式、深入浅出。微服务、Spring,MyBatis,Netty源码分析的朋友可以加我的Java高级交流:854630135,群里有阿里大牛直播讲解技术,以及Java大型互联网技术的视频免费分享给大家。
<mapper namespace="com.xxx.dao.TagExtendMapper"> <resultMap id="ExtBaseResultMap" type="com.xxx.dao.Tag" extend="com.xxx.dao.mapper.TagMapper.BaseResultMap"> ... </resultMap> </mapper>
猜你喜欢
- 2024-09-29 MybatisPlus—kotlin代码生成 mybatisplus 代码生成器
- 2024-09-29 Spring boot Mybatis 整合 springboot整合mybatis流程
- 2024-09-29 SpringBoot使用Mybatis-FreeMarker
- 2024-09-29 MyBatis自动生成Mapper插件 mybatis 生成mapper
- 2024-09-29 增强Mybatis常用方案 mybatis-plus扩展
- 2024-09-29 网易架构师吐血整理:2分钟看完Mybatis核心知识点
- 2024-09-29 Mybatis 自动生成bean mybatis 自动生成bo
- 2024-09-29 深入理解Python生成器(Generators)
- 2024-09-29 如何避免出现 SQL 注入漏洞 怎样避免sql注入
- 2024-09-29 代码生成插件支持eclipse,IntelliJ Idea
你 发表评论:
欢迎- 最近发表
- 标签列表
-
- oraclesql优化 (66)
- 类的加载机制 (75)
- feignclient (62)
- 一致性hash算法 (71)
- dockfile (66)
- 锁机制 (57)
- javaresponse (60)
- 查看hive版本 (59)
- phpworkerman (57)
- spark算子 (58)
- vue双向绑定的原理 (68)
- springbootget请求 (58)
- docker网络三种模式 (67)
- spring控制反转 (71)
- data:image/jpeg (69)
- base64 (69)
- java分页 (64)
- kibanadocker (60)
- qabstracttablemodel (62)
- java生成pdf文件 (69)
- deletelater (62)
- com.aspose.words (58)
- android.mk (62)
- qopengl (73)
- epoch_millis (61)
本文暂时没有评论,来添加一个吧(●'◡'●)