OfflineCartDao.xml 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  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.admin.dao.OfflineCartDao">
  4. <resultMap type="com.kmall.admin.entity.OfflineCartEntity" id="offlineCartMap">
  5. <result property="id" column="id"/>
  6. <result property="userId" column="user_id"/>
  7. <result property="goodsId" column="goods_id"/>
  8. <result property="sku" column="sku"/>
  9. <result property="goodsSn" column="goods_sn"/>
  10. <result property="productId" column="product_id"/>
  11. <result property="prodBarcode" column="prod_barcode"/>
  12. <result property="goodsName" column="goods_name"/>
  13. <result property="marketPrice" column="market_price"/>
  14. <result property="retailPrice" column="retail_price"/>
  15. <result property="number" column="number"/>
  16. <result property="stockNum" column="stock_num"/>
  17. <result property="listPicUrl" column="list_pic_url"/>
  18. <result property="storeId" column="store_id"/>
  19. <result property="createrSn" column="creater_sn"/>
  20. <result property="createTime" column="create_time"/>
  21. <result property="moderSn" column="moder_sn"/>
  22. <result property="modTime" column="mod_time"/>
  23. <result property="tstm" column="tstm"/>
  24. </resultMap>
  25. <select id="queryObjectByGoodsIdAndType" resultType="com.kmall.admin.entity.OfflineCartEntity">
  26. select * from offline_cart where goods_id = #{goodsId} and user_id = #{userId}
  27. </select>
  28. <select id="queryOfflineCartByBizType" resultMap="offlineCartMap">
  29. select a.* ,s.store_name
  30. from offline_cart a
  31. inner join mall_store s on a.store_id=s.id
  32. where 1=1
  33. <if test="userId != null">
  34. AND a.user_id = #{userId}
  35. </if>
  36. <if test="storeId != null">
  37. AND a.store_id = #{storeId}
  38. </if>
  39. </select>
  40. <select id="queryObject" resultType="com.kmall.admin.entity.OfflineCartEntity">
  41. select
  42. `id`,
  43. `user_id`,
  44. `goods_id`,
  45. `sku`,
  46. `goods_sn`,
  47. `product_id`,
  48. `goods_name`,
  49. `market_price`,
  50. `retail_price`,
  51. `number`,
  52. `stock_num`,
  53. `list_pic_url`,
  54. `store_id`,
  55. prod_barcode,
  56. `creater_sn`,
  57. `create_time`,
  58. `moder_sn`,
  59. `mod_time`,
  60. `tstm`
  61. from offline_cart
  62. where id = #{id}
  63. </select>
  64. <select id="queryList" resultType="com.kmall.admin.entity.OfflineCartEntity">
  65. select
  66. `id`,
  67. `user_id`,
  68. `goods_id`,
  69. `sku`,
  70. `goods_sn`,
  71. `product_id`,
  72. `goods_name`,
  73. `market_price`,
  74. `retail_price`,
  75. `number`,
  76. `stock_num`,
  77. `list_pic_url`,
  78. `store_id`,
  79. prod_barcode,
  80. `creater_sn`,
  81. `create_time`,
  82. `moder_sn`,
  83. `mod_time`,
  84. `tstm`
  85. from offline_cart
  86. WHERE 1=1
  87. <if test="name != null and name.trim() != ''">
  88. AND name LIKE concat('%',#{name},'%')
  89. </if>
  90. <choose>
  91. <when test="sidx != null and sidx.trim() != ''">
  92. order by ${sidx} ${order}
  93. </when>
  94. <otherwise>
  95. order by id desc
  96. </otherwise>
  97. </choose>
  98. <if test="offset != null and limit != null">
  99. limit #{offset}, #{limit}
  100. </if>
  101. </select>
  102. <select id="queryTotal" resultType="int">
  103. select count(*) from offline_cart
  104. WHERE 1=1
  105. <if test="name != null and name.trim() != ''">
  106. AND name LIKE concat('%',#{name},'%')
  107. </if>
  108. </select>
  109. <insert id="save" parameterType="com.kmall.admin.entity.OfflineCartEntity" useGeneratedKeys="true" keyProperty="id">
  110. insert into offline_cart(
  111. `user_id`,
  112. `goods_id`,
  113. `sku`,
  114. `goods_sn`,
  115. `product_id`,
  116. `prod_barcode`,
  117. `goods_name`,
  118. `market_price`,
  119. `retail_price`,
  120. `number`,
  121. `stock_num`,
  122. `list_pic_url`,
  123. `store_id`,
  124. `creater_sn`,
  125. `create_time`,
  126. `moder_sn`,
  127. `mod_time`,
  128. `tstm`)
  129. values(
  130. #{userId},
  131. #{goodsId},
  132. #{sku},
  133. #{goodsSn},
  134. #{productId},
  135. #{prodBarcode},
  136. #{goodsName},
  137. #{marketPrice},
  138. #{retailPrice},
  139. #{number},
  140. #{stockNum},
  141. #{listPicUrl},
  142. #{storeId},
  143. #{createrSn},
  144. #{createTime},
  145. #{moderSn},
  146. #{modTime},
  147. #{tstm})
  148. </insert>
  149. <update id="update" parameterType="com.kmall.admin.entity.OfflineCartEntity">
  150. update offline_cart
  151. <set>
  152. <if test="userId != null">`user_id` = #{userId}, </if>
  153. <if test="goodsId != null">`goods_id` = #{goodsId}, </if>
  154. <if test="sku != null">`sku` = #{sku}, </if>
  155. <if test="goodsSn != null">`goods_sn` = #{goodsSn}, </if>
  156. <if test="productId != null">`product_id` = #{productId}, </if>
  157. <if test="prodBarcode != null">`prod_barcode` = #{prodBarcode}, </if>
  158. <if test="goodsName != null">`goods_name` = #{goodsName}, </if>
  159. <if test="marketPrice != null">`market_price` = #{marketPrice}, </if>
  160. <if test="retailPrice != null">`retail_price` = #{retailPrice}, </if>
  161. <if test="number != null">`number` = #{number}, </if>
  162. <if test="stockNum != null">`stock_num` = #{stockNum}, </if>
  163. <if test="listPicUrl != null">`list_pic_url` = #{listPicUrl}, </if>
  164. <if test="storeId != null">`store_id` = #{storeId}, </if>
  165. <if test="createrSn != null">`creater_sn` = #{createrSn}, </if>
  166. <if test="createTime != null">`create_time` = #{createTime}, </if>
  167. <if test="moderSn != null">`moder_sn` = #{moderSn}, </if>
  168. <if test="modTime != null">`mod_time` = #{modTime}, </if>
  169. <if test="tstm != null">`tstm` = #{tstm}</if>
  170. </set>
  171. where id = #{id}
  172. </update>
  173. <delete id="delete">
  174. delete from offline_cart where id = #{value}
  175. </delete>
  176. <delete id="deleteByUserId">
  177. delete from offline_cart where user_id = #{userId}
  178. </delete>
  179. <delete id="deleteBatch">
  180. delete from offline_cart where id in
  181. <foreach item="id" collection="array" open="(" separator="," close=")">
  182. #{id}
  183. </foreach>
  184. </delete>
  185. </mapper>