得这样子做,首先用java定义一个数据库对应 的javabean
然后,mapper文件 中定义和数据库关系的对应。如
<resultMap id="BaseResultMap" type="com.lin.domain.User">
<!--
WARNING - @mbggenerated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="USER_ID" jdbcType="INTEGER" property="userId" />
<result column="USER_NAME" jdbcType="CHAR" property="userName" />
<result column="USER_PASSWORD" jdbcType="CHAR" property="userPassword" />
<result column="USER_EMAIL" jdbcType="CHAR" property="userEmail" />
</resultMap>
然后返回使用
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
。。。。