目录 1、Vo类 1、MyBatis中表之间的关系是如何映射的处理的? resultType:使用多表查询我们经常会resultType="java.utils.Map" ,我们不推荐这样写,但是这样写对自己比较有利。 好处:resultType 是直接将查询结果映射到 Java 对象,可以使用简单的类型(如 int、String)或复杂的自定义类型。它的好处是简单直观,易于使用。 弊端:对于复杂的关系映射,resultType 可能会变得冗长,并且无法处理一对多或多对多的关系映射。 resultMap:resultMap 允许我们定义复杂的映射规则,将结果集中的多个字段映射到一个对象中。 好处:可以处理复杂的关系映射,支持一对多或多对多的关系映射。我们可以在 resultMap 中定义映射规则,指定字段与属性间的映射关系,并通过嵌套 resultMap 处理表之间的关系。 弊端:相对于 resultType,resultMap 的配置较为繁琐。 1、配置generatorConfig.xml 在我们的配置文件里面配置我们需要的几个表,自动生成所需文件 <table...
Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Get in touch with import
Contact import, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack