1、在实体类添加注解
@TableId(value = "id",type=IdType.ID_WORKER_STR) private String id; @TableLogic @ApiModelProperty(value = "逻辑删除 1(true),未删除0 (false )") private Boolean isDeleted; @ApiModelProperty(value = "创建时间") @TableField(fill = FieldFill.INSERT) private Date gmtCreate; @TableField(fill = FieldFill.INSERT_UPDATE) @ApiModelProperty(value = "更新时间") private Date gmtModified;
2、配置——逻辑删除/分页
@Configuration @MapperScan("com.atguigu.eduservice.mapper") //mapper是操作数据的包 public class MyConfig { //逻辑删除 @Bean public ISqlInjector sqlInjector() { return new LogicSqlInjector(); } //分页 @Bean public PaginationInterceptor paginationInterceptor() { PaginationInterceptor paginationInterceptor = new PaginationInterceptor(); // 设置请求的页面大于最大页后操作, true调回到首页,fal