本篇文章给大家分享的是有关mybatis使用经验是怎样的,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。
创新互联建站凭借专业的设计团队扎实的技术支持、优质高效的服务意识和丰厚的资源优势,提供专业的网站策划、成都网站制作、成都网站设计、网站优化、软件开发、网站改版等服务,在成都10多年的网站建设设计经验,为成都上千多家中小型企业策划设计了网站。
@Param的使用
Java代码中指定@Param("model"),mapper.xml配置中也需要
List queryByPage(@Param("model") ProductQueryReq queryModel);
mapper.xml中不写则启动报错:

BoundSql.getParameterObject(): 
只有一个参数可以不指定@Param, 且mapper.xml中可直接用对象属性
List queryByPage(ProductQueryReq queryModel);

如果mapper.xml用了别名报错:

有多个相同类型参数也需要定义@Param
UserImageTransfer selectFirstHistoryOrcInfo(String productCode, String userId);


collection的用法
collection 下 主表 和附表 都需要查出主键;即使标签写了其他字段也没用,一定是数据库表真实的主键.
以上就是mybatis使用经验是怎样的,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注创新互联行业资讯频道。
当前文章:mybatis使用经验是怎样的
分享地址:
http://mswzjz.cn/article/jdgioh.html