1. 程式人生 > >電商專案之搜尋傳過去為集合(超級重點)

電商專案之搜尋傳過去為集合(超級重點)

1、

  <select id="selectByNameAndCategoryIds" resultMap="BaseResultMap" parameterType="map">
    select
    <include refid="Base_Column_List"></include>
    from mmall_product
    where status=1
    <if test="productName!=null">
      and name like #{productName}
    </if>
    <if test="categoryIdList!=null">
      and category_id in
      <foreach item="item" index="index" open="(" separator="," close=")" collection="categoryIdList">
        #{item}
      </foreach>
    </if>
  </select>