标签:blog property password 测试 img 解决 lazy com pre
数据库中的字段:
新建一个项目,拷贝之前的,测试实体类字段不一致的情况
public class User {
private int id;
private String name;
private String password;
}
测试出现问题
解决方案:
+起别名
结果集映射
id name pwd
id name password
<resultMap id="UserMap" type="user2">
<result column="pwd" property="password"/>
<result column="id" property="id"/>
<result column="name" property="name"/>
</resultMap>
<select id="getUserById" resultMap="UserMap" parameterType="int">
select * from mybatis.user where id = #{id};
</select>
标签:blog property password 测试 img 解决 lazy com pre
原文地址:https://www.cnblogs.com/UltraBlast/p/14469450.html