ProdPriceMqMapper.xml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="cn.com.wingxi.biandan.mq.server.product.mapper.ProdPriceMqMapper">
  6. <resultMap type="ProdPrice" id="ProdPriceMqResult">
  7. <result property="prodPriceId" column="prodPriceId" />
  8. <result property="prodId" column="prodId" />
  9. <result property="pprId" column="pprId" />
  10. <result property="buyerId" column="buyerId" />
  11. <result property="buyerRoleKey" column="buyerRoleKey" />
  12. <result property="salesmanId" column="salesmanId" />
  13. <result property="salesmanRoleKey" column="salesmanRoleKey" />
  14. <result property="costItemKey" column="costItemKey" />
  15. <result property="surfaceQty" column="surfaceQty" />
  16. <result property="price" column="price" />
  17. <result property="delFlag" column="delFlag" />
  18. <result property="createUser" column="createUser" />
  19. <result property="createTime" column="createTime" />
  20. <result property="updateUser" column="updateUser" />
  21. <result property="updateTime" column="updateTime" />
  22. </resultMap>
  23. <sql id="selectProdPriceMq">
  24. select
  25. p.prodPriceId,
  26. p.prodId,
  27. p.pprId,
  28. p.buyerId,
  29. p.buyerRoleKey,
  30. p.salesmanId,
  31. p.salesmanRoleKey,
  32. p.costItemKey,
  33. p.surfaceQty,
  34. p.price,
  35. p.delFlag,
  36. p.createUser,
  37. p.createTime,
  38. p.updateUser,
  39. p.updateTime
  40. from m_prod_price p
  41. inner join m_cost_item c on p.costItemKey = c.costItemKey
  42. </sql>
  43. <select id="getProdPriceByUnionId" parameterType="ProdPrice" resultType="BigDecimal">
  44. SELECT sum(p.price) price
  45. FROM m_prod_price p
  46. inner join m_cost_item c on p.costItemKey = c.costItemKey
  47. WHERE p.delFlag = '0'
  48. and p.prodId = #{prodId}
  49. and p.pprId = #{pprId}
  50. and p.buyerId = #{buyerId}
  51. and p.salesmanId = #{salesmanId}
  52. and (case when c.singleFlag = '0' then p.surfaceQty = #{surfaceQty} else 1 end)
  53. </select>
  54. </mapper>