首页 > 数据库技术 > 详细

Mybatis <Sql>标签

时间:2016-06-11 11:41:31      阅读:175      评论:0      收藏:0      [点我收藏+]

重复的SQL预计永远不可避免,<sql>标签就是用来解决这个问题的

<sql id="sql1">id,name,age,gender</sql>

<select id="getPerson" parameterType="int" resultType="orm.Person">
    select 
    <include refid="sql1"></include>
     from Person where id=#{id}
</select>

 

<sql>:定义重复代码

.id:sql代码块的名称

<include>:引用sql代码

refid:需要应用sql代码块的id

Mybatis <Sql>标签

原文:http://www.cnblogs.com/caoyc/p/5574853.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!