mybatis Map<List<T>>

<select id="getStudentsByCondition" parameterType="java.util.Map" resultMap="BaseResultMap">
    select .....where 
    <if test="condition != null">
	<foreach collection="condition.keys" index="index" item="item">
		<if test="condition[item]!=null and condition[item]!=''">
			<choose>
			       <when test="item=='s_course'">
				     and ${item} in 
			   	     <foreach collection="condition[item]" item="course" open="(" separator="," close=")">
			   		  #{course}
			   	     </foreach>
                               </when>
                               <otherwise>
			   	      and ${item} 
                                       like '%'+
			   	             <foreach collection="condition[item]" item="others">#{others}</foreach>
			   	            +'%'			   			
			   	</otherwise>
			</choose>
		</if>
	</foreach>
    </if>  
</select>

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页