ParkingSpaceServiceDaoImplMapper.xml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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. pa.type_cd typeCd
  101. FROM
  102. parking_space t,t_dict td,parking_area pa
  103. <where>
  104. t.state = td.status_cd
  105. and td.table_name='parking_space'
  106. and td.table_columns='state'
  107. and t.pa_id = pa.pa_id
  108. and pa.status_cd ='0'
  109. <if test="area !=null and area != ''">
  110. and t.area= #{area}
  111. </if>
  112. <if test="num !=null and num != ''">
  113. and t.num= #{num}
  114. </if>
  115. <if test="areaNum !=null and areaNum != ''">
  116. and pa.num= #{areaNum}
  117. </if>
  118. <if test="psId !=null and psId != ''">
  119. and t.ps_id= #{psId}
  120. </if>
  121. <if test="paId !=null and paId != ''">
  122. and t.pa_id= #{paId}
  123. </if>
  124. <if test="remark !=null and remark != ''">
  125. and t.remark= #{remark}
  126. </if>
  127. <if test="statusCd !=null and statusCd != ''">
  128. and t.status_cd= #{statusCd}
  129. </if>
  130. <if test="state !=null and state != ''">
  131. and t.state= #{state}
  132. </if>
  133. <if test="states != null and states != null">
  134. and t.state in
  135. <foreach collection="states" item="item" open="(" close=")" separator=",">
  136. #{item}
  137. </foreach>
  138. </if>
  139. <if test="psIds != null and psIds != null">
  140. and t.ps_id in
  141. <foreach collection="psIds" item="item" open="(" close=")" separator=",">
  142. #{item}
  143. </foreach>
  144. </if>
  145. <if test="communityId !=null and communityId != ''">
  146. and t.community_id= #{communityId}
  147. </if>
  148. <if test="bId !=null and bId != ''">
  149. and t.b_id= #{bId}
  150. </if>
  151. order by t.create_time desc
  152. <if test="page != -1 and page != null ">
  153. limit #{page}, #{row}
  154. </if>
  155. </where>
  156. </select>
  157. <!-- 修改停车位信息 add by wuxw 2018-07-03 -->
  158. <update id="updateParkingSpaceInfoInstance" parameterType="Map">
  159. update parking_space t set t.status_cd = #{statusCd}
  160. <if test="newBId != null and newBId != ''">
  161. ,t.b_id = #{newBId}
  162. </if>
  163. <if test="area !=null and area != ''">
  164. , t.area= #{area}
  165. </if>
  166. <if test="num !=null and num != ''">
  167. , t.num= #{num}
  168. </if>
  169. <if test="remark !=null and remark != ''">
  170. , t.remark= #{remark}
  171. </if>
  172. <if test="state !=null and state != ''">
  173. , t.state= #{state}
  174. </if>
  175. <if test="communityId !=null and communityId != ''">
  176. , t.community_id= #{communityId}
  177. </if>
  178. where 1=1
  179. <if test="psId !=null and psId != ''">
  180. and t.ps_id= #{psId}
  181. </if>
  182. <if test="bId !=null and bId != ''">
  183. and t.b_id= #{bId}
  184. </if>
  185. </update>
  186. <!-- 查询停车位数量 add by wuxw 2018-07-03 -->
  187. <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
  188. select count(1) count
  189. FROM
  190. parking_space t,t_dict td,parking_area pa
  191. where
  192. t.state = td.status_cd
  193. and td.table_name='parking_space'
  194. and td.table_columns='state'
  195. and t.pa_id = pa.pa_id
  196. and pa.status_cd ='0'
  197. <if test="area !=null and area != ''">
  198. and t.area= #{area}
  199. </if>
  200. <if test="num !=null and num != ''">
  201. and t.num= #{num}
  202. </if>
  203. <if test="areaNum !=null and areaNum != ''">
  204. and pa.num= #{areaNum}
  205. </if>
  206. <if test="psId !=null and psId != ''">
  207. and t.ps_id= #{psId}
  208. </if>
  209. <if test="paId !=null and paId != ''">
  210. and t.pa_id= #{paId}
  211. </if>
  212. <if test="remark !=null and remark != ''">
  213. and t.remark= #{remark}
  214. </if>
  215. <if test="statusCd !=null and statusCd != ''">
  216. and t.status_cd= #{statusCd}
  217. </if>
  218. <if test="state !=null and state != ''">
  219. and t.state= #{state}
  220. </if>
  221. <if test="states != null and states != null">
  222. and t.state in
  223. <foreach collection="states" item="item" open="(" close=")" separator=",">
  224. #{item}
  225. </foreach>
  226. </if>
  227. <if test="communityId !=null and communityId != ''">
  228. and t.community_id= #{communityId}
  229. </if>
  230. <if test="bId !=null and bId != ''">
  231. and t.b_id= #{bId}
  232. </if>
  233. </select>
  234. </mapper>