1. 程式人生 > >mybatis 引數list放入map

mybatis 引數list放入map

<select id="getEmployeesMapParams" resultType="Employees">
  select * from EMPLOYEES e
<where>
  <if test="departmentId!=null and departmentId!=''">
    e.DEPARTMENT_ID=#{departmentId}
  </if>
  <if test="employeeIdsArray!=null and employeeIdsArray.length!=0">
    AND e.EMPLOYEE_ID in
    <foreach collection="employeeIdsArray" item="employeeId" index="index" open="(" close=")" separator=",">
      #{employeeId}
    </foreach>
  </if>
</where>
</select>