resultMap result set mapping id name pwd field of the database id name password entity class XML <-! result set mapping -> <resultMap ID = " userMap " type = " the User " > <-! column fields in a database, property entity class attributes -> <Result column = " ID " property = " ID " /> <Result column = " name " property = " name " /> the above two paragraphs can not write only inconsistent database entity classes and field can be a <= Result column "pwd" property="password"/> </resultMap> <select id="getUserById" resultMap="UserMap" parameterType="int"> /*定义sql*/ select * from mybatis.user where id = #{id}; </select>