@
gejun123456 mybtis 版本 3.4.6
java:
AdPlanRtReport adPlanRtReport = new AdPlanRtReport();
adPlanRtReport.setUserId(0L);
adPlanRtReport.setPlanId(0L);
adPlanRtReport.setPlanName("212$");
adPlanRtReportMapper.insertSelective(adPlanRtReport);
...省略
xml:
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="xxx.AdPlanRtReport" useGeneratedKeys="true">
<!--@mbg.generated-->
insert into ad_plan_rt_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="userId != null">
user_id,
</if>
<if test="planId != null">
plan_id,
</if>
<if test="planName != null">
plan_name,
</if>
...省略
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="userId != null">
#{userId,jdbcType=BIGINT},
</if>
<if test="planId != null">
#{planId,jdbcType=BIGINT},
</if>
<if test="planName != null">
#{planName,jdbcType=VARCHAR},
</if>
...省略
</trim>
</insert>
报错信息:
Error updating database. Cause: java.lang.IllegalArgumentException: Illegal group reference
### The error may involve xxx.mapper.AdPlanRtReportMapper.insertSelective-Inline
### The error occurred while setting parameters
### SQL: insert into ad_plan_rt_report ( user_id, plan_id, plan_name, cpm, roi, impression, click, ctr, spend, cpc, order_num, gmv, scene_type, ad_unit_num, mall_fav_num, max_cost, account_status, `status`, operate_status, is_deleted, report_date, report_time ) values ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )
### Cause: java.lang.IllegalArgumentException: Illegal group reference
at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:77)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:446)
at com.sun.proxy.$Proxy35.insert(Unknown Source)
at org.mybatis.spring.SqlSessionTemplate.insert(SqlSessionTemplate.java:278)
at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:58)
at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:59)
at com.sun.proxy.$Proxy58.insertSelective(Unknown Source)