Mybatis动态SQL单一基础类型参数用if标签

时间:2023-03-08 16:47:01
Mybatis动态SQL单一基础类型参数用if标签

Mybatis动态SQL单一基础类型参数用if标签时,test中应该用 _parameter,如:

1
2
3
4
5
6
<select id="selectByName" resultMap="ResultMap" parameterType="java.lang.String"
    select * from table1 
    <if test="_parameter != null"
        where _name = #{name} 
    </if
</select>