1
0

OrdersIssueMapper.xml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.fuzamei.mapperInterface.OrdersIssueMapper">
  4. <select id="queryOrdersByPlanner" parameterType="Param" resultType="IssueOrder">
  5. select
  6. o.order_id,
  7. u.person_name as supplier_name,
  8. o.part_no,
  9. o.box_no,
  10. o.inbox_qty,
  11. o.require_time,
  12. o.update_time,
  13. s.status_name
  14. from
  15. orders o
  16. left join
  17. status s
  18. on
  19. o.status_id=s.status_id
  20. left join
  21. users u
  22. on
  23. o.supplier_id=u.user_id
  24. <where>
  25. o.planner_id=#{userId}
  26. <if test="supplierName!=null">
  27. and u.person_name=#{supplierName}
  28. </if>
  29. <if test="boxNo!=null">
  30. and o.box_no=#{boxNo}
  31. </if>
  32. <if test="startTime!=null and endTime!=null">
  33. and o.require_time between #{startTime} and #{endTime}
  34. </if>
  35. </where>
  36. order by o.require_time desc
  37. limit #{startPage},#{rowNum}
  38. </select>
  39. <select id="findQueryCountByPlanner" parameterType="Param" resultType="int">
  40. select
  41. count(*)
  42. from
  43. (select
  44. o.order_id,
  45. u.person_name as supplier_name,
  46. o.part_no,
  47. o.box_no,
  48. o.inbox_qty,
  49. o.require_time,
  50. o.update_time
  51. from
  52. orders o
  53. left join
  54. users u
  55. on
  56. o.supplier_id=u.user_id
  57. <where>
  58. o.planner_id=#{userId}
  59. <if test="supplierName!=null">
  60. and u.person_name=#{supplierName}
  61. </if>
  62. <if test="boxNo!=null">
  63. and o.box_no=#{boxNo}
  64. </if>
  65. <if test="startTime!=null and endTime!=null">
  66. and o.require_time between #{startTime} and #{endTime}
  67. </if>
  68. </where>) temp
  69. </select>
  70. <select id="queryOrdersBySupplier" parameterType="Param" resultType="IssueOrder">
  71. select
  72. o.order_id,
  73. o.part_no,
  74. o.box_no,
  75. o.inbox_qty,
  76. o.require_time,
  77. o.update_time,
  78. s.status_name
  79. from
  80. orders o
  81. left join
  82. status s
  83. on
  84. o.status_id=s.status_id
  85. <where>
  86. o.supplier_id=#{userId}
  87. <if test="orderId!=null">
  88. and o.order_id=#{orderId}
  89. </if>
  90. <if test="boxNo!=null">
  91. and o.box_no=#{boxNo}
  92. </if>
  93. <if test="statusId!=null">
  94. and o.status_id=#{statusId}
  95. </if>
  96. <if test="startTime!=null and endTime!=null">
  97. and o.require_time between #{startTime} and #{endTime}
  98. </if>
  99. </where>
  100. order by o.require_time desc
  101. limit #{startPage},#{rowNum}
  102. </select>
  103. <select id="findQueryCountBySupplier" parameterType="Param" resultType="int">
  104. select
  105. count(*)
  106. from
  107. orders
  108. <where>
  109. supplier_id=#{userId}
  110. <if test="orderId!=null">
  111. and order_id=#{orderId}
  112. </if>
  113. <if test="boxNo!=null">
  114. and box_no=#{boxNo}
  115. </if>
  116. <if test="statusId!=null">
  117. and status_id=#{statusId}
  118. </if>
  119. <if test="startTime!=null and endTime!=null">
  120. and require_time between #{startTime} and #{endTime}
  121. </if>
  122. </where>
  123. </select>
  124. <update id="consignment">
  125. update
  126. orders
  127. set
  128. send_time=#{sendTime},
  129. carrier_id=#{carrierId},
  130. status_id=#{statusId},
  131. update_time=#{updateTime}
  132. where
  133. order_id=#{orderId}
  134. </update>
  135. <!-- 插入新订单 -->
  136. <insert id="addOrder">
  137. insert into
  138. orders(order_id,
  139. part_no,
  140. box_no,
  141. box_qty,
  142. inbox_qty,
  143. require_time,
  144. create_time,
  145. update_time,
  146. status_id,
  147. planner_id,
  148. supplier_id)
  149. values(#{orderId},
  150. #{partNo},
  151. #{boxNo},
  152. #{boxQty},
  153. #{inboxQty},
  154. #{requireTime},
  155. #{createTime},
  156. #{updateTime},
  157. #{statusId},
  158. #{plannerId},
  159. #{supplierId})
  160. </insert>
  161. </mapper>