channelPriceMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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.iamberry.wechat.service.mapper.ChannelPriceMapper">
  4. <resultMap id="BaseResultMap" type="ChannelPrice" >
  5. <result column="channel_price_id" property="channelPriceId" />
  6. <result column="channel_id" property="channelId" />
  7. <result column="product_id" property="productId" />
  8. <result column="color_id" property="colorId" />
  9. <result column="channel_price_offer" property="channelPriceOffer" />
  10. <result column="channel_price_status" property="channelPriceStatus" />
  11. <result column="channel_price_create_time" property="channelPriceCreateTime" />
  12. <result column="channel_price_update_time" property="channelPriceUpdateTime" />
  13. </resultMap>
  14. <sql id="Base_List" >
  15. t.channel_price_id,
  16. t.channel_id,
  17. t.product_id,
  18. t.color_id,
  19. t.channel_price_offer,
  20. t.channel_price_status,
  21. t.channel_price_create_time,
  22. t.channel_price_update_time
  23. </sql>
  24. <select id="getChannelPriceList" resultMap="BaseResultMap" parameterType="ChannelPrice" >
  25. select
  26. <include refid="Base_List" />
  27. from tb_iamberry_channel_price t
  28. <where>
  29. <if test="channelPriceId != null ">
  30. AND t.channel_price_id = #{channelPriceId}
  31. </if >
  32. <if test="channelId != null ">
  33. AND t.channel_id = #{channelId}
  34. </if >
  35. <if test="productId != null ">
  36. AND t.product_id = #{productId}
  37. </if >
  38. <if test="colorId != null ">
  39. AND t.color_id = #{colorId}
  40. </if >
  41. <if test="channelPriceOffer != null ">
  42. AND t.channel_price_offer = #{channelPriceOffer}
  43. </if >
  44. <if test="channelPriceStatus != null ">
  45. AND t.channel_price_status = #{channelPriceStatus}
  46. </if >
  47. </where>
  48. </select>
  49. <select id="getChannelPriceById" resultMap="BaseResultMap" parameterType="Integer" >
  50. select
  51. <include refid="Base_List" />
  52. from tb_iamberry_channel_price t
  53. where t.channel_price_id= #{channelPriceId}
  54. </select>
  55. <insert id="save" parameterType="ChannelPrice" >
  56. insert into
  57. tb_iamberry_channel_price
  58. (
  59. channel_id,
  60. product_id,
  61. color_id,
  62. channel_price_offer,
  63. channel_price_status
  64. )
  65. values
  66. (
  67. #{channelId},
  68. #{productId},
  69. #{colorId},
  70. #{channelPriceOffer},
  71. #{channelPriceStatus}
  72. )
  73. </insert>
  74. <update id="update" parameterType="ChannelPrice" >
  75. update
  76. tb_iamberry_channel_price
  77. <set >
  78. <if test="channelId != null ">
  79. channel_id = #{channelId},
  80. </if >
  81. <if test="productId != null ">
  82. product_id = #{productId},
  83. </if >
  84. <if test="colorId != null ">
  85. color_id = #{colorId},
  86. </if >
  87. <if test="channelPriceOffer != null ">
  88. channel_price_offer = #{channelPriceOffer},
  89. </if >
  90. <if test="channelPriceStatus != null ">
  91. channel_price_status = #{channelPriceStatus},
  92. </if >
  93. </set >
  94. where channel_price_id= #{channelPriceId}
  95. </update>
  96. <delete id="delete" parameterType="Integer" >
  97. delete
  98. tb_iamberry_channel_price
  99. where channel_price_id=#{channelPriceId}
  100. </delete>
  101. <insert id="saveList" parameterType="java.util.List" >
  102. insert into
  103. tb_iamberry_channel_price
  104. (
  105. channel_id,
  106. product_id,
  107. color_id,
  108. channel_price_offer,
  109. channel_price_status
  110. )
  111. values
  112. <foreach collection="list" item="node" index="index" separator="," open="" close="">
  113. (
  114. #{node.channelId},
  115. #{node.productId},
  116. #{node.colorId},
  117. #{node.channelPriceOffer},
  118. #{node.channelPriceStatus}
  119. )
  120. </foreach >
  121. </insert>
  122. <delete id="deleteList" parameterType="String" >
  123. delete
  124. tb_iamberry_channel_price
  125. where channel_price_id in
  126. <foreach collection="ids" item="item" index="index" separator="," open="(" close=")">
  127. #{item}
  128. </foreach >
  129. </delete>
  130. </mapper>