Mybatis
MybatisPlusConfig
①包扫描MapperScan
②指定数据库
@MapperScan(basePackages = "com.zhan_py.ssyx.*.mapper") @Configuration public class MybatisPlusConfig { /** * 添加分页插件 */ @Bean public MybatisPlusInterceptor mybatisPlusInterceptor() { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); return interceptor; } }
逻辑删除
实体类上加@TableLogic
controller
①@RequestBody接收json数据封装成对象
②@ResponseBody将对象作为json格式响应
③前端json数组后端接收的格式是list集合,例如@RequestBody List<Long> ids