sql语句有重复出现的块,可以提取出来,定义成sql片段,其它sql语句引用即可
<sql id="baseColumn">
empno,ename,hiredate,sal
</sql>
<select id="queryEmp" parameterType="Integer" resultType="Emp">
select <include refid="baseColumn"></include> from emp where empno=#{empno}
</select>