Mybatis中有邏輯刪除的功能,執行delelte會自動轉換成update。可是默認其中的邏輯刪除=1,邏輯未刪除的值=0,若是咱們的db是true,false表明刪除跟未刪除的話應該怎麼辦呢?這裏能夠自定義值。spring
配置以下。sql
<bean id="sqlSessionFactoryBean"
class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
<property name="dataSource" ref="basicDataSource" />
<property name="mapperLocations" value="classpath:dao/siled/*.xml" />
<property name="configLocation" value="classpath:/mybatis-config.xml"></property>
<property name="globalConfig" ref="globalConfig" />
</bean>
<bean id="globalConfig"
class="com.baomidou.mybatisplus.core.config.GlobalConfig">
<!--DB config -->
<property name="dbConfig">
<bean id="dbConfig"
class="com.baomidou.mybatisplus.core.config.GlobalConfig.DbConfig">
<!--邏輯刪除値 -->
<property name="logicDeleteValue" value="true" />
<!--邏輯未刪除値 -->
<property name="logicNotDeleteValue" value="false" />
</bean>
</property>
</bean>
複製代碼