参考:https://blog.csdn.net/qq_33238935/article/details/82458325
在开发中,SQL的拼接很常见,有很对拼接的sql具有重复性高的特点,这时最好把重复的sql抽取出来,作为公用的sql片段。
eg:
<sql id="sql">duty_user_id, participant_id, description, creat_time, finish_time, other, other1, other2</sql>
<insert id="insertParticipant" keyProperty="ids" useGeneratedKeys="true" parameterType="cn.org.emcs.materialapi.social.vo.TTaskParticipantVO">
insert into materialbasecloud.t_task_participant(<include refid="sql"></include>)
values (#{dutyUserId}, #{participantId}, #{description}, #{creatTime}, #{finishTime}, #{other}, #{other1}, #{other2})
</insert>