用idea时。mapper.xml文件出现警告
No data sources are configured to run this SQL and provide advanced code assistance. Disable this inspection via problem menu (Alt+Enter). more… (Ctrl+F1)
SQL dialect is not configured. PostgreSQL, SQL Server match best. more… (Ctrl+F1)
这是两个警告,首先我们解决一个警告
1.使用idea连接数据库
如果找不到右侧的工具栏,请点击File–>setting–>appearance
。
2
连接了数据库之后,mapper文件的背景色变成了浅绿色,并且编写sql的时候会有代码提示和错误提示,非常方便
2.解决另一个警告
File -> setting 搜索inspections,再搜索sql,找到SQL dialect detection去掉勾,然后apply ->ok
大功告成