添加一个is_deleted字段
实体类中属性做逻辑删除标识
@ApiModelProperty(value = "逻辑删除 1(true)已删除, 0(false)未删除") @TableLogic @TableField(fill = FieldFill.INSERT) private Integer isDeleted;
插入时自动填充配置
测试删除一条记录
测试前
@RunWith(SpringRunner.class) @SpringBootTest(classes = EduApplication.class) public class MyTest { @Autowired private EduCourseMapper courseMapper; @Test public void testdemo01(){ courseMapper.deleteById("1655898309098749953"); System.out.println("springboot单元测试"); } }
测试后