原因:在写Mapper.xml的时候要注意SQL语句的表示符号。如下:
<insert id="insertCustomer" parameterType="BdCustomer">
insert into bd_customer(
<if test="customerId != null and customerId != ''">customer_id,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
<if test="customerCode != null and customerCode != ''">customer_code</if>
)value(
<if test="customerId != null and customerId != ''">
<if test="customerName != null and customerName != ''">
<if test="customerCode != null and customerCode != ''">
)
</insert>
注意:一定要记得去掉每个括号里面最后一个字段的逗号“,” customer_code后面去掉,