mybatis中使用in

发布时间 2023-09-25 14:21:13作者: 五官一体即忢

 

        <if test="areaCode != null and areaCode !=''">
            and AREACODE in (${areaCode})
        </if>

 

如果直接传入拼接好的where in 条件, 比如('111','222','333'),则需要使用${areaCode}传参,即绝对引用,而不能使用#
, 如果使用#传参会被mybatis当成字符串再添加一层''引号,导致错误。