ShOrderMapper.xml 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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.minpay.db.table.own.mapper.ShOrderMapper">
  4. <select id="queryOrder" resultType="hashmap" parameterType="java.lang.String">
  5. select
  6. VOI_ID "id",
  7. VOI_CHANNEL "channel",
  8. VOI_PERSON_ID "personId",
  9. VOI_EQUIPMENT_ID "equipmentId",
  10. VOI_ORDER_AMT "orderAmt",
  11. VOI_STATE "state",
  12. VOI_RECORD_ID "recordId",
  13. VOI_PAY_ORDERNO "payOrderno",
  14. VOI_REMARKS "remarks",
  15. VOI_PAY_TYPE "payType",
  16. VOI_NUMBER "number",
  17. VOI_PRO_TYPE "proType",
  18. VOI_IS_DRAW "isDraw",
  19. VOI_IS_USED "isUsed",
  20. VOI_PRO_STATE "proState",
  21. VOI_DRAW_PRICE "drawPrice",
  22. VOI_CREATE_USER "createUser",
  23. VOI_CREATE_TIME "createTime",
  24. VOI_MODIFY_USER "modifyUser",
  25. VOI_MODIFY_TIME "modifyTime",
  26. VOI_BRANCHID "branchid",
  27. VOI_PAY_MODE "payMode",
  28. (SELECT GROUP_CONCAT(VOD_PRO_NAME) FROM vm_order_details w WHERE a.VOI_ID= w.VOD_ORDER_ID GROUP BY w.VOD_ORDER_ID) "productName",
  29. VOI_PICKUP_NO "pickupNo",
  30. VOI_PICKUP_STT "pickupStt",
  31. b.VCI_NAME "personName",
  32. c.VEQ_NAME "equipmentName"
  33. FROM
  34. vm_order_inf a LEFT JOIN vm_person_inf b on a.VOI_PERSON_ID = b.VCI_ID
  35. LEFT JOIN vm_equipment_inf c on a.VOI_EQUIPMENT_ID = c.VEQ_ID
  36. WHERE 1=1 and a.VOI_OPERATION = '0'
  37. <if test="dates!=null and dates != ''">
  38. and substr(a.VOI_CREATE_TIME,1,8) between substr((#{dates,jdbcType=VARCHAR}),1,8)
  39. and substr((#{dates,jdbcType=VARCHAR}),12,19)
  40. </if>
  41. <if test="equipmentId != null and equipmentId != ''">
  42. and a.VOI_EQUIPMENT_ID = #{equipmentId,jdbcType=VARCHAR}
  43. </if>
  44. <if test="equipmentName != null and equipmentName != ''">
  45. and c.VEQ_NAME like CONCAT('%', #{equipmentName,jdbcType=VARCHAR}, '%')
  46. </if>
  47. <if test="freightwayId != null and freightwayId != ''">
  48. and a.VOI_EQUREL_ID = #{freightwayId,jdbcType=VARCHAR}
  49. </if>
  50. <if test="payMode != null and payMode != ''">
  51. and a.VOI_PAY_MODE = #{payMode,jdbcType=VARCHAR}
  52. </if>
  53. <if test="playerId != null and playerId != ''">
  54. and a.VOI_PERSON_ID = #{playerId,jdbcType=VARCHAR}
  55. </if>
  56. <if test="state != null and state != ''">
  57. and a.VOI_IS_DRAW = #{state,jdbcType=VARCHAR}
  58. </if>
  59. <if test="orderNo != null and orderNo != ''">
  60. and a.VOI_ID = #{orderNo,jdbcType=VARCHAR}
  61. </if>
  62. <if test="branchId != null and branchId != ''">
  63. and a.VOI_BRANCHID = #{branchId,jdbcType=VARCHAR}
  64. </if>
  65. order by a.VOI_CREATE_TIME desc
  66. </select>
  67. <select id="queryOrderStatistics" resultType="hashmap" parameterType="java.lang.String">
  68. select
  69. count(1) number,
  70. sum(VOI_ORDER_AMT) sumAmt
  71. FROM
  72. vm_order_inf a LEFT JOIN vm_person_inf b on a.VOI_PERSON_ID = b.VCI_ID
  73. LEFT JOIN vm_equipment_inf c on a.VOI_EQUIPMENT_ID = c.VEQ_ID
  74. WHERE 1=1 and a.VOI_OPERATION = '0'
  75. <if test="dates!=null and dates != ''">
  76. and substr(a.VOI_CREATE_TIME,1,8) between substr((#{dates,jdbcType=VARCHAR}),1,8)
  77. and substr((#{dates,jdbcType=VARCHAR}),12,19)
  78. </if>
  79. <if test="equipmentId != null and equipmentId != ''">
  80. and a.VOI_EQUIPMENT_ID = #{equipmentId,jdbcType=VARCHAR}
  81. </if>
  82. <if test="equipmentName != null and equipmentName != ''">
  83. and c.VEQ_NAME like CONCAT('%', #{equipmentName,jdbcType=VARCHAR}, '%')
  84. </if>
  85. <!--<if test="freightwayId != null and freightwayId != ''">
  86. and a.VOI_EQUREL_ID = #{freightwayId,jdbcType=VARCHAR}
  87. </if>-->
  88. <if test="payMode != null and payMode != ''">
  89. and a.VOI_PAY_MODE = #{payMode,jdbcType=VARCHAR}
  90. </if>
  91. <if test="playerId != null and playerId != ''">
  92. and a.VOI_PERSON_ID = #{playerId,jdbcType=VARCHAR}
  93. </if>
  94. <if test="state != null and state != ''">
  95. and a.VOI_IS_DRAW = #{state,jdbcType=VARCHAR}
  96. </if>
  97. <if test="orderNo != null and orderNo != ''">
  98. and a.VOI_ID = #{orderNo,jdbcType=VARCHAR}
  99. </if>
  100. <if test="branchId != null and branchId != ''">
  101. and a.VOI_BRANCHID = #{branchId,jdbcType=VARCHAR}
  102. </if>
  103. order by a.VOI_CREATE_TIME desc
  104. </select>
  105. <select id="queryOrderStatisticsNew" resultType="hashmap" parameterType="java.lang.String">
  106. SELECT
  107. count(1) number,
  108. IFNULL(ROUND(SUM(d.VOD_AMOUNT),2) , 0) sumAmt
  109. FROM vm_order_details d LEFT JOIN vm_order_inf a ON d.VOD_ORDER_ID = a.VOI_ID
  110. LEFT JOIN vm_equipment_inf c ON a.VOI_EQUIPMENT_ID = c.VEQ_ID
  111. LEFT JOIN vm_person_inf b ON a.VOI_PERSON_ID = b.VCI_ID
  112. LEFT JOIN vm_pro_equ_rel e ON d.VOD_PRO_EQU_REL_ID = e.VCI_ID
  113. WHERE 1=1 and a.VOI_OPERATION = '0'
  114. <if test="dates!=null and dates != ''">
  115. and substr(d.VOD_CREATE_TIME,1,8) between substr((#{dates,jdbcType=VARCHAR}),1,8)
  116. and substr((#{dates,jdbcType=VARCHAR}),12,19)
  117. </if>
  118. <if test="equipmentId != null and equipmentId != ''">
  119. and c.VEQ_IMEI_ADDR = #{equipmentId,jdbcType=VARCHAR}
  120. </if>
  121. <if test="equipmentName != null and equipmentName != ''">
  122. and c.VEQ_NAME like CONCAT('%', #{equipmentName,jdbcType=VARCHAR}, '%')
  123. </if>
  124. <if test="freightwayId != null and freightwayId != ''">
  125. and e.VCI_AISLE = #{freightwayId,jdbcType=VARCHAR}
  126. </if>
  127. <if test="payMode != null and payMode != ''">
  128. and a.VOI_PAY_MODE = #{payMode,jdbcType=VARCHAR}
  129. </if>
  130. <if test="playerId != null and playerId != ''">
  131. and a.VOI_PERSON_ID = #{playerId,jdbcType=VARCHAR}
  132. </if>
  133. <if test="state != null and state != ''">
  134. and a.VOI_STATE = #{state,jdbcType=VARCHAR}
  135. </if>
  136. <if test="playerName != null and playerName != ''">
  137. and b.VCI_NAME = #{playerName,jdbcType=VARCHAR}
  138. </if>
  139. <if test="isDraw != null and isDraw != ''">
  140. and d.VOD_IS_WINNING = #{isDraw,jdbcType=VARCHAR}
  141. </if>
  142. <if test="orderNo != null and orderNo != ''">
  143. and d.VOD_DETAILS_ID = #{orderNo,jdbcType=VARCHAR}
  144. </if>
  145. <if test="productName != null and productName != ''">
  146. and d.VOD_PRO_NAME like CONCAT('%', #{productName,jdbcType=VARCHAR}, '%')
  147. </if>
  148. <if test="gameRule != null and gameRule != ''">
  149. and a.VOI_GAME_RULE = #{gameRule,jdbcType=VARCHAR}
  150. </if>
  151. <if test="pickupStt != null and pickupStt != ''">
  152. and d.VOD_IS_DELIVERY = #{pickupStt,jdbcType=VARCHAR}
  153. </if>
  154. <if test="deliveryId != null and deliveryId != ''">
  155. and d.VOD_DELIVERY_ID = #{deliveryId,jdbcType=VARCHAR}
  156. </if>
  157. <if test="branchId != null and branchId != ''">
  158. and a.VOI_BRANCHID = #{branchId,jdbcType=VARCHAR}
  159. </if>
  160. <if test="openId != null and openId != ''">
  161. and b.VCI_OPENID = #{openId,jdbcType=VARCHAR}
  162. </if>
  163. order by d.VOD_CREATE_TIME desc
  164. </select>
  165. <select id="queryOrderNew" resultType="hashmap" parameterType="java.lang.String">
  166. SELECT
  167. d.VOD_DETAILS_ID "id",
  168. d.VOD_DELIVERY_ID "deliveryId",
  169. d.VOD_CREATE_TIME "createTime",
  170. a.VOI_EQUIPMENT_ID "equipmentId",
  171. c.VEQ_IMEI_ADDR "imeiAddr",
  172. d.VOD_PRO_NAME "productName",
  173. d.VOD_AMOUNT "orderAmt",
  174. e.VCI_AISLE "aisle",
  175. e.VCI_COST_PRICE "costPrice",
  176. a.VOI_STATE "state",
  177. a.VOI_PAY_MODE "payMode",
  178. a.VOI_GAME_RULE "gameRule",
  179. d.VOD_IS_DELIVERY "pickupStt",
  180. b.VCI_NAME "personName",
  181. b.VCI_OPENID "openId",
  182. d.VOD_IS_WINNING "isDraw"
  183. FROM vm_order_details d LEFT JOIN vm_order_inf a ON d.VOD_ORDER_ID = a.VOI_ID
  184. LEFT JOIN vm_equipment_inf c ON a.VOI_EQUIPMENT_ID = c.VEQ_ID
  185. LEFT JOIN vm_person_inf b ON a.VOI_PERSON_ID = b.VCI_ID
  186. LEFT JOIN vm_pro_equ_rel e ON d.VOD_PRO_EQU_REL_ID = e.VCI_ID
  187. WHERE 1=1 and a.VOI_OPERATION = '0'
  188. <if test="dates!=null and dates != ''">
  189. and substr(d.VOD_CREATE_TIME,1,8) between substr((#{dates,jdbcType=VARCHAR}),1,8)
  190. and substr((#{dates,jdbcType=VARCHAR}),12,19)
  191. </if>
  192. <if test="equipmentId != null and equipmentId != ''">
  193. and c.VEQ_IMEI_ADDR = #{equipmentId,jdbcType=VARCHAR}
  194. </if>
  195. <if test="equipmentName != null and equipmentName != ''">
  196. and c.VEQ_NAME like CONCAT('%', #{equipmentName,jdbcType=VARCHAR}, '%')
  197. </if>
  198. <if test="freightwayId != null and freightwayId != ''">
  199. and e.VCI_AISLE = #{freightwayId,jdbcType=VARCHAR}
  200. </if>
  201. <if test="payMode != null and payMode != ''">
  202. and a.VOI_PAY_MODE = #{payMode,jdbcType=VARCHAR}
  203. </if>
  204. <if test="playerId != null and playerId != ''">
  205. and a.VOI_PERSON_ID = #{playerId,jdbcType=VARCHAR}
  206. </if>
  207. <if test="state != null and state != ''">
  208. and a.VOI_STATE = #{state,jdbcType=VARCHAR}
  209. </if>
  210. <if test="playerName != null and playerName != ''">
  211. and b.VCI_NAME = #{playerName,jdbcType=VARCHAR}
  212. </if>
  213. <if test="isDraw != null and isDraw != ''">
  214. and d.VOD_IS_WINNING = #{isDraw,jdbcType=VARCHAR}
  215. </if>
  216. <if test="orderNo != null and orderNo != ''">
  217. and d.VOD_DETAILS_ID like CONCAT('%', #{orderNo,jdbcType=VARCHAR}, '%')
  218. </if>
  219. <if test="productName != null and productName != ''">
  220. and d.VOD_PRO_NAME like CONCAT('%', #{productName,jdbcType=VARCHAR}, '%')
  221. </if>
  222. <if test="gameRule != null and gameRule != ''">
  223. and a.VOI_GAME_RULE = #{gameRule,jdbcType=VARCHAR}
  224. </if>
  225. <if test="pickupStt != null and pickupStt != ''">
  226. and d.VOD_IS_DELIVERY = #{pickupStt,jdbcType=VARCHAR}
  227. </if>
  228. <if test="deliveryId != null and deliveryId != ''">
  229. and d.VOD_DELIVERY_ID = #{deliveryId,jdbcType=VARCHAR}
  230. </if>
  231. <if test="branchId != null and branchId != ''">
  232. and a.VOI_BRANCHID = #{branchId,jdbcType=VARCHAR}
  233. </if>
  234. <if test="openId != null and openId != ''">
  235. and b.VCI_OPENID = #{openId,jdbcType=VARCHAR}
  236. </if>
  237. order by d.VOD_CREATE_TIME desc
  238. </select>
  239. </mapper>