application.properties中配置
mybatis.configuration.variables.k1='v1'
mybatis.configuration.variables.k2='v2'
XXXMapper.xml中使用
<select id="test1" resultMap="BaseResultMap" parameterType="java.util.Map">
<choose>
<when test="${k1}=='v1'">
select * from SYS_USER
</when>
<otherwise>
select * from SYS_USER where uname=${k1}
</otherwise>
</choose>
</select>
测试1
mybatis.configuration.variables.k1='v1'
测试2
mybatis.configuration.variables.k1='v3'