首先,我系统里之前是mybatis,现在用mp,就得解决冲突问题。mp本身有个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官网配置,其他都一样,只不过这里有个细节:这个必须加上才能在xml手写的时候查询enum的类型,比如状态
@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>