传入多个字符串例如 in(‘00’,‘01’)时,mybatis中用#会解析成 “ ‘00’,‘01’ ”,这里用
$会原样传入,
使用in传入多个字符串
参考文章:https://www.cnblogs.com/wslook/p/9185448.html
想要查询出来的效果
select * ftom users where useFlag = ‘Y’ and sts in(‘00’, ‘01’);
- dao
map.put(“useFlag","y");
map.put("sts", "'00','01'");
- mapper文件【正解】
<select id="listBy" parameterType="java.util.Map" resultMap="beanMap">
select * from users
<where>
USE_FLAG = #{useFlag,jdbcType=VARCHAR} and
STS in (${sts})
</where>
</select>