一、使用MyBatis-Plus框架
pom.xml(依赖文件)
@Autowired:自动补全
@PostMapping(“绑定”):POST
JSONObject
前端从controller进入—mapper
QueryWrapper:条件构造器
代码生成过程:
新建表
代码生成CodeGenerator(src-main-java-com…)修改表名 修改密码 修改数据库
.strategyConfig(builder -> {
builder.addInclude("t_test") // 设置需要生成的表名
.addTablePrefix("t_", "c_"); // 设置过滤表前缀
})
erp_mao为数据库名字
"jdbc:mysql://localhost:3306/erp_maouseSSL=true&useUnicode=true&characterEncoding=utf8&serverTimezone=GMT%2B8",
移动所有文件至所需文件夹
api调试格式:
{
"data": {
"id": 80,
"name": "90"
}
}
问题
Q:Could not autowire. No beans of ‘PurchaseBackMapper’ type found.
A:在PurchaseBackMapper(对应的mapper文件)加上@Mapper
@Mapper</