LiveOrderItemMapper.xml 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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="com.fs.live.mapper.LiveOrderItemMapper">
  6. <resultMap type="LiveOrderItem" id="LiveOrderItemResult">
  7. <result property="itemId" column="item_id" />
  8. <result property="orderId" column="order_id" />
  9. <result property="orderCode" column="order_code" />
  10. <result property="cartId" column="cart_id" />
  11. <result property="goodsId" column="goods_id" />
  12. <result property="productId" column="product_id" />
  13. <result property="productAttrValueId" column="product_attr_value_id" />
  14. <result property="jsonInfo" column="json_info" />
  15. <result property="num" column="num" />
  16. <result property="isAfterSales" column="is_after_sales" />
  17. <result property="isPrescribe" column="is_prescribe" />
  18. <result property="storeId" column="store_id" />
  19. <result property="isGift" column="is_gift" />
  20. </resultMap>
  21. <sql id="selectLiveOrderItemVo">
  22. select item_id, order_id, order_code, cart_id, goods_id, product_id, product_attr_value_id, json_info, num, is_after_sales, is_prescribe, store_id, is_gift from live_order_item
  23. </sql>
  24. <select id="selectLiveOrderItemList" parameterType="LiveOrderItem" resultMap="LiveOrderItemResult">
  25. <include refid="selectLiveOrderItemVo"/>
  26. <where>
  27. <if test="orderId != null and orderId != ''"> and order_id = #{orderId}</if>
  28. <if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
  29. <if test="cartId != null and cartId != ''"> and cart_id = #{cartId}</if>
  30. <if test="goodsId != null "> and goods_id = #{goodsId}</if>
  31. <if test="productId != null and productId != ''"> and product_id = #{productId}</if>
  32. <if test="productAttrValueId != null "> and product_attr_value_id = #{productAttrValueId}</if>
  33. <if test="jsonInfo != null and jsonInfo != ''"> and json_info = #{jsonInfo}</if>
  34. <if test="num != null "> and num = #{num}</if>
  35. <if test="isAfterSales != null "> and is_after_sales = #{isAfterSales}</if>
  36. <if test="isPrescribe != null "> and is_prescribe = #{isPrescribe}</if>
  37. <if test="storeId != null "> and store_id = #{storeId}</if>
  38. <if test="isGift != null "> and is_gift = #{isGift}</if>
  39. </where>
  40. </select>
  41. <select id="selectLiveOrderItemByItemId" parameterType="String" resultMap="LiveOrderItemResult">
  42. <include refid="selectLiveOrderItemVo"/>
  43. where item_id = #{itemId}
  44. </select>
  45. <insert id="insertLiveOrderItem" parameterType="LiveOrderItem" useGeneratedKeys="true" keyProperty="itemId">
  46. insert into live_order_item
  47. <trim prefix="(" suffix=")" suffixOverrides=",">
  48. <if test="orderId != null and orderId != ''">order_id,</if>
  49. <if test="orderCode != null">order_code,</if>
  50. <if test="cartId != null and cartId != ''">cart_id,</if>
  51. <if test="goodsId != null">goods_id,</if>
  52. <if test="productId != null and productId != ''">product_id,</if>
  53. <if test="productAttrValueId != null">product_attr_value_id,</if>
  54. <if test="jsonInfo != null">json_info,</if>
  55. <if test="num != null">num,</if>
  56. <if test="isAfterSales != null">is_after_sales,</if>
  57. <if test="isPrescribe != null">is_prescribe,</if>
  58. <if test="storeId != null">store_id,</if>
  59. <if test="isGift != null">is_gift,</if>
  60. </trim>
  61. <trim prefix="values (" suffix=")" suffixOverrides=",">
  62. <if test="orderId != null and orderId != ''">#{orderId},</if>
  63. <if test="orderCode != null">#{orderCode},</if>
  64. <if test="cartId != null and cartId != ''">#{cartId},</if>
  65. <if test="goodsId != null">#{goodsId},</if>
  66. <if test="productId != null and productId != ''">#{productId},</if>
  67. <if test="productAttrValueId != null">#{productAttrValueId},</if>
  68. <if test="jsonInfo != null">#{jsonInfo},</if>
  69. <if test="num != null">#{num},</if>
  70. <if test="isAfterSales != null">#{isAfterSales},</if>
  71. <if test="isPrescribe != null">#{isPrescribe},</if>
  72. <if test="storeId != null">#{storeId},</if>
  73. <if test="isGift != null">#{isGift},</if>
  74. </trim>
  75. </insert>
  76. <update id="updateLiveOrderItem" parameterType="LiveOrderItem">
  77. update live_order_item
  78. <trim prefix="SET" suffixOverrides=",">
  79. <if test="orderId != null and orderId != ''">order_id = #{orderId},</if>
  80. <if test="orderCode != null">order_code = #{orderCode},</if>
  81. <if test="cartId != null and cartId != ''">cart_id = #{cartId},</if>
  82. <if test="goodsId != null">goods_id = #{goodsId},</if>
  83. <if test="productId != null and productId != ''">product_id = #{productId},</if>
  84. <if test="productAttrValueId != null">product_attr_value_id = #{productAttrValueId},</if>
  85. <if test="jsonInfo != null">json_info = #{jsonInfo},</if>
  86. <if test="num != null">num = #{num},</if>
  87. <if test="isAfterSales != null">is_after_sales = #{isAfterSales},</if>
  88. <if test="isPrescribe != null">is_prescribe = #{isPrescribe},</if>
  89. <if test="storeId != null">store_id = #{storeId},</if>
  90. <if test="isGift != null">is_gift = #{isGift},</if>
  91. </trim>
  92. where item_id = #{itemId}
  93. </update>
  94. <delete id="deleteLiveOrderItemByItemId" parameterType="String">
  95. delete from live_order_item where item_id = #{itemId}
  96. </delete>
  97. <delete id="deleteLiveOrderItemByItemIds" parameterType="String">
  98. delete from live_order_item where item_id in
  99. <foreach item="itemId" collection="array" open="(" separator="," close=")">
  100. #{itemId}
  101. </foreach>
  102. </delete>
  103. </mapper>