FloorServiceDaoImplMapper.xml 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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="floorServiceDaoImpl">
  6. <!-- 保存小区楼信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessFloorInfo" parameterType="Map">
  8. insert into business_floor(
  9. floor_id,operate,name,remark,b_id,user_id,floor_num,community_id,floor_area
  10. ) values (
  11. #{floorId},#{operate},#{name},#{remark},#{bId},#{userId},#{floorNum},#{communityId},#{floorArea}
  12. )
  13. </insert>
  14. <!-- 查询小区楼信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessFloorInfo" parameterType="Map" resultType="Map">
  16. select t.floor_id,t.operate,t.name,t.remark,t.b_id,t.user_id,t.floor_num,t.community_id,t.floor_area
  17. from business_floor t
  18. where 1 =1
  19. <if test="floorId !=null and floorId != ''">
  20. and t.floor_id= #{floorId}
  21. </if>
  22. <if test="operate !=null and operate != ''">
  23. and t.operate= #{operate}
  24. </if>
  25. <if test="name !=null and name != ''">
  26. and t.name= #{name}
  27. </if>
  28. <if test="remark !=null and remark != ''">
  29. and t.remark= #{remark}
  30. </if>
  31. <if test="bId !=null and bId != ''">
  32. and t.b_id= #{bId}
  33. </if>
  34. <if test="userId !=null and userId != ''">
  35. and t.user_id= #{userId}
  36. </if>
  37. <if test="floorNum !=null and floorNum != ''">
  38. and t.floor_num= #{floorNum}
  39. </if>
  40. <if test="communityId !=null and communityId != ''">
  41. and t.community_id= #{communityId}
  42. </if>
  43. </select>
  44. <!-- 保存小区楼信息至 instance表中 add by wuxw 2018-07-03 -->
  45. <insert id="saveFloorInfoInstance" parameterType="Map">
  46. insert into f_floor(
  47. floor_id,name,status_cd,remark,b_id,user_id,floor_num,community_id,floor_area
  48. ) select t.floor_id,t.name,'0',t.remark,t.b_id,t.user_id,t.floor_num,t.community_id,t.floor_area
  49. from business_floor t where 1=1
  50. <if test="floorId !=null and floorId != ''">
  51. and t.floor_id= #{floorId}
  52. </if>
  53. and t.operate= 'ADD'
  54. <if test="name !=null and name != ''">
  55. and t.name= #{name}
  56. </if>
  57. <if test="remark !=null and remark != ''">
  58. and t.remark= #{remark}
  59. </if>
  60. <if test="bId !=null and bId != ''">
  61. and t.b_id= #{bId}
  62. </if>
  63. <if test="userId !=null and userId != ''">
  64. and t.user_id= #{userId}
  65. </if>
  66. <if test="floorNum !=null and floorNum != ''">
  67. and t.floor_num= #{floorNum}
  68. </if>
  69. <if test="communityId !=null and communityId != ''">
  70. and t.community_id= #{communityId}
  71. </if>
  72. </insert>
  73. <!-- 查询小区楼信息 add by wuxw 2018-07-03 -->
  74. <select id="getFloorInfo" parameterType="Map" resultType="Map">
  75. select t.floor_id,t.floor_id floorId,t.name,t.status_cd, t.status_cd statusCd,t.remark,t.b_id,
  76. t.b_id bId,t.user_id, t.user_id userId,t.floor_num ,t.floor_num floorNum,t.community_id communityId,t.community_id,
  77. t.floor_area,t.floor_area floorArea,t.seq
  78. from f_floor t
  79. where 1 =1
  80. <if test="floorId !=null and floorId != ''">
  81. and t.floor_id= #{floorId}
  82. </if>
  83. <if test="name !=null and name != ''">
  84. and t.name= #{name}
  85. </if>
  86. <if test="statusCd !=null and statusCd != ''">
  87. and t.status_cd= #{statusCd}
  88. </if>
  89. <if test="remark !=null and remark != ''">
  90. and t.remark= #{remark}
  91. </if>
  92. <if test="bId !=null and bId != ''">
  93. and t.b_id= #{bId}
  94. </if>
  95. <if test="userId !=null and userId != ''">
  96. and t.user_id= #{userId}
  97. </if>
  98. <if test="floorNum !=null and floorNum != ''">
  99. and t.floor_num= #{floorNum}
  100. </if>
  101. <if test="communityId !=null and communityId != ''">
  102. and t.community_id= #{communityId}
  103. </if>
  104. order by t.create_time desc
  105. <if test="page != -1 and page != null ">
  106. limit #{page}, #{row}
  107. </if>
  108. </select>
  109. <!-- 修改小区楼信息 add by wuxw 2018-07-03 -->
  110. <update id="updateFloorInfoInstance" parameterType="Map">
  111. update f_floor t set t.status_cd = #{statusCd}
  112. <if test="newBId != null and newBId != ''">
  113. ,t.b_id = #{newBId}
  114. </if>
  115. <if test="name !=null and name != ''">
  116. , t.name= #{name}
  117. </if>
  118. <if test="floorArea !=null and floorArea != ''">
  119. , t.floor_area= #{floorArea}
  120. </if>
  121. <if test="remark !=null and remark != ''">
  122. , t.remark= #{remark}
  123. </if>
  124. <if test="userId !=null and userId != ''">
  125. , t.user_id= #{userId}
  126. </if>
  127. <if test="floorNum !=null and floorNum != ''">
  128. , t.floor_num= #{floorNum}
  129. </if>
  130. where 1=1
  131. <if test="floorId !=null and floorId != ''">
  132. and t.floor_id= #{floorId}
  133. </if>
  134. <if test="communityId !=null and communityId != ''">
  135. and t.community_id= #{communityId}
  136. </if>
  137. <if test="bId !=null and bId != ''">
  138. and t.b_id= #{bId}
  139. </if>
  140. </update>
  141. <select id="queryFloorsCount" parameterType="Map" resultType="Map">
  142. SELECT
  143. COUNT(1) count
  144. FROM
  145. f_floor f
  146. where 1=1
  147. <if test="communityId !=null and communityId != ''">
  148. and f.`community_id` = #{communityId}
  149. </if>
  150. <if test="floorId !=null and floorId != ''">
  151. and f.floor_id= #{floorId}
  152. </if>
  153. <if test="floorIds !=null">
  154. and f.floor_id in
  155. <foreach collection="floorIds" item="item" open="(" close=")" separator=",">
  156. #{item}
  157. </foreach>
  158. </if>
  159. <if test="name !=null and name != ''">
  160. and f.name like concat('%',#{name},'%')
  161. </if>
  162. <if test="floorName !=null and floorName != ''">
  163. and f.name like concat('%',#{floorName},'%')
  164. </if>
  165. <if test="statusCd !=null and statusCd != ''">
  166. and f.status_cd= #{statusCd}
  167. </if>
  168. <if test="remark !=null and remark != ''">
  169. and f.remark= #{remark}
  170. </if>
  171. <if test="bId !=null and bId != ''">
  172. and f.b_id= #{bId}
  173. </if>
  174. <if test="floorNum !=null and floorNum != ''">
  175. and f.floor_num= #{floorNum}
  176. </if>
  177. AND f.`status_cd` = '0'
  178. </select>
  179. <!-- 查询小区 内的楼 -->
  180. <select id="queryFloors" parameterType="Map" resultType="Map">
  181. SELECT
  182. f.`floor_id` floorId,
  183. f.`floor_num` floorNum,
  184. f.`name` floorName,
  185. f.`remark`,
  186. f.`user_id` userId,
  187. f.`community_id` communityId,
  188. f.floor_area floorArea,
  189. f.seq
  190. FROM
  191. f_floor f
  192. where 1=1
  193. <if test="communityId !=null and communityId != ''">
  194. and f.`community_id` = #{communityId}
  195. </if>
  196. <if test="floorId !=null and floorId != ''">
  197. and f.floor_id= #{floorId}
  198. </if>
  199. <if test="floorIds !=null">
  200. and f.floor_id in
  201. <foreach collection="floorIds" item="item" open="(" close=")" separator=",">
  202. #{item}
  203. </foreach>
  204. </if>
  205. <if test="name !=null and name != ''">
  206. and f.name like concat('%',#{name},'%')
  207. </if>
  208. <if test="floorName !=null and floorName != ''">
  209. and f.name like concat('%',#{floorName},'%')
  210. </if>
  211. <if test="statusCd !=null and statusCd != ''">
  212. and f.status_cd= #{statusCd}
  213. </if>
  214. <if test="remark !=null and remark != ''">
  215. and f.remark= #{remark}
  216. </if>
  217. <if test="bId !=null and bId != ''">
  218. and f.b_id= #{bId}
  219. </if>
  220. <if test="floorNum !=null and floorNum != ''">
  221. and f.floor_num= #{floorNum}
  222. </if>
  223. AND f.`status_cd` = '0'
  224. order by f.create_time desc
  225. <if test="page != -1 and page != null ">
  226. LIMIT #{page}, #{row}
  227. </if>
  228. </select>
  229. <!-- 查询小区单元信息 add by wuxw 2018-07-03 -->
  230. <select id="queryFloorAndUnits" parameterType="Map" resultType="Map">
  231. select t.floor_id,t.floor_id floorId,bu.layer_count,bu.layer_count layerCount,bu.unit_id,bu.unit_id
  232. unitId,bu.unit_num,bu.unit_num unitNum,bu.lift,bu.remark,bu.unit_area,bu.unit_area unitArea,t.floor_num floorNum
  233. from f_floor t
  234. left join building_unit bu on t.`floor_id` = bu.`floor_id` and bu.status_cd = '0'
  235. where 1 =1
  236. and t.status_cd = '0'
  237. <if test="communityId!=null and communityId != ''">
  238. AND t.community_id = #{communityId}
  239. </if>
  240. <if test="floorId !=null and floorId != ''">
  241. and t.floor_id= #{floorId}
  242. </if>
  243. <if test="layerCount !=null and layerCount != ''">
  244. and bu.layer_count= #{layerCount}
  245. </if>
  246. <if test="unitId !=null and unitId != ''">
  247. and bu.unit_id= #{unitId}
  248. </if>
  249. <if test="unitNum !=null and unitNum != ''">
  250. and bu.unit_num= #{unitNum}
  251. </if>
  252. <if test="lift !=null and lift != ''">
  253. and bu.lift= #{lift}
  254. </if>
  255. order by t.seq,unitNum asc
  256. <!-- <if test="page != -1 and page != null ">
  257. limit #{page}, #{row}
  258. </if>limit 10;-->
  259. </select>
  260. </mapper>