1
0

ApiOrderGoodsMapper.xml 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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.kmall.api.dao.ApiOrderGoodsMapper">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.api.entity.OrderGoodsVo" id="orderGoodsMap">
  6. <result property="id" column="id"/>
  7. <result property="order_id" column="order_id"/>
  8. <result property="goods_id" column="goods_id"/>
  9. <result property="goods_name" column="goods_name"/>
  10. <result property="goods_sn" column="goods_sn"/>
  11. <result property="product_id" column="product_id"/>
  12. <result property="number" column="number"/>
  13. <result property="market_price" column="market_price"/>
  14. <result property="retail_price" column="retail_price"/>
  15. <result property="goods_specification_name_value" column="goods_specification_name_value"/>
  16. <result property="is_real" column="is_real"/>
  17. <result property="goods_specification_ids" column="goods_specification_ids"/>
  18. <result property="list_pic_url" column="list_pic_url"/>
  19. <result column="sku" property="sku" jdbcType="VARCHAR" />
  20. <result column="order_biz_type" property="orderBizType" jdbcType="CHAR" />
  21. <result column="creater_sn" property="createrSn" jdbcType="VARCHAR" />
  22. <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  23. <result column="moder_sn" property="moderSn" jdbcType="VARCHAR" />
  24. <result column="mod_time" property="modTime" jdbcType="TIMESTAMP" />
  25. <result column="tstm" property="tstm" jdbcType="TIMESTAMP" />
  26. <result property="goodsRate" column="goods_rate"/>
  27. <result property="settlePrice" column="settle_price"/>
  28. <result property="merchSn" column="merch_sn"/>
  29. <result property="storeTopicId" column="store_topic_id"/>
  30. </resultMap>
  31. <select id="queryObject" resultMap="orderGoodsMap">
  32. select g.* from mall_order_goods gwhere g.id = #{value}
  33. </select>
  34. <select id="queryList" resultMap="orderGoodsMap">
  35. select g.*,o.merch_sn,m.store_topic_id 'campTopicId',t.store_topic_id 'distcountTopicId' from mall_order_goods g left join mall_order o on o.id = g.order_id
  36. left join mk_store_camp_minus m on g.store_topic_id = m.store_topic_id
  37. left join mk_store_ticket_discount t on g.store_topic_id = t.store_topic_id
  38. <where>
  39. <if test="order_id != null and order_id != ''">
  40. and order_id = #{order_id}
  41. </if>
  42. </where>
  43. <choose>
  44. <when test="sidx != null and sidx.trim() != ''">
  45. order by ${sidx} ${order}
  46. </when>
  47. <otherwise>
  48. order by id desc
  49. </otherwise>
  50. </choose>
  51. <if test="offset != null and limit != null">
  52. limit #{offset}, #{limit}
  53. </if>
  54. </select>
  55. <select id="queryTotal" resultType="int">
  56. select count(*) from mall_order_goods
  57. </select>
  58. <insert id="save" parameterType="com.kmall.api.entity.OrderGoodsVo" useGeneratedKeys="true" keyProperty="id">
  59. insert into mall_order_goods
  60. (
  61. `order_id`,
  62. `goods_id`,
  63. `goods_name`,
  64. `goods_sn`,
  65. `product_id`,
  66. `number`,
  67. `market_price`,
  68. `retail_price`,
  69. `goods_specification_name_value`,
  70. `is_real`,
  71. `goods_specification_ids`,
  72. `list_pic_url`,
  73. is_dist_sell_scan,
  74. store_topic_id,
  75. <if test="goodsRate != null" >
  76. goods_rate,
  77. </if>
  78. <if test="settlePrice != null" >
  79. settle_price,
  80. </if>
  81. <if test="sku != null" >
  82. sku,
  83. </if>
  84. <if test="orderBizType != null" >
  85. order_biz_type,
  86. </if>
  87. <if test="createrSn != null" >
  88. creater_sn,
  89. </if>
  90. <if test="createTime != null" >
  91. create_time,
  92. </if>
  93. <if test="moderSn != null" >
  94. moder_sn,
  95. </if>
  96. <if test="modTime != null" >
  97. mod_time
  98. </if>
  99. )
  100. values
  101. (
  102. #{order_id},
  103. #{goods_id},
  104. #{goods_name},
  105. #{goods_sn},
  106. #{product_id},
  107. #{number},
  108. #{market_price},
  109. #{retail_price},
  110. #{goods_specification_name_value},
  111. #{is_real},
  112. #{goods_specification_ids},
  113. #{list_pic_url},
  114. 0,
  115. #{storeTopicId},
  116. <if test="goodsRate != null" >
  117. #{goodsRate},
  118. </if>
  119. <if test="settlePrice != null" >
  120. #{settlePrice},
  121. </if>
  122. <if test="sku != null" >
  123. #{sku,jdbcType=VARCHAR},
  124. </if>
  125. <if test="orderBizType != null" >
  126. #{orderBizType,jdbcType=VARCHAR},
  127. </if>
  128. <if test="createrSn != null" >
  129. #{createrSn,jdbcType=VARCHAR},
  130. </if>
  131. <if test="createTime != null" >
  132. #{createTime,jdbcType=TIMESTAMP},
  133. </if>
  134. <if test="moderSn != null" >
  135. #{moderSn,jdbcType=VARCHAR},
  136. </if>
  137. <if test="modTime != null" >
  138. #{modTime,jdbcType=TIMESTAMP}
  139. </if>
  140. )
  141. </insert>
  142. <update id="update" parameterType="com.kmall.api.entity.OrderGoodsVo">
  143. update mall_order_goods
  144. <set>
  145. <if test="order_id != null">`order_id` = #{order_id},</if>
  146. <if test="goods_id != null">`goods_id` = #{goods_id},</if>
  147. <if test="goods_name != null">`goods_name` = #{goods_name},</if>
  148. <if test="goods_sn != null">`goods_sn` = #{goods_sn},</if>
  149. <if test="product_id != null">`product_id` = #{product_id},</if>
  150. <if test="number != null">`number` = #{number},</if>
  151. <if test="market_price != null">`market_price` = #{market_price},</if>
  152. <if test="retail_price != null">`retail_price` = #{retail_price},</if>
  153. <if test="goods_specification_name_value != null">`goods_specification_name_value` =
  154. #{goods_specification_name_value},
  155. </if>
  156. <if test="is_real != null">`is_real` = #{is_real},</if>
  157. <if test="goods_specification_ids != null">`goods_specification_ids` = #{goods_specification_ids},</if>
  158. <if test="list_pic_url != null">`list_pic_url` = #{list_pic_url},</if>
  159. <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
  160. <if test="settlePrice != null">`settle_price` = #{settlePrice},</if>
  161. <if test="storeTopicId != null">`store_topic_id` = #{storeTopicId},</if>
  162. <if test="sku != null" >
  163. sku = #{sku,jdbcType=VARCHAR},
  164. </if>
  165. <if test="orderBizType != null" >
  166. order_biz_type = #{orderBizType,jdbcType=CHAR},
  167. </if>
  168. <if test="createrSn != null" >
  169. creater_sn = #{createrSn,jdbcType=VARCHAR},
  170. </if>
  171. <if test="createTime != null" >
  172. create_time = #{createTime,jdbcType=TIMESTAMP},
  173. </if>
  174. <if test="moderSn != null" >
  175. moder_sn = #{moderSn,jdbcType=VARCHAR},
  176. </if>
  177. <if test="modTime != null" >
  178. mod_time = #{modTime,jdbcType=TIMESTAMP}
  179. </if>
  180. </set>
  181. where id = #{id}
  182. </update>
  183. <delete id="delete">
  184. delete from mall_order_goods where id = #{value}
  185. </delete>
  186. <delete id="deleteBatch">
  187. delete from mall_order_goods where id in
  188. <foreach item="id" collection="array" open="(" separator="," close=")">
  189. #{id}
  190. </foreach>
  191. </delete>
  192. <select id="queryListByIds" resultMap="orderGoodsMap">
  193. select a.*
  194. from mall_order_goods a
  195. where a.order_id in
  196. <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
  197. #{orderId}
  198. </foreach>
  199. </select>
  200. </mapper>