问题描述
提示:最近新建了一个项目,
执行sql出现Invalid bound statement问题
原因分析
查找:在sql编辑器中执行sql也没有问题,但是代码执行到该sql处却没有打印???
思考:很神奇,如果sql有问题应该项目执行会报sql到相关异常,即使是空也应该有执行啊,但是从结果来看,就压根没执行这个sql
分析:后仔细分析了Invalid bound statement这个错误,原来是sql中生成的mapper中的.xml文件目录配置没有成功.
解决方案
既然.xml文件目录配置没有成功,重新配置,正确在yml中配置如下,切记切记:
mybatis-plus:
configuration:
cacheEnabled: false
mapUnderscoreToCamelCase: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
column-underline: true
field-strategy: not_empty
id-type: id_worker
logic-delete-value: true
refresh: false
mapper-locations: classpath:mapper/*.xml
typeAliasesPackage: com.xxx.entity(填写自己项目db实体的目录)