MyBatis 3 提示 Column ‘******‘ specified twice
虾米姐
阅读:828
2021-03-31 12:22:45
评论:0
造成错误的原因是*Mapper.xml 配置文件,insert 语句写入重复字段
错误配置文件展示:
<insert id="insertSelective" parameterType="com.***.domain.SysSetting">
insert into sys_setting
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="sid != null">
sid,
</if>
<if test="sid != null">
sid,
</if>
<if test="settingType != null">
setting_type,
</if>
<if test="settingContent != null">
setting_content,
</if>
<if test="settingFileSid != null">
setting_file_sid,
</if>
<if test="settingNo != null">
setting_no,
</if>
<if test="createDt != null">
create_dt,
</if>
<if test="createBy != null">
create_by,
</if>
<if test="updateBy != null">
update_by,
</if>
<if test="dataType != null">
data_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="sid != null">
#{sid,jdbcType=VARCHAR},
</if>
<if test="settingType != null">
#{settingType,jdbcType=VARCHAR},
</if>
<if test="settingContent != null">
#{settingContent,jdbcType=VARCHAR},
</if>
<if test="settingFileSid != null">
#{settingFileSid,jdbcType=VARCHAR},
</if>
<if test="settingNo != null">
#{settingNo,jdbcType=VARCHAR},
</if>
<if test="createDt != null">
#{createDt,jdbcType=TIMESTAMP},
</if>
<if test="createBy != null">
#{createBy,jdbcType=VARCHAR},
</if>
<if test="updateDt != null">
#{updateDt,jdbcType=TIMESTAMP},
</if>
<if test="updateBy != null">
#{updateBy,jdbcType=VARCHAR},
</if>
<if test="dataType != null">
#{dataType,jdbcType=VARCHAR},
</if>
</trim>
</insert>
这份动态xml 配置文件包含两个sid 是导致: Column ‘sid‘ specified twice 错误原因
声明
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。