数据库_sql_refid

refid

refid是对某处定义的一个引用
见于:

<sql id="Base_Column_List">
id,
name,
sex,
age
</sql>
<select id="selectAllByName" parameterType="java.lang.String">
select 
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List"/>
from student
where
name = #{name}
</select>

需要先定义一个sql,设置好id(Base_Column_List),添加好字段(id,name,sex,age)
在sql语句的include标签中直接引用sql的id即可。

猜你喜欢

转载自blog.csdn.net/weixin_40197494/article/details/80611472