ChargeMachineOrderV1ServiceDaoImplMapper.xml 7.7 KB

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