ApiOrderGoodsMapper.xml 6.4 KB

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