TK mybatis SelectByPrimaryKey异常

今天在使用TK mybatis 插件时出现了一个奇怪的现象,当我调用selectByPrimaryKey(7)时,mybatis的sql日志打印为如下所示

===> Preparing SELECT id,a, b, c  FROM test WEHER id =? and a = ? and b = ? and c=?

===> Parameters: 7(Long),7(Long),7(Long),7(Long),7(Long)

 然后我百度查了相似问题,

发现是PO类里没有给主键添加注解导致的

添加完后的sql打印为:

===> Preparing SELECT id,a, b, c  FROM test WEHER id =?

===> Parameters: 7(Long)

相关推荐