PriceMapper.xml 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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.caimei365.commodity.mapper.PriceMapper">
  4. <select id="getIdentityByUserId" resultType="java.lang.Integer">
  5. select userIdentity from user where userID = #{userId}
  6. </select>
  7. <select id="getDetailPrice" resultType="com.caimei365.commodity.model.vo.PriceVo">
  8. select
  9. p.productID as productId,
  10. p.price1 as price,
  11. p.minBuyNumber as minBuyNumber,
  12. p.maxBuyNumber as maxBuyNumber,
  13. p.price1TextFlag as priceFlag,
  14. p.ladderPriceFlag as ladderPriceFlag,
  15. p.normalPrice as normalPrice,
  16. p.costPrice as costPrice,
  17. p.costProportional as costProportional,
  18. p.costCheckFlag as costCheckFlag,
  19. p.step as step,
  20. p.shopID as shopId,
  21. p.taxPoint as taxRate,
  22. p.includedTax as includedTax,
  23. p.invoiceType as invoiceType
  24. from product p
  25. where productID = #{productId}
  26. </select>
  27. <select id="getListPriceByProductIds" resultType="com.caimei365.commodity.model.vo.PriceVo">
  28. select
  29. p.productID as productId,
  30. p.price1 as price,
  31. p.minBuyNumber as minBuyNumber,
  32. p.maxBuyNumber as maxBuyNumber,
  33. p.price1TextFlag as priceFlag,
  34. p.ladderPriceFlag as ladderPriceFlag,
  35. p.normalPrice as normalPrice,
  36. p.costPrice as costPrice,
  37. p.costProportional as costProportional,
  38. p.costCheckFlag as costCheckFlag,
  39. p.step as step,
  40. p.shopID as shopId,
  41. p.includedTax as includedTax,
  42. p.invoiceType as invoiceType,
  43. p.taxPoint as taxRate
  44. from product p
  45. where productID in
  46. <foreach collection="productIds" open="(" separator="," close=")" item="productId">
  47. #{productId}
  48. </foreach>
  49. </select>
  50. <select id="getladderPricesByProductId" resultType="com.caimei365.commodity.model.vo.LadderPriceVo">
  51. select
  52. id, productId, ladderNum, buyNum, buyPrice
  53. from product_ladder_price
  54. where productId = #{productId} and userType = 3 and delFlag = 0
  55. order by ladderNum asc
  56. </select>
  57. <select id="findLowerLadderPrice" resultType="com.caimei365.commodity.model.vo.LadderPriceVo">
  58. select
  59. id, productId, ladderNum, buyNum, buyPrice
  60. from product_ladder_price
  61. where productId = #{productId} and userType = 3 and delFlag = 0
  62. order by ladderNum DESC
  63. limit 1
  64. </select>
  65. <select id="findMaxLadderPrice" resultType="com.caimei365.commodity.model.vo.LadderPriceVo">
  66. select
  67. id, productId, ladderNum, buyNum, buyPrice
  68. from product_ladder_price
  69. where productId = #{productId} and userType = 3 and delFlag = 0
  70. order by ladderNum asc
  71. limit 1
  72. </select>
  73. <select id="getRepurchasePrice" resultType="java.lang.Double">
  74. select
  75. r.currentPrice
  76. from repeat_purchase_price r
  77. left join product p on p.productID = r.productId
  78. where r.productId = #{productId} and userId = #{userId}
  79. and ((p.costCheckFlag=1 and r.currentPrice <![CDATA[ >= ]]> p.costPrice) or p.costCheckFlag=2)
  80. and p.price1 <![CDATA[ >= ]]> r.currentPrice
  81. and r.delFlag = 0
  82. </select>
  83. <select id="getTaxByProductId" resultType="com.caimei365.commodity.model.vo.TaxVo">
  84. select
  85. p.includedTax as includedTax,
  86. p.invoiceType as invoiceType,
  87. p.taxPoint as taxPoint
  88. from product p
  89. where productID = #{productId}
  90. </select>
  91. </mapper>