请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

测试IOrderServiceTest时OrderMapper中的SQL语句报错

图片描述提示是insertSelective的错,我从OrderMapper.XML源码复制过来依然报错

报错信息:

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 ‘’ at line 1

The error may exist in file [E:\myProject\mall\target\classes\mapper\OrderMapper.xml]

The error may involve com.example.mall.dao.OrderMapper.insertSelective-Inline

The error occurred while setting parameters

SQL: insert into mall_order

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 ‘’ at line 1

; 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 ‘’ at line 1

我的OrderMapper.XML中的insertSelective代码:

insert into mall_order id, order_no, user_id, shipping_id, payment, payment_type, postage, status, payment_time, send_time, end_time, close_time, create_time, update_time, #{id,jdbcType=INTEGER}, #{orderNo,jdbcType=BIGINT}, #{userId,jdbcType=INTEGER}, #{shippingId,jdbcType=INTEGER}, #{payment,jdbcType=DECIMAL}, #{paymentType,jdbcType=INTEGER}, #{postage,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{paymentTime,jdbcType=TIMESTAMP}, #{sendTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP}, #{closeTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},

正在回答 回答被采纳积分+3

1回答

廖师兄 2020-03-04 01:20:51

OrderMapper.XML中的insertSelective代码不对啊,看课程源码

0 回复 有任何疑惑可以回复我~
  • 提问者 Kurama丶 #1
    我在另一个提问里重新贴了一下我的代码
    
    https://coding.imooc.com/learn/questiondetail/171450.html
    回复 有任何疑惑可以回复我~ 2020-03-04 01:52:18
  • 提问者 Kurama丶 #2
    已解决,buildOrder方法的返回值写错了
    回复 有任何疑惑可以回复我~ 2020-03-04 20:00:48
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信