mysql中一张表有20个字段,第一次提交其中10个字段,第二次提交其中8个字段怎么写成一条sql语句 谢谢 各大神帮帮忙
拼接sql语句呗,
如果根据值传递,那么判断一下当前字段有值没有,有就拼接进去,没有就省略。
如果规定第一次一定要某10个字段,第二次某8个字段,就判断插入次数
<insert id="insertUser_videoeffect" parameterType="videoeffect">
insert into videoeffect
(videoeffect_type,videoeffect_filepath,
displayframe,disappearframe,display_x,display_y,
content,color,font_plain,font_bold,font_italic,wordSpacing,paragraphwidth,lineSpacing,
movestartframe,moveendframe,movestart_x,movestart_y,moveend_x,moveend_y,videoeffect_width,videoeffect_height)
values
<foreach collection="list" item="item" index="index" open="("
close=")" separator=",">
(#{videoeffect_type},#{videoeffect_filepath},
#{displayframe},#{disappearframe},#{display_x},#{display_y},
#{content},#{color},#{font_plain},#{font_bold},#{font_italic},#{wordSpacing},#{paragraphwidth},
#{lineSpacing},#{movestartframe},#{moveendframe},#{movestart_x},
#{movestart_y},#{moveend_x},#{moveend_y},#{videoeffect_width},#{videoeffect_height})
</foreach>
</insert>