解决属性名和字段名不一致
将用户pwd属性改名为password,导致取出的password为null
解决方法
①起别名
<select id="getUserById" resultType="com.lms.pojo.User" parameterType="int">
select id,name,pwd as password from user where id = #{id};
</select>
resultMap
结果集映射
<resultMap id="UserMap" type="User">
<result column="pwd" property="password"/>
</resultMap>
<select id="getUserById" resultMap="UserMap">
select * from user where id = #{id};
</select>
返回值resultMap对应上面自己定义的id名
结果集定义中:column对应数据库列名,property对应类成员名