FloorServiceDaoImplMapper.xml 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  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
  10. ) values (
  11. #{floorId},#{operate},#{name},#{remark},#{bId},#{userId},#{floorNum}
  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
  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. </select>
  41. <!-- 保存小区楼信息至 instance表中 add by wuxw 2018-07-03 -->
  42. <insert id="saveFloorInfoInstance" parameterType="Map">
  43. insert into f_floor(
  44. floor_id,name,status_cd,remark,b_id,user_id,floor_num
  45. ) select t.floor_id,t.name,'0',t.remark,t.b_id,t.user_id,t.floor_num from business_floor t where 1=1
  46. <if test="floorId !=null and floorId != ''">
  47. and t.floor_id= #{floorId}
  48. </if>
  49. and t.operate= 'ADD'
  50. <if test="name !=null and name != ''">
  51. and t.name= #{name}
  52. </if>
  53. <if test="remark !=null and remark != ''">
  54. and t.remark= #{remark}
  55. </if>
  56. <if test="bId !=null and bId != ''">
  57. and t.b_id= #{bId}
  58. </if>
  59. <if test="userId !=null and userId != ''">
  60. and t.user_id= #{userId}
  61. </if>
  62. <if test="floorNum !=null and floorNum != ''">
  63. and t.floor_num= #{floorNum}
  64. </if>
  65. </insert>
  66. <!-- 查询小区楼信息 add by wuxw 2018-07-03 -->
  67. <select id="getFloorInfo" parameterType="Map" resultType="Map">
  68. select t.floor_id,t.floor_id floorId,t.name,t.status_cd, t.status_cd statusCd,t.remark,t.b_id,
  69. t.b_id bId,t.user_id, t.user_id userId,t.floor_num ,t.floor_num floorNum
  70. from f_floor t
  71. where 1 =1
  72. <if test="floorId !=null and floorId != ''">
  73. and t.floor_id= #{floorId}
  74. </if>
  75. <if test="name !=null and name != ''">
  76. and t.name= #{name}
  77. </if>
  78. <if test="statusCd !=null and statusCd != ''">
  79. and t.status_cd= #{statusCd}
  80. </if>
  81. <if test="remark !=null and remark != ''">
  82. and t.remark= #{remark}
  83. </if>
  84. <if test="bId !=null and bId != ''">
  85. and t.b_id= #{bId}
  86. </if>
  87. <if test="userId !=null and userId != ''">
  88. and t.user_id= #{userId}
  89. </if>
  90. <if test="floorNum !=null and floorNum != ''">
  91. and t.floor_num= #{floorNum}
  92. </if>
  93. <if test="page != -1">
  94. limit #{page}, #{row}
  95. </if>
  96. </select>
  97. <!-- 修改小区楼信息 add by wuxw 2018-07-03 -->
  98. <update id="updateFloorInfoInstance" parameterType="Map">
  99. update f_floor t set t.status_cd = #{statusCd}
  100. <if test="newBId != null and newBId != ''">
  101. ,t.b_id = #{newBId}
  102. </if>
  103. <if test="name !=null and name != ''">
  104. , t.name= #{name}
  105. </if>
  106. <if test="remark !=null and remark != ''">
  107. , t.remark= #{remark}
  108. </if>
  109. <if test="userId !=null and userId != ''">
  110. , t.user_id= #{userId}
  111. </if>
  112. <if test="floorNum !=null and floorNum != ''">
  113. , t.floor_num= #{floorNum}
  114. </if>
  115. where 1=1 <if test="floorId !=null and floorId != ''">
  116. and t.floor_id= #{floorId}
  117. </if>
  118. <if test="bId !=null and bId != ''">
  119. and t.b_id= #{bId}
  120. </if>
  121. </update>
  122. <select id="queryFloorsCount" parameterType="Map" resultType="Map">
  123. SELECT
  124. COUNT(1) count
  125. FROM
  126. f_floor f,
  127. s_community_member cm
  128. WHERE f.`floor_id` = cm.`member_id`
  129. AND cm.`member_type_cd` = '390001200004'
  130. AND cm.`community_id` = #{communityId}
  131. <if test="floorId !=null and floorId != ''">
  132. and f.floor_id= #{floorId}
  133. </if>
  134. <if test="name !=null and name != ''">
  135. and f.name= #{name}
  136. </if>
  137. <if test="statusCd !=null and statusCd != ''">
  138. and f.status_cd= #{statusCd}
  139. </if>
  140. <if test="remark !=null and remark != ''">
  141. and f.remark= #{remark}
  142. </if>
  143. <if test="bId !=null and bId != ''">
  144. and f.b_id= #{bId}
  145. </if>
  146. <if test="userId !=null and userId != ''">
  147. and f.user_id= #{userId}
  148. </if>
  149. <if test="floorNum !=null and floorNum != ''">
  150. and f.floor_num= #{floorNum}
  151. </if>
  152. AND f.`status_cd` = '0'
  153. AND cm.`status_cd` = '0'
  154. </select>
  155. <!-- 查询小区 内的楼 -->
  156. <select id="queryFloors" parameterType="Map" resultType="Map">
  157. SELECT
  158. f.`floor_id` floorId,
  159. f.`floor_num` floorNum,
  160. f.`name` floorName,
  161. f.`remark`,
  162. f.`user_id` userId,
  163. cm.`community_id` communityId
  164. FROM
  165. f_floor f,
  166. s_community_member cm
  167. WHERE f.`floor_id` = cm.`member_id`
  168. AND cm.`member_type_cd` = '390001200004'
  169. AND cm.`community_id` = #{communityId}
  170. <if test="floorId !=null and floorId != ''">
  171. and f.floor_id= #{floorId}
  172. </if>
  173. <if test="name !=null and name != ''">
  174. and f.name= #{name}
  175. </if>
  176. <if test="statusCd !=null and statusCd != ''">
  177. and f.status_cd= #{statusCd}
  178. </if>
  179. <if test="remark !=null and remark != ''">
  180. and f.remark= #{remark}
  181. </if>
  182. <if test="bId !=null and bId != ''">
  183. and f.b_id= #{bId}
  184. </if>
  185. <if test="userId !=null and userId != ''">
  186. and f.user_id= #{userId}
  187. </if>
  188. <if test="floorNum !=null and floorNum != ''">
  189. and f.floor_num= #{floorNum}
  190. </if>
  191. AND f.`status_cd` = '0'
  192. AND cm.`status_cd` = '0'
  193. LIMIT #{page}, #{row}
  194. </select>
  195. </mapper>