首先毕源,我系統(tǒng)里之前是mybatis猪腕,現(xiàn)在用mp姜胖,就得解決沖突問(wèn)題。mp本身有個(gè)mybatis纳猪,要把之前的pageHelper中的mybatis exclude出去:
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
</exclusion>
</exclusions>
</dependency>
然后看mp官網(wǎng)配置氧卧,其他都一樣,只不過(guò)這里有個(gè)細(xì)節(jié):這個(gè)必須加上才能在xml手寫(xiě)的時(shí)候查詢enum的類(lèi)型氏堤,比如狀態(tài)
@Bean
public Jackson2ObjectMapperBuilderCustomizer customizer(){
return builder -> builder.featuresToEnable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
}
例如:
<select id="selectAll" resultType="xxxx2" parameterType="xxxx">
select * from xxx b
where 1=1
<if test="status != null">
AND b.status = #{status}
</if>
</select>