SupplierPriceMapper.xml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.fjhx.supply.mapper.supplier.SupplierPriceMapper">
  4. <select id="getPage" resultType="com.fjhx.supply.entity.supplier.vo.SupplierPriceVo">
  5. select sp.id,
  6. sp.supplier_info_id,
  7. sp.product_info_id,
  8. sp.price,
  9. si.name supplierName,
  10. si.type supplierType,
  11. sp.company_id,
  12. sp.including_tax_price,
  13. si.priv_tax_points AS supplier_tax_points
  14. from supplier_price sp
  15. inner join supplier_info si on sp.supplier_info_id = si.id
  16. ${ew.customSqlSegment}
  17. </select>
  18. <select id="getTopPriceList" resultType="com.fjhx.supply.entity.supplier.vo.SupplierPriceVo">
  19. SELECT
  20. t1.*,
  21. si.`name` AS supplierName
  22. FROM
  23. (
  24. SELECT
  25. sp.supplier_info_id,
  26. sp.product_info_id,
  27. sp.price,
  28. @row_number :=IF( @product_info_id = sp.product_info_id, @row_number + 1, 1 ) AS row_number
  29. FROM
  30. supplier_price sp,(SELECT @row_number := 0) b
  31. ORDER BY
  32. sp.price ASC
  33. ) t1
  34. left join supplier_info si on t1.supplier_info_id = si.id
  35. where
  36. t1.row_number &lt;= #{count}
  37. <foreach collection="productIds" item="productId" open="AND t1.product_info_id IN (" separator="," close=")">
  38. #{productId}
  39. </foreach>
  40. </select>
  41. </mapper>