Mybatis第三节优化别名--->user

在User Mapper.xml文件下

1  <select id="getUserById" resultType="com.xian.pojo.User">
2     select * from testdb.test001 where id=#{id}
3     </select>

com.xian.pojo.User--->太长了,应该用别名优化

所以在mybatis-config.xml文件下起别名

<typeAliases>
        <typeAlias type="com.xian.pojo.User" alias="user"/>
    </typeAliases>

优化后

<select id="getUserList" resultType="user">
    select * from testdb.test001
  </select>
原文地址:https://www.cnblogs.com/springxian/p/13235023.html