mybatis-plus 逻辑删除后的值如何查询到?

如上,逻辑删除后 除了自己重写mapper 查询语句,还有别的(MP提供的)办法获取吗?

<choose>
	<when test="ew != null and ew.sqlFirst != null">
		${ew.sqlFirst}
	</when>
	<otherwise></otherwise>
</choose> 

SELECT 

<choose>
	<when test="ew != null and ew.sqlSelect != null">
		${ew.sqlSelect}
	</when>
	<otherwise>param1,param2,param3</otherwise>
</choose> 

FROM tableName

<where>
	<choose>
		<when test="ew != null">
			<if test="ew.entity != null">
				<if test="ew.entity.id != null">id=#{ew.entity.id}</if>

			</if>
			AND deleted='0'
			<if test="ew.sqlSegment != null and ew.sqlSegment != '' and ew.nonEmptyOfNormal">
				AND ${ew.sqlSegment}
			</if>
			<if test="ew.sqlSegment != null and ew.sqlSegment != '' and ew.emptyOfNormal">
				${ew.sqlSegment}
			</if>
		</when>
		<otherwise>
			deleted='0'
		</otherwise>
	</choose>
</where> 

<choose>
	<when test="ew != null and ew.sqlComment != null">
		${ew.sqlComment}
	</when>
	<otherwise></otherwise>
</choose>

这是mybatisplus selectList方法用的动态SQL模板。主要看deleted='0'。整体看下来没有给任何机会解决不自动添加deleted='0'的机会。我试着去建议使用

<if test="ew.ignoreTableLogic != true">
    AND deleted='0'
</if>

给wapper添加ignoreTableLogic ,可以由使用者来控制是否携带逻辑判断请求。当然默认是携带的。

官网的建议,我也找了半天没找到好的办法

mybatis-plus支持配置全局逻辑删除字段和删除标识,如1代表逻辑删0代表没逻辑删。同时也支持注解的方式,某个entity中代表逻辑删除的字段添加注解@TableLogic。配置后mybatis的所有mapper会自动拼接逻辑删判断语句,自己写的mapper就要显示的添加逻辑删判断语句。不过mybatis已经蜕变成了真正的ORM框架,没必要自己写sql了。

你好 有好的解决办法了不

逻辑删除在设计上就是“删除”,这样设计的本意是为了防止误删,如果对“删除”的数据还有其他业务操作,那我建议使用其他字段来代替删除,这些被打上“删除”或许在后期会因数据庞大而真删

没有看懂哎

大佬,这个问题有解决方案了嘛,我也同样遇到这个问题了。

大哥 有找到方案吗