前端报错:
Cause: java.sql.SQLIntegrityConstraintViolationException: Column ‘order_status’ cannot be null
; Column ‘order_status’ cannot be null; nested exception is java.sql.SQLIntegrityConstraintViolationException: Column ‘order_status’ cannot be null
按F12打开开发者模式,点开 ‘网络’
分析之后,仔细检查Mybatis的mapper文件中的SQL语句,发现
箭头标志一开始使用占位符#{order_status},但是注入对象的时候并没有给这个对象属性order_status赋值,所以报错为NULL。原因在于笔者设置插入数据时并不需要初始化order_status,触发器会根据其他字段来修改它。
总而言之就是,使用#{}占位符不能为空。