1.已知 Entity.java
/**
* 删除标记 0,正常;1,删除
*/
@TableLogic
@TableField("deleted")
private Integer deleted;
2.对应表的Mapper.java
// 查询包括已删除的全部数据
@Select("select * from table where id = #{id} and deleted in (0,1) limit 1")
Entity selectWithDeleted(long id);
// 恢复已删除数据
@Select("update table set deleted = 0 where id = #{id}")
void undelete(long id);