解释:
include
是引用SQL代码。
refid
是引用的sql的id名称,一定要唯一。
作用:
有共同的SQL片段,为了不重复写。
方便后期维护。
把字段都写出来,不用*代替,也是为了提高效率。
代码:
<sql id="Student_Column_List" >
studentID, studentName,studentAge,studentEmail,studentComment
</sql>
<select id="selectByPrimaryKey" resultMap="com.rr.dto.StudentDto" parameterType="java.lang.Long" >
select
<include refid="Student_Column_List" />
from t_student
where studentID = #{studentID,jdbcType=BIGINT}
</select>