后台从Mariadb中读取学生列表

后台从Mariadb中读取学生列表(表名:student,包含字段:id,name,age,address)

使用 https://baomidou.com/pages/24112f/#%E7%89%B9%E6%80%A7
建好对应的实体类的和xml文件,一行代码就可以实现查询

        List<Student> studentList = studentMapper.selectAll();
  • 这篇博客: mariadb数据库操作中的 #2.21、新增表,并将id设为主键非空,name为非空 部分也许能够解决你的问题, 你可以仔细阅读以下内容或跳转源博客中阅读:
  • primary key 设为主键,唯一且非空即该字段不能重复且不能为空

    auto_increment   给字段设为自增,只能给int类型字段设置,即新增数据时该字段如果为  null  则在新增的数据该字段为之前出现的最大数字加1,

    not null  设为非空即该字段不能为空

    create table teachar1(id int primary key auto_increment,name varchar(255) not null);