UnitServiceDaoImplMapper.xml 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  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="unitServiceDaoImpl">
  6. <!-- 保存小区单元信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessUnitInfo" parameterType="Map">
  8. insert into business_building_unit(
  9. floor_id,operate,layer_count,unit_id,unit_num,lift,remark,b_id,user_id
  10. ) values (
  11. #{floorId},#{operate},#{layerCount},#{unitId},#{unitNum},#{lift},#{remark},#{bId},#{userId}
  12. )
  13. </insert>
  14. <!-- 查询小区单元信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessUnitInfo" parameterType="Map" resultType="Map">
  16. select t.floor_id,t.floor_id floorId,t.operate,t.layer_count,t.layer_count layerCount,t.unit_id,t.unit_id unitId,t.unit_num,t.unit_num unitNum,t.lift,t.remark,t.b_id,t.b_id bId,t.user_id,t.user_id userId
  17. from business_building_unit 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="layerCount !=null and layerCount != ''">
  26. and t.layer_count= #{layerCount}
  27. </if>
  28. <if test="unitId !=null and unitId != ''">
  29. and t.unit_id= #{unitId}
  30. </if>
  31. <if test="unitNum !=null and unitNum != ''">
  32. and t.unit_num= #{unitNum}
  33. </if>
  34. <if test="lift !=null and lift != ''">
  35. and t.lift= #{lift}
  36. </if>
  37. <if test="remark !=null and remark != ''">
  38. and t.remark= #{remark}
  39. </if>
  40. <if test="bId !=null and bId != ''">
  41. and t.b_id= #{bId}
  42. </if>
  43. <if test="userId !=null and userId != ''">
  44. and t.user_id= #{userId}
  45. </if>
  46. </select>
  47. <!-- 保存小区单元信息至 instance表中 add by wuxw 2018-07-03 -->
  48. <insert id="saveUnitInfoInstance" parameterType="Map">
  49. insert into building_unit(
  50. floor_id,layer_count,unit_id,unit_num,lift,status_cd,remark,b_id,user_id
  51. ) select t.floor_id,t.layer_count,t.unit_id,t.unit_num,t.lift,'0',t.remark,t.b_id,t.user_id from business_building_unit t where 1=1
  52. <if test="floorId !=null and floorId != ''">
  53. and t.floor_id= #{floorId}
  54. </if>
  55. and t.operate= 'ADD'
  56. <if test="layerCount !=null and layerCount != ''">
  57. and t.layer_count= #{layerCount}
  58. </if>
  59. <if test="unitId !=null and unitId != ''">
  60. and t.unit_id= #{unitId}
  61. </if>
  62. <if test="unitNum !=null and unitNum != ''">
  63. and t.unit_num= #{unitNum}
  64. </if>
  65. <if test="lift !=null and lift != ''">
  66. and t.lift= #{lift}
  67. </if>
  68. <if test="remark !=null and remark != ''">
  69. and t.remark= #{remark}
  70. </if>
  71. <if test="bId !=null and bId != ''">
  72. and t.b_id= #{bId}
  73. </if>
  74. <if test="userId !=null and userId != ''">
  75. and t.user_id= #{userId}
  76. </if>
  77. </insert>
  78. <!-- 查询小区单元信息 add by wuxw 2018-07-03 -->
  79. <select id="getUnitInfo" parameterType="Map" resultType="Map">
  80. select t.floor_id,t.floor_id floorId,t.layer_count,t.layer_count layerCount,t.unit_id,t.unit_id unitId,t.unit_num,t.unit_num unitNum,t.lift,t.status_cd,t.status_cd statusCd,t.remark,t.b_id,t.b_id bId,t.user_id,t.user_id userId
  81. from building_unit t
  82. where 1 =1
  83. <if test="floorId !=null and floorId != ''">
  84. and t.floor_id= #{floorId}
  85. </if>
  86. <if test="layerCount !=null and layerCount != ''">
  87. and t.layer_count= #{layerCount}
  88. </if>
  89. <if test="unitId !=null and unitId != ''">
  90. and t.unit_id= #{unitId}
  91. </if>
  92. <if test="unitNum !=null and unitNum != ''">
  93. and t.unit_num= #{unitNum}
  94. </if>
  95. <if test="lift !=null and lift != ''">
  96. and t.lift= #{lift}
  97. </if>
  98. <if test="statusCd !=null and statusCd != ''">
  99. and t.status_cd= #{statusCd}
  100. </if>
  101. <if test="remark !=null and remark != ''">
  102. and t.remark= #{remark}
  103. </if>
  104. <if test="bId !=null and bId != ''">
  105. and t.b_id= #{bId}
  106. </if>
  107. <if test="userId !=null and userId != ''">
  108. and t.user_id= #{userId}
  109. </if>
  110. <if test="page != -1 and page != null and page != ''">
  111. limit page,row
  112. </if>
  113. </select>
  114. <!-- 修改小区单元信息 add by wuxw 2018-07-03 -->
  115. <update id="updateUnitInfoInstance" parameterType="Map">
  116. update building_unit t set t.status_cd = #{statusCd}
  117. <if test="newBId != null and newBId != ''">
  118. ,t.b_id = #{newBId}
  119. </if>
  120. <if test="floorId !=null and floorId != ''">
  121. , t.floor_id= #{floorId}
  122. </if>
  123. <if test="layerCount !=null and layerCount != ''">
  124. , t.layer_count= #{layerCount}
  125. </if>
  126. <if test="unitNum !=null and unitNum != ''">
  127. , t.unit_num= #{unitNum}
  128. </if>
  129. <if test="lift !=null and lift != ''">
  130. , t.lift= #{lift}
  131. </if>
  132. <if test="remark !=null and remark != ''">
  133. , t.remark= #{remark}
  134. </if>
  135. <if test="userId !=null and userId != ''">
  136. , t.user_id= #{userId}
  137. </if>
  138. where 1=1 <if test="unitId !=null and unitId != ''">
  139. and t.unit_id= #{unitId}
  140. </if>
  141. <if test="bId !=null and bId != ''">
  142. and t.b_id= #{bId}
  143. </if>
  144. </update>
  145. <!-- 查询小区单元数量 add by wuxw 2018-07-03 -->
  146. <select id="queryUnitsCount" parameterType="Map" resultType="Map">
  147. select count(1) count
  148. from building_unit t
  149. where 1 =1
  150. <if test="floorId !=null and floorId != ''">
  151. and t.floor_id= #{floorId}
  152. </if>
  153. <if test="layerCount !=null and layerCount != ''">
  154. and t.layer_count= #{layerCount}
  155. </if>
  156. <if test="unitId !=null and unitId != ''">
  157. and t.unit_id= #{unitId}
  158. </if>
  159. <if test="unitNum !=null and unitNum != ''">
  160. and t.unit_num= #{unitNum}
  161. </if>
  162. <if test="lift !=null and lift != ''">
  163. and t.lift= #{lift}
  164. </if>
  165. <if test="statusCd !=null and statusCd != ''">
  166. and t.status_cd= #{statusCd}
  167. </if>
  168. <if test="remark !=null and remark != ''">
  169. and t.remark= #{remark}
  170. </if>
  171. <if test="bId !=null and bId != ''">
  172. and t.b_id= #{bId}
  173. </if>
  174. <if test="userId !=null and userId != ''">
  175. and t.user_id= #{userId}
  176. </if>
  177. </select>
  178. </mapper>