MyBatis批量更新错误

kinglongchen 发布于 2015/06/10 17:48
阅读 516
收藏 0
### The error may involve com.tqmall.shop.mapper.autoparts.AppointMapper.batchUpdateById-Inline
### The error occurred while setting parameters
### SQL: update db_appoint    set id =case id when 8 then 8                        when 9 then 9                        when 10 then 10 end,        goods_supplier_id =case id when 8 then 301                        when 9 then 401                        when 10 then 101 end,                        appoint_man =case id when 8 then 302                        when 9 then 402                        when 10 then 102 end,    appoint_status =case id when 8 then 303                        when 9 then 403 end    where   id IN    (      8    ,     9    ,     10    )

### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Column 'appoint_status' cannot be null

这是个什么鬼错误?直接执行sql语句没问题,我贴一下美化的sql语句:

UPDATE db_appoint
SET id = CASE id
WHEN 8 THEN
8
WHEN 9 THEN
9
WHEN 10 THEN
10
END,
 goods_supplier_id = CASE id
WHEN 8 THEN
301
WHEN 9 THEN
401
WHEN 10 THEN
101
END,
 appoint_man = CASE id
WHEN 8 THEN
302
WHEN 9 THEN
402
WHEN 10 THEN
102
END,
 appoint_status = CASE id
WHEN 8 THEN
303
WHEN 9 THEN
403
END
WHERE
id IN (8, 9, 10)

加载中
返回顶部
顶部