猿问
回到首页
个人中心
反馈问题
注册登录
下载APP
首页
课程
实战
体系课
手记
专栏
慕课教程
mybatis的resultmap用法
mybatis的resultmap用法是怎样的,能举例吗
醉清风tomorrow
浏览 1827
回答 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 !"".equals(command.trim())"> and COMMAND =#{command} </if> <if test="description != null and !"".equals(description.trim())"> and DESCRIPTION like '%' #{description} '%' </if> </where> </select>
0
0
0
打开App,查看更多内容
随时随地看视频
慕课网APP
相关分类
Java
继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续