EhsdPurchaseProductMapper.xml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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.sale.mapper.purchase.EhsdPurchaseProductMapper">
  4. <update id="updatePurchaseId"></update>
  5. <select id="getPage" resultType="com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductVo">
  6. select
  7. epp.id,
  8. epp.purchase_id,
  9. epp.product_id,
  10. epp.product_name,
  11. epp.product_model,
  12. epp.quantity,
  13. epp.price,
  14. epp.amount,
  15. epp.remark,
  16. epp.json,
  17. epp.create_user,
  18. epp.create_time,
  19. epp.update_user,
  20. epp.update_time
  21. from ehsd_purchase_product epp
  22. ${ew.customSqlSegment}
  23. </select>
  24. <select id="getGroupSumAmount" resultType="com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductVo">
  25. SELECT
  26. CONCAT(
  27. IFNULL(
  28. (SELECT IFNULL( SUM( amount ), 0 ) FROM ehsd_purchase_product_mountings WHERE FIND_IN_SET(purchase_product_id,GROUP_CONCAT(t1.id))),
  29. 0
  30. ),
  31. "-",
  32. IFNULL( t2.currency, "¥" ),
  33. "-",
  34. IFNULL( t2.rate, 1 )) AS currencyAmount,
  35. t1.contract_id AS contractId
  36. FROM
  37. ehsd_purchase_product t1
  38. LEFT JOIN ehsd_purchase t2 ON t1.purchase_id = t2.id
  39. WHERE
  40. t2.`status` &gt;= 10
  41. AND t2.`status` &lt; 88
  42. <if test="contractIds neq null and contractIds.size() > 0">
  43. <foreach collection="contractIds" item="contractId" open="AND t1.contract_id IN (" separator="," close=")">
  44. #{contractId}
  45. </foreach>
  46. </if>
  47. GROUP BY t1.contract_id
  48. </select>
  49. <select id="getListByContractId" resultType="com.fjhx.sale.entity.purchase.vo.EhsdPurchaseProductVo">
  50. SELECT
  51. t1.*,
  52. t2.currency,
  53. t2.rate
  54. FROM
  55. ehsd_purchase_product t1
  56. LEFT JOIN ehsd_purchase t2 ON t1.purchase_id = t2.id
  57. WHERE
  58. t1.contract_id = #{contractId}
  59. </select>
  60. </mapper>