ApiOrderGoodsMapper.xml 7.2 KB

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