使用Navicat创建MySQL表
userinfo表(包括id,address,date,name,tag, id为主键且自动递增):
Springboot编写接口
编写 UserInfo 实体类(entity):
package com.example.demo.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.sql.Date;
@TableName("userinfo")
@Data
public class UserInfo {
@TableId(type= IdType.AUTO)
private Integer id;
private String address;
private Date date;
private String name;
private String tag;
}
编写 UserInfoMapper (mapper):
package com.example.demo.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper