`
wang_ping001
  • 浏览: 87475 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

mybatis foreach标签模糊查询

 
阅读更多

 

	<select id="searchByRouteStatus"  parameterType="java.util.Map" resultMap="BaseResultMapExt">
		select
		<include refid="Base_Column_List_Ext" />
		from "t_tourist_route" tr
		<where>
			 tr.status_id in
			<!--statusList 为map中的键值-->
			<foreach close=")" collection="statusList" item="item" open="("
				separator=",">
				#{item}
         </foreach>
         <if test="departureDate!=null">
				<if test="returnDate!=null">
					and tr.departure_date BETWEEN #{departureDate} AND
					#{returnDate}
			</if>
			</if>
			<if test="routeName!=null">
				and tr.route_name like '%'||#{routeName}||'%'
		</if>
			<if test="routeNumber!=null">
				and tr.route_number like '%'||#{routeNumber}||'%'
		</if>
		</where>
	</select>
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics