标签:而且 tail art details lua shm query value return
需求: 需要通过map传入一个list和一个String类型的参数,而且没有封装成Javabean
实现
service层
// 根据roomId查询所有的roomQtId public int queryRoomQtIdByRoomId(ArrayList<Long> roomIdList, String meetingId) { List<Long> roomQtIdlist = hotelRoomDao2.queryRoomQtIdByRoomId(roomIdList); // 根据roomQtId查询是否已经录入了房间了 Map<String, Object> map = new HashMap<String, Object>(); map.put("roomQtIdlist", roomQtIdlist); map.put("meetingId", meetingId); int i = hotelRoomDao2.ifExistRoomQtId(map); return i; }
Dao接口
//查询房间是否已经录入了房间号 int ifExistRoomQtId(Map<String, Object> map);
xml
<!-- 查询房间是否已经录入了房间号 --> <select id="ifExistRoomQtId" parameterType="map" resultType="int" > SELECT COUNT(1) FROM PM.T_MEETING_ROOM_ARRANGE WHERE MEETING_ID = #{meetingId} AND ROOM_QT_ID IN <foreach collection="roomQtIdlist" item="item" index="index" open="(" close=")" separator=","> #{item} </foreach> </select>
过程中遇到bug
MyBatis:The expression ‘list‘ evaluated to a null value
原因:直接赋值,将
<foreach collection="roomQtIdlist" item="item" index="index" open="("
close=")" separator=",">
#{item}
</foreach>
中的
collection="roomQtIdlist"
写为了
collection="list"
标签:而且 tail art details lua shm query value return
原文地址:http://www.cnblogs.com/miye/p/7267556.html