当前使用版本(必填,否则不予处理)
com.baomidou
mybatis-plus-boot-starter
3.3.2
com.baomidou
mybatis-plus-generator
3.3.2
org.apache.velocity
velocity-engine-core
2.2
该问题是如何引起的?(确定最新版也有问题再提!!!)
Controller层调用Service层默认的方法,报错。
MySQL大小写敏感,然后在表在MySQL中使用的是大写,但是内置的查询的时候使用的是小写,导致查询失败
重现步骤(如果有就写完整)
MySQL语句:
drop table if exists Admin;
create table if not exists Admin
(
adminId int(11) primary key auto_increment comment '主键',
username varchar(255) not null comment '用户名',
password varchar(255) not null comment '密码',
authorities varchar(255) default null comment '权限,多个权限使用分号分割',
adminEmail varchar(255) unique not null comment '邮箱',
headImage varchar(255) default null comment '头像',
nickName varchar(255) not null default '昵称' comment '昵称',
accountState varchar(255) default 'AUDITING' comment '账户状态(审核)',
gmtCreated datetime default null,
gmtModified datetime default null,
unique key `index_username` (`username`) comment '唯一索引-username'
) ENGINE = InnoDB
AUTO_INCREMENT = 1
DEFAULT CHARSET = utf8 COMMENT ='管理员表';
Service是自动生成的,完全没有改变
Controller层:
@RestController
@RequestMapping("/admin")
public class AdminController {
@Autowired
private AdminServiceImpl iAdminService;
@RequestMapping("")
public Object aaa() {
return iAdminService.list();
}
}
调用这个接口就出错
报错信息
Error querying database. Cause: java.sql.SQLSyntaxErrorException: Table 'volunteer.activity' doesn't exist
The error may exist in com/itxiuyixiu/mapper/ActivityMapper.java (best guess)
The error may involve defaultParameterMap
The error occurred while setting parameters
SQL: SELECT activityId,activity_name,activity_detail,start_time,end_time,max_number,now_number,attention,activity_type,activity_address,out_time,serve_hours,activity_state,academy_limited,academy_limited_list,activity_images,gmt_created,gmt_modified,fk_organization_id,fk_project_id,fk_admin_id FROM activity
Cause: java.sql.SQLSyntaxErrorException: Table 'volunteer.activity' doesn't exist
; bad SQL grammar []; nested exception is java.sql.SQLSyntaxErrorException: Table 'volunteer.activity' doesn't exist] with root cause