GoodsDonSkuMapper.xml 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. </mapper>