猫妈狗爸伴宠师小程序后端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

177 lines
7.4 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  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.ruoyi.model.mapper.AppletOrderMapper">
  6. <resultMap type="AppletOrder" id="AppletOrderResult">
  7. <result property="id" column="id"/>
  8. <result property="createTime" column="create_time"/>
  9. <result property="createBy" column="create_by"/>
  10. <result property="updateTime" column="update_time"/>
  11. <result property="updateBy" column="update_by"/>
  12. <result property="payTime" column="pay_time"/>
  13. <result property="status" column="status"/>
  14. <result property="price" column="price"/>
  15. <result property="address" column="address"/>
  16. <result property="type" column="type"/>
  17. <result property="reason" column="reason"/>
  18. <result property="userId" column="user_id"/>
  19. <result property="petId" column="pet_id"/>
  20. <result property="num" column="num"/>
  21. <result property="userIdJson" column="user_id_json"/>
  22. <result property="orderSn" column="order_sn"/>
  23. <result property="orderId" column="order_id"/>
  24. <result property="orderTime" column="order_time"/>
  25. </resultMap>
  26. <sql id="selectAppletOrderVo">
  27. select id, create_time, create_by, update_time, update_by, pay_time, status, price, address, type, reason, user_id, pet_id,num,user_id_json,order_id,order_sn,order_time from applet_order
  28. </sql>
  29. <select id="selectAppletOrderList" parameterType="AppletOrder" resultMap="AppletOrderResult">
  30. <include refid="selectAppletOrderVo"/>
  31. <where>
  32. <if test="payTime != null "> and pay_time = #{payTime}</if>
  33. <if test="status != null "> and status = #{status}</if>
  34. <if test="price != null "> and price = #{price}</if>
  35. <if test="address != null and address != ''"> and address = #{address}</if>
  36. <if test="type != null and type != ''"> and type = #{type}</if>
  37. <if test="reason != null and reason != ''"> and reason = #{reason}</if>
  38. <if test="userId != null "> and user_id = #{userId}</if>
  39. <if test="petId != null "> and pet_id = #{petId}</if>
  40. <if test="num != null "> and num = #{num}</if>
  41. <if test="userIdJson != null "> and user_id_json = #{userIdJson}</if>
  42. <if test="orderSn != null "> and order_sn = #{orderSn}</if>
  43. <if test="orderId != null "> and order_id = #{orderId}</if>
  44. <if test="orderTime != null "> and order_time = #{orderTime}</if>
  45. </where>
  46. order by create_time desc
  47. </select>
  48. <select id="selectAppletOrderListLikeUserIdJson" parameterType="AppletOrder" resultMap="AppletOrderResult">
  49. <include refid="selectAppletOrderVo"/>
  50. <where>
  51. <!-- 根据具体需求选择方案 -->
  52. <!-- 方案1:自动添加通配符 -->
  53. type = #{type} and status = 0 and user_id_json like concat('%', #{userIdJson}, '%')
  54. <!-- 方案2:使用JSON函数查询(MySQL示例) -->
  55. <!-- JSON_CONTAINS(user_id_json, #{userIdJson}) -->
  56. </where>
  57. order by create_time desc
  58. </select>
  59. <select id="selectAppletOrderById" parameterType="AppletOrder" resultMap="AppletOrderResult">
  60. <include refid="selectAppletOrderVo"/>
  61. where id = #{id}
  62. </select>
  63. <select id="selectAppletOrderByOrderId" parameterType="AppletOrder" resultMap="AppletOrderResult">
  64. <include refid="selectAppletOrderVo"/>
  65. where order_id = #{orderId}
  66. </select>
  67. <insert id="insertAppletOrder" parameterType="AppletOrder" useGeneratedKeys="true" keyProperty="id">
  68. insert into applet_order
  69. <trim prefix="(" suffix=")" suffixOverrides=",">
  70. <if test="id != null">id,</if>
  71. <if test="createTime != null">create_time,</if>
  72. <if test="createBy != null">create_by,</if>
  73. <if test="updateTime != null">update_time,</if>
  74. <if test="updateBy != null">update_by,</if>
  75. <if test="payTime != null">pay_time,</if>
  76. <if test="status != null">status,</if>
  77. <if test="price != null">price,</if>
  78. <if test="address != null">address,</if>
  79. <if test="type != null">type,</if>
  80. <if test="reason != null">reason,</if>
  81. <if test="userId != null">user_id,</if>
  82. <if test="petId != null">pet_id,</if>
  83. <if test="num != null">num,</if>
  84. <if test="userIdJson != null">user_id_json,</if>
  85. <if test="orderSn != null">order_sn,</if>
  86. <if test="orderId != null">order_id,</if>
  87. <if test="orderTime != null">order_time,</if>
  88. </trim>
  89. <trim prefix="values (" suffix=")" suffixOverrides=",">
  90. <if test="id != null">#{id},</if>
  91. <if test="createTime != null">#{createTime},</if>
  92. <if test="createBy != null">#{createBy},</if>
  93. <if test="updateTime != null">#{updateTime},</if>
  94. <if test="updateBy != null">#{updateBy},</if>
  95. <if test="payTime != null">#{payTime},</if>
  96. <if test="status != null">#{status},</if>
  97. <if test="price != null">#{price},</if>
  98. <if test="address != null">#{address},</if>
  99. <if test="type != null">#{type},</if>
  100. <if test="reason != null">#{reason},</if>
  101. <if test="userId != null">#{userId},</if>
  102. <if test="petId != null">#{petId},</if>
  103. <if test="num != null">#{num},</if>
  104. <if test="userIdJson != null">#{userIdJson},</if>
  105. <if test="orderSn != null">#{orderSn},</if>
  106. <if test="orderId != null">#{orderId},</if>
  107. <if test="orderTime != null">#{orderTime},</if>
  108. </trim>
  109. </insert>
  110. <update id="updateAppletOrder" parameterType="AppletOrder">
  111. update applet_order
  112. <trim prefix="SET" suffixOverrides=",">
  113. <if test="createTime != null">create_time = #{createTime},</if>
  114. <if test="createBy != null">create_by = #{createBy},</if>
  115. <if test="updateTime != null">update_time = #{updateTime},</if>
  116. <if test="updateBy != null">update_by = #{updateBy},</if>
  117. <if test="payTime != null">pay_time = #{payTime},</if>
  118. <if test="status != null">status = #{status},</if>
  119. <if test="price != null">price = #{price},</if>
  120. <if test="address != null">address = #{address},</if>
  121. <if test="type != null">type = #{type},</if>
  122. <if test="reason != null">reason = #{reason},</if>
  123. <if test="userId != null">user_id = #{userId},</if>
  124. <if test="petId != null">pet_id = #{petId},</if>
  125. <if test="userIdJson != null">user_id_json = #{userIdJson},</if>
  126. <if test="orderSn != null">order_sn = #{orderSn},</if>
  127. <if test="orderId != null">order_id = #{orderId},</if>
  128. <if test="orderTime != null"> order_time = #{orderTime},</if>
  129. </trim>
  130. where id = #{id}
  131. </update>
  132. <delete id="deleteAppletOrderById" parameterType="Long">
  133. delete from applet_order where id = #{id}
  134. </delete>
  135. <delete id="deleteAppletOrderByIds" parameterType="String">
  136. delete from applet_order where id in
  137. <foreach item="id" collection="array" open="(" separator="," close=")">
  138. #{id}
  139. </foreach>
  140. </delete>
  141. </mapper>