如图,所示,id判断是不是null的时候,竟然认为id=null,结果sql语句就变成
INSERT INTO core_tzt_product ( product_name, product_type, product_price, crasr_code, period_days, buy_type, start_date, end_date ) values ( ?, ?, ?, ?, ?, ?, ?, ? ) ,
但是如果我把id判断是不是null的if去掉,则可以新增成功。代码如下
,有点搞不清楚,这是mybatis的bug吗,还是我哪里有弄错
SelectKey needs to pay attention to the order attribute. In databases like MySQL that support automatic growth, order needs to be set to after to get the correct value.