ApiOrderGoodsMapper.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207
  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. <if test="goodsRate != null" >
  71. goods_rate,
  72. </if>
  73. <if test="settlePrice != null" >
  74. settle_price,
  75. </if>
  76. <if test="sku != null" >
  77. sku,
  78. </if>
  79. <if test="orderBizType != null" >
  80. order_biz_type,
  81. </if>
  82. <if test="createrSn != null" >
  83. creater_sn,
  84. </if>
  85. <if test="createTime != null" >
  86. create_time,
  87. </if>
  88. <if test="moderSn != null" >
  89. moder_sn,
  90. </if>
  91. <if test="modTime != null" >
  92. mod_time
  93. </if>
  94. )
  95. values
  96. (
  97. #{order_id},
  98. #{goods_id},
  99. #{goods_name},
  100. #{goods_sn},
  101. #{product_id},
  102. #{number},
  103. #{market_price},
  104. #{retail_price},
  105. #{goods_specification_name_value},
  106. #{is_real},
  107. #{goods_specification_ids},
  108. #{list_pic_url},
  109. <if test="goodsRate != null" >
  110. #{goodsRate},
  111. </if>
  112. <if test="settlePrice != null" >
  113. #{settlePrice},
  114. </if>
  115. <if test="sku != null" >
  116. #{sku,jdbcType=VARCHAR},
  117. </if>
  118. <if test="orderBizType != null" >
  119. #{orderBizType,jdbcType=VARCHAR},
  120. </if>
  121. <if test="createrSn != null" >
  122. #{createrSn,jdbcType=VARCHAR},
  123. </if>
  124. <if test="createTime != null" >
  125. #{createTime,jdbcType=TIMESTAMP},
  126. </if>
  127. <if test="moderSn != null" >
  128. #{moderSn,jdbcType=VARCHAR},
  129. </if>
  130. <if test="modTime != null" >
  131. #{modTime,jdbcType=TIMESTAMP}
  132. </if>
  133. )
  134. </insert>
  135. <update id="update" parameterType="com.kmall.api.entity.OrderGoodsVo">
  136. update mall_order_goods
  137. <set>
  138. <if test="order_id != null">`order_id` = #{order_id},</if>
  139. <if test="goods_id != null">`goods_id` = #{goods_id},</if>
  140. <if test="goods_name != null">`goods_name` = #{goods_name},</if>
  141. <if test="goods_sn != null">`goods_sn` = #{goods_sn},</if>
  142. <if test="product_id != null">`product_id` = #{product_id},</if>
  143. <if test="number != null">`number` = #{number},</if>
  144. <if test="market_price != null">`market_price` = #{market_price},</if>
  145. <if test="retail_price != null">`retail_price` = #{retail_price},</if>
  146. <if test="goods_specification_name_value != null">`goods_specification_name_value` =
  147. #{goods_specification_name_value},
  148. </if>
  149. <if test="is_real != null">`is_real` = #{is_real},</if>
  150. <if test="goods_specification_ids != null">`goods_specification_ids` = #{goods_specification_ids},</if>
  151. <if test="list_pic_url != null">`list_pic_url` = #{list_pic_url},</if>
  152. <if test="goodsRate != null">`goods_rate` = #{goodsRate},</if>
  153. <if test="settlePrice != null">`settle_price` = #{settlePrice},</if>
  154. <if test="sku != null" >
  155. sku = #{sku,jdbcType=VARCHAR},
  156. </if>
  157. <if test="orderBizType != null" >
  158. order_biz_type = #{orderBizType,jdbcType=CHAR},
  159. </if>
  160. <if test="createrSn != null" >
  161. creater_sn = #{createrSn,jdbcType=VARCHAR},
  162. </if>
  163. <if test="createTime != null" >
  164. create_time = #{createTime,jdbcType=TIMESTAMP},
  165. </if>
  166. <if test="moderSn != null" >
  167. moder_sn = #{moderSn,jdbcType=VARCHAR},
  168. </if>
  169. <if test="modTime != null" >
  170. mod_time = #{modTime,jdbcType=TIMESTAMP}
  171. </if>
  172. </set>
  173. where id = #{id}
  174. </update>
  175. <delete id="delete">
  176. delete from mall_order_goods where id = #{value}
  177. </delete>
  178. <delete id="deleteBatch">
  179. delete from mall_order_goods where id in
  180. <foreach item="id" collection="array" open="(" separator="," close=")">
  181. #{id}
  182. </foreach>
  183. </delete>
  184. <select id="queryListByIds" resultMap="orderGoodsMap">
  185. select a.*
  186. from mall_order_goods a
  187. where a.order_id in
  188. <foreach collection="orderIdList" item="orderId" open="(" close=")" separator=",">
  189. #{orderId}
  190. </foreach>
  191. </select>
  192. </mapper>