1. mybatis的mapper.xml出现tag name expected错误
https://blog.csdn.net/watson2017/article/details/128902300
'<'符号在xml配置SQL 语句中是不能直接识别出来的,也就是说,我们在使用到 > 、< 等符号的时候,需要将其进行转义,参考如下表:
<select id="selectWeekOrderCount" parameterType="java.lang.Integer" resultMap="OrderCount">
SELECT date_format(update_time,'%Y-%m-%d') as dateTime ,count(*) as number
FROM table1
<where>
user_id = #{userId}
DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= DATE(create_time)
</where>
GROUP BY dateTime
</select>
2. 在IDEA中打开一个sql文件或一个mybatis的mapper.xml, 提示"no data source are configured to run this SQL and provide advanced code assistace.
IDEA 配置datasource,提升编码效率,让你在 Mapper.xml 中编写sql可以飞起来~
配置一个msyql的数据库连接:
在sql文件或xml'中输入sql语句的时候进行智能提醒
并且可以在一个database控制终端写sql查询数据库
3. IDEA,mybatis的mapper.xml提示unable to resolve table ‘表名’ 或' 字段名‘
alt + enter , 出现 sql resolution scopes, 选择使用的数据库
或者选择使用的数据库
4. mybatis的mapper.xml提示unable to resovle table 'LIMIT'
不要使用<where> </where>标签,替换为WHERE关键字
<select id="queryShopList" resultMap="shopMap">
SELECT * FROM tb_shop s
<where>
<if test="shopCondition.area != null">
AND s.area_id = #{shopCondition.area.areaId}
</if>
</where>
ORDER BY priority DESC LIMIT 0, 5
</select>
<select id="XXX" resultMap="XXX">
SELECT * FROM tb_shop s
WHERE
<if test="xxx.price != null">
xxxxxx
</if>
ORDER BY price DESC LIMIT 10, 5;
</select>
5. http://mybatis.org/dtd/muri is not registered
https://www.likecs.com/show-203460248.html
alt + enter解决或
settings - languages & frameworks - > schemes and DTDs, 导入文件
6. sql方言配置,校验sql规范
6. com.alibaba.druid.pool.DruidDataSource Cannot resolve
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource 一直报红
查看依赖包下载是否成功
或者
https://github.com/alibaba/druid/tree/master/druid-spring-boot-starter
修改版本号
或者本地导入
Central Repository: com/alibaba/druid
jdbc连接问题——com.alibaba.druid.pool.DruidDataSource error__姓名的博客-CSDN博客