前段时间因为需求变更,使用Mybatis写SQL的时候需要自定义ResultMap,在使用的过程中也遇到了很多奇怪的问题,搞不懂是什么原因,各路大神有知道的还请指导指导
在同一个映射文件里,我的第一个ResultMap对应的是一个DAO,是这么写的:
<resultMap id="BaseResultMap" type="com.tracy.gd.domain.Expense" >
<id column="e_id" property="eId" jdbcType="INTEGER" />
<result column="e_la_id" property="eLaId" jdbcType="INTEGER" />
<result column="e_la_cpt_id" property="eLaCptId" jdbcType="INTEGER" />
<result column="e_la_user_id" property="eLaUserId" jdbcType="INTEGER" />
<result column="e_lend_time" property="eLendTime" jdbcType="TIMESTAMP" />
<result column="e_sreturn_time" property="eSreturnTime" jdbcType="TIMESTAMP" />
<result column="e_areturn_time" property="eAreturnTime" jdbcType="TIMESTAMP" />
<result column="e_is_returned" property="eIsReturned" jdbcType="VARCHAR" />
<result column="e_days" property="eDays" jdbcType="INTEGER" />
<result column="e_expense" property="eExpense" jdbcType="DECIMAL" />
<result column="attribute1" property="attribute1" jdbcType="VARCHAR" />
<result column="attribute2" property="attribute2" jdbcType="VARCHAR" />
<result column="attribute3" property="attribute3" jdbcType="VARCHAR" />
</resultMap>