写了一个简单的插入语句,但是一直报错:
### Error updating database. Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')values( 'hello' at line 11 ### The error may exist in file [D:\mes-master\mes-master\ruoyi-system\target\classes\mapper\system\pnMapperRuKu.xml] ### The error may involve com.ruoyi.system.mapper.pnMapperRuKu.insertPnAssertRukuDetails-Inline ### The error occurred while setting parameters ### SQL: insert into pnAssertRukuDetails ( storageRoom, )values( ?, ) ### Cause: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')values( 'hello' at line 11 ; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')values( 'hello' at line 11
调用方法:
@Override
public int insertPnCode(PnModelInOutInventory pnModelInOutInventory) {
// pnMapperRuKu.insertPnAssertRuku(pnModelInOutInventory);
return pnMapperRuKu.insertPnAssertRukuDetails(pnModelInOutInventory);
}
mapper.xml----
<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>
我对比了Mapper.xml中的语法,包括调整英文符号,调整英文的括号;都没有作用;
有么有大佬帮忙看下,问题出在哪里??
问题点在于: 类似如下示例SQL
name后面的 -->
,
<--