mybatis的resultmap用法

mybatis的resultmap用法是怎样的,能举例吗

醉清风tomorrow
浏览 1772回答 1
1回答

简单丶注定

resultmap 是用来映射结果集的, resultTyle不同。<resultMap type="entity.Message" id="MessageResult">  <id column="id_" jdbcType="INTEGER" property="id" />  <result column="command" jdbcType="VARCHAR" property="command" />  <result column="description" jdbcType="VARCHAR" property="description" />  <result column="content" jdbcType="VARCHAR" property="content" /> </resultMap>     <!-- 指定输入参数时只能传递 一个 -->     <!-- #{command} 取得 message 的属性 -->     <!-- where标签 if条件成立时才会连接 --> <select id="queryMessage" parameterType="entity.Message" resultMap="MessageResult">  select id id_ ,command,description,content from message  <where>   <if test="command != null and !&quot;&quot;.equals(command.trim())">    and COMMAND =#{command}   </if>   <if    test="description != null and !&quot;&quot;.equals(description.trim())">    and DESCRIPTION like '%' #{description} '%'   </if>  </where> </select>
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java