今天写登录接口的时候遇到了一些问题,控制台不报错打印以下信息,但是用apifox调用接口的时候就403,
JDBC Connection [HikariProxyConnection@967625212 wrapping com.mysql.cj.jdbc.ConnectionImpl@3054f1b2] will not be managed by Spring
==> Preparing: SELECT id,user_name,nick_name,password,type,status,email,phonenumber,sex,avatar,create_by,create_time,update_by,update_time,del_flag FROM user WHERE del_flag=0 AND (user_name = ?)
==> Parameters: xcc(String)
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@6481e5c7]
然后我挨个文件检查了一遍感觉还是没有问题,然后检查表的字段,我还在想能不能是字母大小写或者是写错了呢,显然也不是。
最终,我想起来,用easycode生成代码的时候我把表名前缀去掉了,我数据库里面写的是sys_user,但是查询FROM user,看到这我也真是服了,我感觉我就是个智者(shabi)。
找到问题,我们就可以把数据库表名前缀去掉,或者在entity类中加个注解把表名前缀加上。
有的时候遇到bug就一心像解决它,而不分析它,导致盲目的去找bug,效率特低。