<select id="queryByTableType" resultType="String" parameterType="AreaQO">
select
city_name
from
<if test="tableType == 1">
area_table
</if>
<if test="tableType == 2">
weather_table
</if>
where 1=1
<if test="cityName !=null">
and city_name=#{cityName}
</if>
</select>-->
在from后面使用if test判断,能正确解析出使用哪个表
版本:
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>1.3.2</version>
</dependency>