ParkingSpaceServiceDaoImplMapper.xml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  3. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  4. <mapper namespace="parkingSpaceServiceDaoImpl">
  5. <!-- 保存停车位信息 add by wuxw 2018-07-03 -->
  6. <insert id="saveBusinessParkingSpaceInfo" parameterType="Map">
  7. insert into business_parking_space(area, operate, num, ps_id, pa_id, remark, state, community_id, b_id,
  8. parking_type)
  9. values (#{area}, #{operate}, #{num}, #{psId}, #{paId}, #{remark}, #{state}, #{communityId}, #{bId},
  10. #{parkingType})
  11. </insert>
  12. <!-- 保存车位信息 -->
  13. <insert id="saveParkingSpace" parameterType="Map">
  14. insert into parking_space(area, num, ps_id, pa_id, remark, state, community_id, b_id, parking_type, create_time)
  15. values (#{area}, #{num}, #{psId}, #{paId}, #{remark}, #{state}, #{communityId}, #{bId}, #{parkingType},
  16. #{createTime})
  17. </insert>
  18. <!-- 查询停车位信息(Business) add by wuxw 2018-07-03 -->
  19. <select id="getBusinessParkingSpaceInfo" parameterType="Map" resultType="Map">
  20. select t.area,t.operate,t.num,t.ps_id,t.ps_id
  21. psId,t.pa_id,t.pa_id
  22. paId,t.remark,t.state,t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.parking_type,t.parking_type
  23. parkingType
  24. from business_parking_space t
  25. where 1 =1
  26. <if test="area !=null and area != ''">
  27. and t.area= #{area}
  28. </if>
  29. <if test="operate !=null and operate != ''">
  30. and t.operate= #{operate}
  31. </if>
  32. <if test="num !=null and num != ''">
  33. and t.num= #{num}
  34. </if>
  35. <if test="psId !=null and psId != ''">
  36. and t.ps_id= #{psId}
  37. </if>
  38. <if test="paId !=null and paId != ''">
  39. and t.pa_id= #{paId}
  40. </if>
  41. <if test="remark !=null and remark != ''">
  42. and t.remark= #{remark}
  43. </if>
  44. <if test="state !=null and state != ''">
  45. and t.state= #{state}
  46. </if>
  47. <if test="communityId !=null and communityId != ''">
  48. and t.community_id= #{communityId}
  49. </if>
  50. <if test="bId !=null and bId != ''">
  51. and t.b_id= #{bId}
  52. </if>
  53. <if test="parkingType !=null and parkingType != ''">
  54. and t.parking_type= #{parkingType}
  55. </if>
  56. </select>
  57. <!-- 保存停车位信息至 instance表中 add by wuxw 2018-07-03 -->
  58. <insert id="saveParkingSpaceInfoInstance" parameterType="Map">
  59. insert into parking_space(
  60. area,num,ps_id,pa_id,remark,status_cd,state,community_id,b_id,parking_type
  61. ) select t.area,t.num,t.ps_id,t.pa_id,t.remark,'0',t.state,t.community_id,t.b_id,t.parking_type
  62. from
  63. business_parking_space t where 1=1
  64. <if test="area !=null and area != ''">
  65. and t.area= #{area}
  66. </if>
  67. and t.operate= 'ADD'
  68. <if test="num !=null and num != ''">
  69. and t.num= #{num}
  70. </if>
  71. <if test="psId !=null and psId != ''">
  72. and t.ps_id= #{psId}
  73. </if>
  74. <if test="paId !=null and paId != ''">
  75. and t.pa_id= #{paId}
  76. </if>
  77. <if test="remark !=null and remark != ''">
  78. and t.remark= #{remark}
  79. </if>
  80. <if test="state !=null and state != ''">
  81. and t.state= #{state}
  82. </if>
  83. <if test="communityId !=null and communityId != ''">
  84. and t.community_id= #{communityId}
  85. </if>
  86. <if test="bId !=null and bId != ''">
  87. and t.b_id= #{bId}
  88. </if>
  89. <if test="parkingType !=null and parkingType != ''">
  90. and t.parking_type= #{parkingType}
  91. </if>
  92. </insert>
  93. <!-- 查询停车位信息 add by wuxw 2018-07-03 -->
  94. <select id="getParkingSpaceInfo" parameterType="Map" resultType="Map">
  95. SELECT
  96. t.area,
  97. t.num,
  98. t.ps_id psId,
  99. t.ps_id,
  100. t.pa_id paId,
  101. t.pa_id,
  102. t.remark,
  103. t.status_cd statusCd,
  104. t.status_cd,
  105. t.`state`,
  106. t.community_id,
  107. t.community_id communityId,
  108. t.b_id,
  109. t.b_id bId,
  110. t.parking_type,
  111. t.parking_type parkingType,
  112. td2.NAME parkingTypeName,
  113. td1.NAME stateName,
  114. pa.num areaNum,
  115. pa.type_cd typeCd,
  116. t.create_time createTime
  117. FROM
  118. parking_space t
  119. LEFT JOIN t_dict td1 ON t.state = td1.status_cd
  120. AND td1.table_name = 'parking_space'
  121. AND td1.table_columns = 'state'
  122. LEFT JOIN t_dict td2 ON t.parking_type = td2.status_cd
  123. AND td2.table_name = 'parking_space'
  124. AND td2.table_columns = 'parking_type'
  125. LEFT JOIN parking_area pa ON t.pa_id = pa.pa_id
  126. AND pa.status_cd = '0'
  127. <where>
  128. <if test="area !=null and area != ''">
  129. and t.area= #{area}
  130. </if>
  131. <if test="num !=null and num != ''">
  132. and t.num= #{num}
  133. </if>
  134. <if test="areaNum !=null and areaNum != ''">
  135. and pa.num= #{areaNum}
  136. </if>
  137. <if test="psId !=null and psId != ''">
  138. and t.ps_id= #{psId}
  139. </if>
  140. <if test="paId !=null and paId != ''">
  141. and t.pa_id= #{paId}
  142. </if>
  143. <if test="remark !=null and remark != ''">
  144. and t.remark= #{remark}
  145. </if>
  146. <if test="parkingType !=null and parkingType != ''">
  147. and t.parking_type= #{parkingType}
  148. </if>
  149. <if test="statusCd !=null and statusCd != ''">
  150. and t.status_cd= #{statusCd}
  151. </if>
  152. <if test="state !=null and state != ''">
  153. and t.state= #{state}
  154. </if>
  155. <if test="states != null">
  156. and t.state in
  157. <foreach collection="states" item="item" open="(" close=")" separator=",">
  158. #{item}
  159. </foreach>
  160. </if>
  161. <if test="psIds != null and psIds != null">
  162. and t.ps_id in
  163. <foreach collection="psIds" item="item" open="(" close=")" separator=",">
  164. #{item}
  165. </foreach>
  166. </if>
  167. <if test="paIds != null ">
  168. and t.pa_id in
  169. <foreach collection="paIds" item="item" open="(" close=")" separator=",">
  170. #{item}
  171. </foreach>
  172. </if>
  173. <if test="communityId !=null and communityId != ''">
  174. and t.community_id= #{communityId}
  175. </if>
  176. <if test="bId !=null and bId != ''">
  177. and t.b_id= #{bId}
  178. </if>
  179. order by t.create_time desc
  180. <if test="page != -1 and page != null ">
  181. limit #{page}, #{row}
  182. </if>
  183. </where>
  184. </select>
  185. <!-- 修改停车位信息 add by wuxw 2018-07-03 -->
  186. <update id="updateParkingSpaceInfoInstance" parameterType="Map">
  187. update parking_space t set t.status_cd = #{statusCd}
  188. <if test="newBId != null and newBId != ''">
  189. ,t.b_id = #{newBId}
  190. </if>
  191. <if test="area !=null and area != ''">
  192. , t.area= #{area}
  193. </if>
  194. <if test="num !=null and num != ''">
  195. , t.num= #{num}
  196. </if>
  197. <if test="paId !=null and paId != ''">
  198. , t.pa_id= #{paId}
  199. </if>
  200. <if test="remark !=null and remark != ''">
  201. , t.remark= #{remark}
  202. </if>
  203. <if test="state !=null and state != ''">
  204. , t.state= #{state}
  205. </if>
  206. <if test="communityId !=null and communityId != ''">
  207. , t.community_id= #{communityId}
  208. </if>
  209. <if test="parkingType != null and parkingType != ''">
  210. ,t.parking_type = #{parkingType}
  211. </if>
  212. where 1=1
  213. <if test="psId !=null and psId != ''">
  214. and t.ps_id= #{psId}
  215. </if>
  216. <if test="bId !=null and bId != ''">
  217. and t.b_id= #{bId}
  218. </if>
  219. </update>
  220. <!-- 查询停车位数量 add by wuxw 2018-07-03 -->
  221. <select id="queryParkingSpacesCount" parameterType="Map" resultType="Map">
  222. SELECT count(1) count
  223. FROM
  224. parking_space t
  225. LEFT JOIN t_dict td1 ON t.state = td1.status_cd
  226. AND td1.table_name = 'parking_space'
  227. AND td1.table_columns = 'state'
  228. LEFT JOIN t_dict td2 ON t.parking_type = td2.status_cd
  229. AND td2.table_name = 'parking_space'
  230. AND td2.table_columns = 'parking_type'
  231. LEFT JOIN parking_area pa ON t.pa_id = pa.pa_id
  232. AND pa.status_cd = '0'
  233. <where>
  234. <if test="area !=null and area != ''">
  235. and t.area= #{area}
  236. </if>
  237. <if test="num !=null and num != ''">
  238. and t.num= #{num}
  239. </if>
  240. <if test="areaNum !=null and areaNum != ''">
  241. and pa.num= #{areaNum}
  242. </if>
  243. <if test="psId !=null and psId != ''">
  244. and t.ps_id= #{psId}
  245. </if>
  246. <if test="paId !=null and paId != ''">
  247. and t.pa_id= #{paId}
  248. </if>
  249. <if test="remark !=null and remark != ''">
  250. and t.remark= #{remark}
  251. </if>
  252. <if test="statusCd !=null and statusCd != ''">
  253. and t.status_cd= #{statusCd}
  254. </if>
  255. <if test="state !=null and state != ''">
  256. and t.state= #{state}
  257. </if>
  258. <if test="states != null and states != null">
  259. and t.state in
  260. <foreach collection="states" item="item" open="(" close=")" separator=",">
  261. #{item}
  262. </foreach>
  263. </if>
  264. <if test="communityId !=null and communityId != ''">
  265. and t.community_id= #{communityId}
  266. </if>
  267. <if test="bId !=null and bId != ''">
  268. and t.b_id= #{bId}
  269. </if>
  270. </where>
  271. </select>
  272. </mapper>