ApiOrderGoodsMapper.xml 7.4 KB

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