当前位置: 首页 > 图灵资讯 > 技术篇> SQL语法错误:PnMapperRuKu.xml文件中insert语句的逗号问题怎么解决?

SQL语法错误:PnMapperRuKu.xml文件中insert语句的逗号问题怎么解决?

来源:图灵教育
时间:2024-12-02 19:50:58

sql语法错误:pnmapperruku.xml文件中insert语句的逗号问题怎么解决?

sqlexception:语法错误

错误原因:

代码块中出现的类似“name后的 ,”实际应为“name后应缺失 ,”。

具体问题:

pnmapperruku.xml文件中的insertpnassertrukudetails方法中,insert语句中storageroom列后跟着一个多余的逗号。

正确语句:

<insert id="insertPnAssertRukuDetails" parameterType="com.ruoyi.system.domain.PnModelInOutInventory">
        insert into pnAssertRukuDetails (
     <if test="parentPnAssertRukuId != null and parentPnAssertRukuId != '' ">parent_pnAssertRuku_id,</if>
     <if test="materialInformation != null and materialInformation != '' ">materialInformation,</if>
     <if test="numbersRuKu != null and numbersRuKu != '' ">numbersRuKu,</if>
     <if test="qualified != null and qualified != '' ">qualified,</if>
     <if test="unit != null and unit != '' ">unit,</if>
     <if test="storageRoom != null and storageRoom != ''">storageRoom</if>
     <if test="sn != null and sn != ''">sn,</if>
     <if test="remark != null and remark != ''">remark,</if>
     <if test="batchNumber != null and batchNumber != ''">batchNumber,</if>
    )values(
     <if test="parentPnAssertRukuId != null and parentPnAssertRukuId != '' ">#{parentPnAssertRukuId},</if>
     <if test="materialInformation != null and materialInformation != '' ">#{materialInformation},</if>
     <if test="numbersRuKu != null and numbersRuKu != '' ">#{numbersRuKu},</if>
     <if test="qualified != null and qualified != '' ">#{qualified},</if>
     <if test="unit != null and unit != '' ">#{unit},</if>
     <if test="storageRoom != null and storageRoom != ''">#{storageRoom},</if>
     <if test="sn != null and sn != ''">#{sn},</if>
     <if test="remark != null and remark != ''">#{remark},</if>
     <if test="batchNumber != null and batchNumber != ''">#{batchNumber},</if>
    )
</insert>

以上就是SQL语法错误:PnMapperRuKu.xml文件中insert语句的逗号问题怎么解决?的详细内容,更多请关注图灵教育其它相关文章!