FsIntegralOrderMapper.xml 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.fs.his.mapper.FsIntegralOrderMapper">
  6. <resultMap type="FsIntegralOrder" id="FsIntegralOrderResult">
  7. <result property="orderId" column="order_id" />
  8. <result property="orderCode" column="order_code" />
  9. <result property="userId" column="user_id" />
  10. <result property="userName" column="user_name" />
  11. <result property="userPhone" column="user_phone" />
  12. <result property="userAddress" column="user_address" />
  13. <result property="itemJson" column="item_json" />
  14. <result property="integral" column="integral" />
  15. <result property="totalIntegral" column="total_integral" />
  16. <result property="discountIntegral" column="discount_integral" />
  17. <result property="totalMoney" column="total_money" />
  18. <result property="discountMoney" column="discount_money" />
  19. <result property="payMoney" column="pay_money" />
  20. <result property="userCouponId" column="user_coupon_id" />
  21. <result property="isPay" column="is_pay" />
  22. <result property="payTime" column="pay_time" />
  23. <result property="payType" column="pay_type" />
  24. <result property="status" column="status" />
  25. <result property="deliveryCode" column="delivery_code" />
  26. <result property="deliveryName" column="delivery_name" />
  27. <result property="deliverySn" column="delivery_sn" />
  28. <result property="deliveryTime" column="delivery_time" />
  29. <result property="createTime" column="create_time" />
  30. <result property="remark" column="remark" />
  31. <result property="barCode" column="bar_code" />
  32. <result property="loginAccount" column="login_account" />
  33. </resultMap>
  34. <sql id="selectFsIntegralOrderVo">
  35. select * from fs_integral_order
  36. </sql>
  37. <select id="selectFsIntegralOrderList" parameterType="FsIntegralOrder" resultMap="FsIntegralOrderResult">
  38. <include refid="selectFsIntegralOrderVo"/>
  39. <where>
  40. <if test="orderCode != null and orderCode != ''"> and order_code = #{orderCode}</if>
  41. <if test="userName != null and userName != ''"> and user_name like concat('%', #{userName}, '%')</if>
  42. <if test="userPhone != null and userPhone != ''"> and user_phone = #{userPhone}</if>
  43. <if test="integral != null and integral != ''"> and integral = #{integral}</if>
  44. <if test="totalIntegral != null and totalIntegral != ''"> and total_integral = #{totalIntegral}</if>
  45. <if test="discountIntegral != null and discountIntegral != ''"> and discount_integral = #{discountIntegral}</if>
  46. <if test="totalMoney != null and totalMoney != ''"> and total_money = #{totalMoney}</if>
  47. <if test="discountMoney != null and discountMoney != ''"> and discount_money = #{discountMoney}</if>
  48. <if test="payMoney != null and payMoney != ''"> and pay_money = #{payMoney}</if>
  49. <if test="userCouponId != null and userCouponId != ''"> and user_coupon_id = #{userCouponId}</if>
  50. <if test="isPay != null and isPay != ''"> and is_pay = #{isPay}</if>
  51. <if test="payTime != null and payTime != ''"> and pay_time = #{payTime}</if>
  52. <if test="payType != null and payType != ''"> and pay_type = #{payType}</if>
  53. <if test="status != null and status != ''"> and status = #{status}</if>
  54. <if test="deliverySn != null and deliverySn != ''"> and delivery_sn like concat('%', #{deliverySn}, '%')</if>
  55. <if test="qwUserId != null and qwUserId != ''"> and qw_user_id = #{qwUserId}</if>
  56. <if test="companyUserId != null and companyUserId != ''"> and company_user_id = #{companyUserId}</if>
  57. <if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
  58. <if test="createTime != null "> and create_time = #{createTime}</if>
  59. <if test="userIds != null and !userIds.isEmpty()"> and user_id in
  60. <foreach item="item" index="index" collection="userIds" separator="," open="(" close=")">
  61. #{item}
  62. </foreach>
  63. </if>
  64. </where>
  65. </select>
  66. <select id="selectFsIntegralOrderByOrderId" parameterType="Long" resultMap="FsIntegralOrderResult">
  67. <include refid="selectFsIntegralOrderVo"/>
  68. where order_id = #{orderId}
  69. </select>
  70. <insert id="insertFsIntegralOrder" parameterType="FsIntegralOrder" useGeneratedKeys="true" keyProperty="orderId">
  71. insert into fs_integral_order
  72. <trim prefix="(" suffix=")" suffixOverrides=",">
  73. <if test="orderCode != null">order_code,</if>
  74. <if test="userId != null">user_id,</if>
  75. <if test="userName != null">user_name,</if>
  76. <if test="userPhone != null">user_phone,</if>
  77. <if test="userAddress != null">user_address,</if>
  78. <if test="itemJson != null">item_json,</if>
  79. <if test="integral != null">integral,</if>
  80. <if test="totalIntegral != null">total_integral,</if>
  81. <if test="discountIntegral != null">discount_integral,</if>
  82. <if test="totalMoney != null">total_money,</if>
  83. <if test="discountMoney != null">discount_money,</if>
  84. <if test="payMoney != null">pay_money,</if>
  85. <if test="userCouponId != null">user_coupon_id,</if>
  86. <if test="isPay != null">is_pay,</if>
  87. <if test="payTime != null">pay_time,</if>
  88. <if test="payType != null">pay_type,</if>
  89. <if test="status != null and status != ''">status,</if>
  90. <if test="deliveryCode != null">delivery_code,</if>
  91. <if test="deliveryName != null">delivery_name,</if>
  92. <if test="deliverySn != null">delivery_sn,</if>
  93. <if test="deliveryTime != null">delivery_time,</if>
  94. <if test="createTime != null">create_time,</if>
  95. <if test="remark != null">remark,</if>
  96. <if test="barCode != null">bar_code,</if>
  97. <if test="qwUserId != null">qw_user_id,</if>
  98. <if test="companyUserId != null">company_user_id,</if>
  99. <if test="companyId != null">company_id,</if>
  100. </trim>
  101. <trim prefix="values (" suffix=")" suffixOverrides=",">
  102. <if test="orderId != null">#{orderId},</if>
  103. <if test="orderCode != null">#{orderCode},</if>
  104. <if test="userId != null">#{userId},</if>
  105. <if test="userName != null">#{userName},</if>
  106. <if test="userPhone != null">#{userPhone},</if>
  107. <if test="userAddress != null">#{userAddress},</if>
  108. <if test="itemJson != null">#{itemJson},</if>
  109. <if test="integral != null">#{integral},</if>
  110. <if test="payMoney != null">#{payMoney},</if>
  111. <if test="isPay != null">#{isPay},</if>
  112. <if test="payTime != null">#{payTime},</if>
  113. <if test="payType != null">#{payType},</if>
  114. <if test="status != null and status != ''">#{status},</if>
  115. <if test="deliveryCode != null">#{deliveryCode},</if>
  116. <if test="deliveryName != null">#{deliveryName},</if>
  117. <if test="deliverySn != null">#{deliverySn},</if>
  118. <if test="deliveryTime != null">#{deliveryTime},</if>
  119. <if test="createTime != null">#{createTime},</if>
  120. <if test="remark != null">#{remark},</if>
  121. <if test="barCode != null">#{barCode},</if>
  122. <if test="qwUserId != null">#{qwUserId},</if>
  123. <if test="companyUserId != null">#{companyUserId},</if>
  124. <if test="companyId != null">#{companyId},</if>
  125. </trim>
  126. </insert>
  127. <update id="updateFsIntegralOrder" parameterType="FsIntegralOrder">
  128. update fs_integral_order
  129. <trim prefix="SET" suffixOverrides=",">
  130. <if test="orderCode != null">order_code = #{orderCode},</if>
  131. <if test="userId != null">user_id = #{userId},</if>
  132. <if test="userName != null">user_name = #{userName},</if>
  133. <if test="userPhone != null">user_phone = #{userPhone},</if>
  134. <if test="userAddress != null">user_address = #{userAddress},</if>
  135. <if test="itemJson != null">item_json = #{itemJson},</if>
  136. <if test="integral != null">integral = #{integral},</if>
  137. <if test="totalIntegral != null">total_integral = #{totalIntegral},</if>
  138. <if test="discountIntegral != null">discount_integral = #{discountIntegral},</if>
  139. <if test="totalMoney != null">total_money = #{totalMoney},</if>
  140. <if test="discountMoney != null">discount_money = #{discountMoney},</if>
  141. <if test="payMoney != null">pay_money = #{payMoney},</if>
  142. <if test="userCouponId != null">user_coupon_id = #{userCouponId},</if>
  143. <if test="isPay != null">is_pay = #{isPay},</if>
  144. <if test="payTime != null">pay_time = #{payTime},</if>
  145. <if test="payType != null">pay_type = #{payType},</if>
  146. <if test="status != null and status != ''">status = #{status},</if>
  147. <if test="deliveryCode != null">delivery_code = #{deliveryCode},</if>
  148. <if test="deliveryName != null">delivery_name = #{deliveryName},</if>
  149. <if test="deliverySn != null">delivery_sn = #{deliverySn},</if>
  150. <if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
  151. <if test="createTime != null">create_time = #{createTime},</if>
  152. <if test="remark != null">remark = #{remark},</if>
  153. <if test="barCode != null">bar_code = #{barCode},</if>
  154. <if test="loginAccount != '' and loginAccount != null">login_account = #{loginAccount},</if>
  155. <if test="extendOrderId != null">extend_order_id = #{extendOrderId},</if>
  156. </trim>
  157. where order_id = #{orderId}
  158. </update>
  159. <delete id="deleteFsIntegralOrderByOrderId" parameterType="Long">
  160. delete from fs_integral_order where order_id = #{orderId}
  161. </delete>
  162. <delete id="deleteFsIntegralOrderByOrderIds" parameterType="String">
  163. delete from fs_integral_order where order_id in
  164. <foreach item="orderId" collection="array" open="(" separator="," close=")">
  165. #{orderId}
  166. </foreach>
  167. </delete>
  168. <update id="cancelOrder" parameterType="FsIntegralOrder">
  169. update fs_integral_order set status = -1
  170. where order_id = #{orderId}
  171. </update>
  172. <update id="finishOrder">
  173. UPDATE fs_integral_order
  174. SET status = 3
  175. WHERE order_id = #{orderId}
  176. AND status = #{oldStatus}
  177. </update>
  178. </mapper>