ParkingSpaceServiceDaoImplMapper.xml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  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="parkingSpaceServiceDaoImpl">
  6. <!-- 保存停车位信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessParkingSpaceInfo" parameterType="Map">
  8. insert into business_parking_space(
  9. area,operate,num,ps_id,pa_id, remark,state,community_id,b_id
  10. ) values (
  11. #{area},#{operate},#{num},#{psId},#{paId},#{remark},#{state},#{communityId},#{bId}
  12. )
  13. </insert>
  14. <!-- 查询停车位信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessParkingSpaceInfo" parameterType="Map" resultType="Map">
  16. select t.area,t.operate,t.num,t.ps_id,t.ps_id
  17. psId,t.pa_id,t.pa_id
  18. paId,t.remark,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId
  19. from business_parking_space t
  20. where 1 =1
  21. <if test="area !=null and area != ''">
  22. and t.area= #{area}
  23. </if>
  24. <if test="operate !=null and operate != ''">
  25. and t.operate= #{operate}
  26. </if>
  27. <if test="num !=null and num != ''">
  28. and t.num= #{num}
  29. </if>
  30. <if test="psId !=null and psId != ''">
  31. and t.ps_id= #{psId}
  32. </if>
  33. <if test="paId !=null and paId != ''">
  34. and t.pa_id= #{paId}
  35. </if>
  36. <if test="remark !=null and remark != ''">
  37. and t.remark= #{remark}
  38. </if>
  39. <if test="state !=null and state != ''">
  40. and t.state= #{state}
  41. </if>
  42. <if test="communityId !=null and communityId != ''">
  43. and t.community_id= #{communityId}
  44. </if>
  45. <if test="bId !=null and bId != ''">
  46. and t.b_id= #{bId}
  47. </if>
  48. </select>
  49. <!-- 保存停车位信息至 instance表中 add by wuxw 2018-07-03 -->
  50. <insert id="saveParkingSpaceInfoInstance" parameterType="Map">
  51. insert into parking_space(
  52. area,num,ps_id,pa_id,remark,status_cd,state,community_id,b_id
  53. ) select t.area,t.num,t.ps_id,t.pa_id,t.remark,'0',t.state,t.community_id,t.b_id from
  54. business_parking_space t where 1=1
  55. <if test="area !=null and area != ''">
  56. and t.area= #{area}
  57. </if>
  58. and t.operate= 'ADD'
  59. <if test="num !=null and num != ''">
  60. and t.num= #{num}
  61. </if>
  62. <if test="psId !=null and psId != ''">
  63. and t.ps_id= #{psId}
  64. </if>
  65. <if test="paId !=null and paId != ''">
  66. and t.pa_id= #{paId}
  67. </if>
  68. <if test="remark !=null and remark != ''">
  69. and t.remark= #{remark}
  70. </if>
  71. <if test="state !=null and state != ''">
  72. and t.state= #{state}
  73. </if>
  74. <if test="communityId !=null and communityId != ''">
  75. and t.community_id= #{communityId}
  76. </if>
  77. <if test="bId !=null and bId != ''">
  78. and t.b_id= #{bId}
  79. </if>
  80. </insert>
  81. <!-- 查询停车位信息 add by wuxw 2018-07-03 -->
  82. <select id="getParkingSpaceInfo" parameterType="Map" resultType="Map">
  83. SELECT
  84. t.area,
  85. t.num,
  86. t.ps_id psId,
  87. t.ps_id,
  88. t.pa_id paId,
  89. t.pa_id,
  90. t.remark,
  91. t.status_cd statusCd,
  92. t.status_cd,
  93. t.`state`,
  94. t.community_id,
  95. t.community_id communityId,
  96. t.b_id,
  97. t.b_id bId,
  98. td.name stateName,
  99. pa.num areaNum
  100. FROM
  101. parking_space t,t_dict td,parking_area pa
  102. <where>
  103. t.state = td.status_cd
  104. and td.table_name='parking_space'
  105. and td.table_columns='state'
  106. and t.pa_id = pa.pa_id
  107. and pa.status_cd ='0'
  108. <if test="area !=null and area != ''">
  109. and t.area= #{area}
  110. </if>
  111. <if test="num !=null and num != ''">
  112. and t.num= #{num}
  113. </if>
  114. <if test="psId !=null and psId != ''">
  115. and t.ps_id= #{psId}
  116. </if>
  117. <if test="paId !=null and paId != ''">
  118. and t.pa_id= #{paId}
  119. </if>
  120. <if test="remark !=null and remark != ''">
  121. and t.remark= #{remark}
  122. </if>
  123. <if test="statusCd !=null and statusCd != ''">
  124. and t.status_cd= #{statusCd}
  125. </if>
  126. <if test="state !=null and state != ''">
  127. and t.state= #{state}
  128. </if>
  129. <if test="states != null and states != null">
  130. and t.state in
  131. <foreach collection="states" item="item" open="(" close=")" separator=",">
  132. #{item}
  133. </foreach>
  134. </if>
  135. <if test="psIds != null and psIds != null">
  136. and t.ps_id in
  137. <foreach collection="psIds" item="item" open="(" close=")" separator=",">
  138. #{item}
  139. </foreach>
  140. </if>
  141. <if test="communityId !=null and communityId != ''">
  142. and t.community_id= #{communityId}
  143. </if>
  144. <if test="bId !=null and bId != ''">
  145. and t.b_id= #{bId}
  146. </if>
  147. order by t.create_time desc
  148. <if test="page != -1 and page != null ">
  149. limit #{page}, #{row}
  150. </if>
  151. </where>
  152. </select>
  153. <!-- 修改停车位信息 add by wuxw 2018-07-03 -->
  154. <update id="updateParkingSpaceInfoInstance" parameterType="Map">
  155. update parking_space t set t.status_cd = #{statusCd}
  156. <if test="newBId != null and newBId != ''">
  157. ,t.b_id = #{newBId}
  158. </if>
  159. <if test="area !=null and area != ''">
  160. , t.area= #{area}
  161. </if>
  162. <if test="num !=null and num != ''">
  163. , t.num= #{num}
  164. </if>
  165. <if test="remark !=null and remark != ''">
  166. , t.remark= #{remark}
  167. </if>
  168. <if test="state !=null and state != ''">
  169. , t.state= #{state}
  170. </if>
  171. <if test="communityId !=null and communityId != ''">
  172. , t.community_id= #{communityId}
  173. </if>
  174. where 1=1
  175. <if test="psId !=null and psId != ''">
  176. and t.ps_id= #{psId}
  177. </if>
  178. <if test="bId !=null and bId != ''">
  179. and t.b_id= #{bId}
  180. </if>
  181. </update>
  182. <!-- 查询停车位数量 add by wuxw 2018-07-03 -->
  183. <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
  184. select count(1) count
  185. FROM
  186. parking_space t,t_dict td,parking_area pa
  187. where
  188. t.state = td.status_cd
  189. and td.table_name='parking_space'
  190. and td.table_columns='state'
  191. and t.pa_id = pa.pa_id
  192. and pa.status_cd ='0'
  193. <if test="area !=null and area != ''">
  194. and t.area= #{area}
  195. </if>
  196. <if test="num !=null and num != ''">
  197. and t.num= #{num}
  198. </if>
  199. <if test="psId !=null and psId != ''">
  200. and t.ps_id= #{psId}
  201. </if>
  202. <if test="paId !=null and paId != ''">
  203. and t.pa_id= #{paId}
  204. </if>
  205. <if test="remark !=null and remark != ''">
  206. and t.remark= #{remark}
  207. </if>
  208. <if test="statusCd !=null and statusCd != ''">
  209. and t.status_cd= #{statusCd}
  210. </if>
  211. <if test="state !=null and state != ''">
  212. and t.state= #{state}
  213. </if>
  214. <if test="states != null and states != null">
  215. and t.state in
  216. <foreach collection="states" item="item" open="(" close=")" separator=",">
  217. #{item}
  218. </foreach>
  219. </if>
  220. <if test="communityId !=null and communityId != ''">
  221. and t.community_id= #{communityId}
  222. </if>
  223. <if test="bId !=null and bId != ''">
  224. and t.b_id= #{bId}
  225. </if>
  226. </select>
  227. </mapper>