Introduced: before writing a type in the mapping file [mapper file = sql mapping file], you must write the fully qualified name-after configuring the alias, the type can be abbreviated
- How to configure: configure
in the main configuration file of mybatis
<!-- 配置别名 -->
<typeAliases>
<!-- 这个包下面的类都可以写简写:要么直接写类名 ,要么写类名的首字母小写 -->
<package name="cn.itsource.domain"/>
</typeAliases>
- Use an alias directly in the mapper mapping file
//没有使用别名
<select id="get" parameterType="long" resultType="it.show.domain.Product">
select * from product where id = #{id}
</select>
//使用别名
<select id="get" parameterType="long" resultType="product">
select * from product where id = #{id}
</select>