ChargeMachineOrderV1ServiceDaoImplMapper.xml 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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="chargeMachineOrderV1ServiceDaoImpl">
  6. <!-- 保存充电桩订单信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveChargeMachineOrderInfo" parameterType="Map">
  8. insert into charge_machine_order(
  9. amount,order_id,remark,port_id,person_name,machine_id,acct_detail_id,person_id,charge_hours,
  10. start_time,end_time,state,person_tel,community_id,energy,duration_price
  11. ) values (
  12. #{amount},#{orderId},#{remark},#{portId},#{personName},#{machineId},#{acctDetailId},#{personId},#{chargeHours},
  13. #{startTime},#{endTime},#{state},#{personTel},#{communityId},#{energy},#{durationPrice}
  14. )
  15. </insert>
  16. <!-- 查询充电桩订单信息 add by wuxw 2018-07-03 -->
  17. <select id="getChargeMachineOrderInfo" parameterType="Map" resultType="Map">
  18. select t.order_id,t.order_id orderId,t.remark,t.port_id,t.port_id
  19. portId,t.person_name,t.person_name personName,t.machine_id,t.machine_id
  20. machineId,t.acct_detail_id,t.acct_detail_id acctDetailId,t.person_id,t.person_id
  21. personId,t.charge_hours,t.charge_hours chargeHours,t.start_time,t.start_time startTime,t.end_time,t.end_time
  22. endTime,t.state,t.person_tel,t.person_tel personTel,t.community_id,t.community_id communityId,t.energy,t.duration_price durationPrice,
  23. cm.machine_name machineName,cm.machine_code machineCode,
  24. cmp.port_code portCode,cmp.port_name portName,td.`name` stateName,SUM(cmoa.amount) amount
  25. from charge_machine_order t
  26. left join charge_machine cm on t.machine_id = cm.machine_id and cm.status_cd = '0'
  27. left join charge_machine_port cmp on t.port_id = cmp.port_id and cmp.status_cd = '0'
  28. left join t_dict td on td.status_cd = t.state and td.table_name = 'charge_machine_order' and td.table_columns = 'state'
  29. left join charge_machine_order_acct cmoa on t.order_id = cmoa.order_id and cmoa.status_cd = '0'
  30. where 1 =1
  31. <if test="amount !=null and amount != ''">
  32. and t.amount= #{amount}
  33. </if>
  34. <if test="orderId !=null and orderId != ''">
  35. and t.order_id= #{orderId}
  36. </if>
  37. <if test="remark !=null and remark != ''">
  38. and t.remark= #{remark}
  39. </if>
  40. <if test="statusCd !=null and statusCd != ''">
  41. and t.status_cd= #{statusCd}
  42. </if>
  43. <if test="portId !=null and portId != ''">
  44. and t.port_id= #{portId}
  45. </if>
  46. <if test="personName !=null and personName != ''">
  47. and t.person_name= #{personName}
  48. </if>
  49. <if test="machineId !=null and machineId != ''">
  50. and t.machine_id= #{machineId}
  51. </if>
  52. <if test="acctDetailId !=null and acctDetailId != ''">
  53. and t.acct_detail_id= #{acctDetailId}
  54. </if>
  55. <if test="personId !=null and personId != ''">
  56. and t.person_id= #{personId}
  57. </if>
  58. <if test="chargeHours !=null and chargeHours != ''">
  59. and t.charge_hours= #{chargeHours}
  60. </if>
  61. <if test="startTime !=null and startTime != ''">
  62. and t.start_time= #{startTime}
  63. </if>
  64. <if test="endTime !=null and endTime != ''">
  65. and t.end_time= #{endTime}
  66. </if>
  67. <if test="queryTime !=null and queryTime != ''">
  68. and t.start_time &lt; #{queryTime}
  69. and t.end_time &gt; #{queryTime}
  70. </if>
  71. <if test="state !=null and state != ''">
  72. and t.state= #{state}
  73. </if>
  74. <if test="personTel !=null and personTel != ''">
  75. and t.person_tel= #{personTel}
  76. </if>
  77. <if test="communityId !=null and communityId != ''">
  78. and t.community_id= #{communityId}
  79. </if>
  80. <if test="energy !=null and energy != ''">
  81. and t.energy= #{energy}
  82. </if>
  83. GROUP BY t.order_id,t.remark,t.port_id,t.person_name,t.machine_id,t.acct_detail_id,t.person_id,
  84. t.charge_hours,t.start_time,t.end_time,t.state,t.person_tel,t.community_id,t.energy,t.duration_price,
  85. cm.machine_name ,cm.machine_code ,
  86. cmp.port_code ,cmp.port_name ,td.`name`
  87. order by t.create_time desc
  88. <if test="page != -1 and page != null ">
  89. limit #{page}, #{row}
  90. </if>
  91. </select>
  92. <!-- 修改充电桩订单信息 add by wuxw 2018-07-03 -->
  93. <update id="updateChargeMachineOrderInfo" parameterType="Map">
  94. update charge_machine_order t set t.status_cd = #{statusCd}
  95. <if test="newBId != null and newBId != ''">
  96. ,t.b_id = #{newBId}
  97. </if>
  98. <if test="amount !=null and amount != ''">
  99. , t.amount= #{amount}
  100. </if>
  101. <if test="remark !=null and remark != ''">
  102. , t.remark= #{remark}
  103. </if>
  104. <if test="personName !=null and personName != ''">
  105. , t.person_name= #{personName}
  106. </if>
  107. <if test="acctDetailId !=null and acctDetailId != ''">
  108. , t.acct_detail_id= #{acctDetailId}
  109. </if>
  110. <if test="personId !=null and personId != ''">
  111. , t.person_id= #{personId}
  112. </if>
  113. <if test="chargeHours !=null and chargeHours != ''">
  114. , t.charge_hours= #{chargeHours}
  115. </if>
  116. <if test="startTime !=null and startTime != ''">
  117. , t.start_time= #{startTime}
  118. </if>
  119. <if test="endTime !=null and endTime != ''">
  120. , t.end_time= #{endTime}
  121. </if>
  122. <if test="state !=null and state != ''">
  123. , t.state= #{state}
  124. </if>
  125. <if test="personTel !=null and personTel != ''">
  126. , t.person_tel= #{personTel}
  127. </if>
  128. <if test="energy !=null and energy != ''">
  129. , t.energy= #{energy}
  130. </if>
  131. <if test="durationPrice !=null and durationPrice != ''">
  132. , t.duration_price= #{durationPrice}
  133. </if>
  134. where 1=1
  135. <if test="orderId !=null and orderId != ''">
  136. and t.order_id= #{orderId}
  137. </if>
  138. <if test="communityId !=null and communityId != ''">
  139. and t.community_id= #{communityId}
  140. </if>
  141. <if test="machineId !=null and machineId != ''">
  142. and t.machine_id= #{machineId}
  143. </if>
  144. <if test="portId !=null and portId != ''">
  145. and t.port_id= #{portId}
  146. </if>
  147. </update>
  148. <!-- 查询充电桩订单数量 add by wuxw 2018-07-03 -->
  149. <select id="queryChargeMachineOrdersCount" parameterType="Map" resultType="Map">
  150. select count(1) count
  151. from charge_machine_order t
  152. where 1 =1
  153. <if test="amount !=null and amount != ''">
  154. and t.amount= #{amount}
  155. </if>
  156. <if test="orderId !=null and orderId != ''">
  157. and t.order_id= #{orderId}
  158. </if>
  159. <if test="remark !=null and remark != ''">
  160. and t.remark= #{remark}
  161. </if>
  162. <if test="statusCd !=null and statusCd != ''">
  163. and t.status_cd= #{statusCd}
  164. </if>
  165. <if test="portId !=null and portId != ''">
  166. and t.port_id= #{portId}
  167. </if>
  168. <if test="personName !=null and personName != ''">
  169. and t.person_name= #{personName}
  170. </if>
  171. <if test="machineId !=null and machineId != ''">
  172. and t.machine_id= #{machineId}
  173. </if>
  174. <if test="acctDetailId !=null and acctDetailId != ''">
  175. and t.acct_detail_id= #{acctDetailId}
  176. </if>
  177. <if test="personId !=null and personId != ''">
  178. and t.person_id= #{personId}
  179. </if>
  180. <if test="chargeHours !=null and chargeHours != ''">
  181. and t.charge_hours= #{chargeHours}
  182. </if>
  183. <if test="startTime !=null and startTime != ''">
  184. and t.start_time= #{startTime}
  185. </if>
  186. <if test="endTime !=null and endTime != ''">
  187. and t.end_time= #{endTime}
  188. </if>
  189. <if test="state !=null and state != ''">
  190. and t.state= #{state}
  191. </if>
  192. <if test="personTel !=null and personTel != ''">
  193. and t.person_tel= #{personTel}
  194. </if>
  195. <if test="communityId !=null and communityId != ''">
  196. and t.community_id= #{communityId}
  197. </if>
  198. <if test="energy !=null and energy != ''">
  199. and t.energy= #{energy}
  200. </if>
  201. </select>
  202. </mapper>