大家好, 请帮帮小弟一下 sqlSession = getSession(); String members=" ""user01"",""user02"",""user03"" "; Map map = new HashMap(); map.put("members", members); ArrayList<MemberVO> member_list = (ArrayList<MemberVO>)sqlSession.selectList("member.selectListMember",members); member.xml 中的SQL语句如下 <select id="selectListMember" parameterType="java.util.Map" resultType="MemberVO"> SELECT * FROM MEMBER WHERE MEMBER_ID IN #{members} 上面代码member_list 返回 0 请帮帮忙该如何解决这个问题? 请赐教。 |
|
20分 |
把数据放进数组比如List<String> members,xml配置中
SELECT * FROM MEMBER WHERE MEMBER_ID IN <iterate property="members" open="(" close=")" conjunction=","> #members[]# </iterate> |
10分 |
你试试用${members}
#{members}会被myBatis处理,而${members}则原封不动 |
谢谢各位,问题解决了
<foreach item="members" index="index" collection="list" open="(" separator="," close=")"> #{members} </foreach> |