GoodsDonSkuMapper.xml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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.cyksj.mapper.GoodsDonSkuMapper">
  4. <select id="selectAIMonthSkuIds" resultType="java.lang.Long">
  5. select id from goods_don_sku where goods_id in
  6. <foreach collection="list" item="item" open="(" separator="," close=")">
  7. #{item}
  8. </foreach>
  9. and `months` = 1
  10. </select>
  11. <select id="getSpecificSkuIdsByGoodsIds" resultType="java.lang.Long">
  12. select id from goods_don_sku where goods_id in
  13. <foreach collection="list" item="item" open="(" separator="," close=")">
  14. #{item}
  15. </foreach>
  16. and `months` = #{months}
  17. </select>
  18. <select id="getSpecificSkuIdsByGoodsId" resultType="java.lang.Long">
  19. select id
  20. from goods_don_sku
  21. where goods_id = #{goodsId}
  22. and num = #{num}
  23. and `months` = #{months}
  24. </select>
  25. <select id="selectSkuShops" resultType="com.cyksj.model.entity.YhShopGoodsSku">
  26. select id as skuId,goods_id,price from goods_don_sku where goods_id in
  27. <foreach collection="list" item="item" open="(" separator="," close=")">
  28. #{item}
  29. </foreach>
  30. and status = true
  31. </select>
  32. <select id="selectSingleSkuIdsByGoodsId" resultType="java.lang.Long">
  33. select id from goods_don_sku where goods_id = #{goodsId} and num = 1
  34. </select>
  35. <select id="checkAndReturnMinPriceUserOwnsSku" resultType="com.cyksj.model.entity.GoodsDonSku">
  36. select id,price,months,days
  37. from goods_don_sku
  38. where goods_id = #{goodsId}
  39. and status is true
  40. and (user_owns is null
  41. <if test="dsUserId != 0">
  42. or JSON_CONTAINS(user_owns, '${dsUserId}')
  43. </if>) order by price limit 1
  44. </select>
  45. <select id="selectRenewOriSku" resultType="com.cyksj.model.dto.OriSkuDto">
  46. select *
  47. from goods_don_sku
  48. where id = #{skuId}
  49. limit 1
  50. </select>
  51. <select id="selectExchangeTitle" resultType="java.lang.String">
  52. select GROUP_CONCAT(g.title, ifnull(sku.spec_val,''),cast(sku.price/100 as decimal(10,2))) from goods_don_sku sku inner join goods_don g on g.id = sku.goods_id
  53. where sku.id in
  54. <foreach collection="ids" item="item" open="(" separator="," close=")">
  55. #{item}
  56. </foreach>
  57. </select>
  58. <select id="selectGIdsBySkuIds" resultType="java.lang.Long">
  59. select distinct sku.goods_id from goods_don_sku sku
  60. where sku.id in
  61. <foreach collection="ids" item="item" open="(" separator="," close=")">
  62. #{item}
  63. </foreach>
  64. </select>
  65. <select id="selectExchangeTitleSkus" resultType="com.cyksj.model.views.GoodsDonSkuDetailView">
  66. select g.id as goods_id,g.title,sku.id as sku_id,sku.spec_val,g.logo from goods_don_sku sku inner join goods_don g on g.id = sku.goods_id
  67. where sku.id in
  68. <foreach collection="ids" item="item" open="(" separator="," close=")">
  69. #{item}
  70. </foreach>
  71. </select>
  72. <select id="selectIdpGptAndRechargeSkuIds" resultType="java.lang.Long">
  73. select id from goods_don_sku where ((goods_id = #{gptPlusGid} and num = 1) or goods_id = #{gptRechargeGoodsId}) and status is true
  74. </select>
  75. </mapper>