电商项目之搜索sql书写(重点)

  <select id="selectByNameAndProductId" resultMap="BaseResultMap" parameterType="map">
    select
    <include refid="Base_Column_List"></include>
    from mmall_product
    <where>
      <if test="productName!=null">
        and  name like #{productName}
      </if>
      <if test="productId!=null">
        and id=#{productId}
      </if>
    </where>
  </select>

猜你喜欢

转载自blog.csdn.net/Richard_666/article/details/85930361