RoomAttrServiceDaoImplMapper.xml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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="roomAttrServiceDaoImpl">
  6. <!-- 保存小区房屋属性信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessRoomAttrInfo" parameterType="Map">
  8. insert into business_building_room_attr(
  9. attr_id,operate,spec_cd,b_id,value,room_id
  10. ) values (
  11. #{attrId},#{operate},#{specCd},#{bId},#{value},#{roomId}
  12. )
  13. </insert>
  14. <!-- 查询小区房屋属性信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessRoomAttrInfo" parameterType="Map" resultType="Map">
  16. select t.attr_id,t.attr_id attrId,t.operate,t.spec_cd,t.spec_cd specCd,t.b_id,t.b_id bId,t.value,t.room_id,t.room_id roomId
  17. from business_building_room_attr t
  18. where 1 =1
  19. <if test="attrId !=null and attrId != ''">
  20. and t.attr_id= #{attrId}
  21. </if>
  22. <if test="operate !=null and operate != ''">
  23. and t.operate= #{operate}
  24. </if>
  25. <if test="specCd !=null and specCd != ''">
  26. and t.spec_cd= #{specCd}
  27. </if>
  28. <if test="bId !=null and bId != ''">
  29. and t.b_id= #{bId}
  30. </if>
  31. <if test="value !=null and value != ''">
  32. and t.value= #{value}
  33. </if>
  34. <if test="roomId !=null and roomId != ''">
  35. and t.room_id= #{roomId}
  36. </if>
  37. </select>
  38. <!-- 保存小区房屋属性信息至 instance表中 add by wuxw 2018-07-03 -->
  39. <insert id="saveRoomAttrInfoInstance" parameterType="Map">
  40. insert into building_room_attr(
  41. attr_id,spec_cd,status_cd,b_id,value,room_id
  42. ) select t.attr_id,t.spec_cd,'0',t.b_id,t.value,t.room_id from business_building_room_attr t where 1=1
  43. <if test="attrId !=null and attrId != ''">
  44. and t.attr_id= #{attrId}
  45. </if>
  46. and t.operate= 'ADD'
  47. <if test="specCd !=null and specCd != ''">
  48. and t.spec_cd= #{specCd}
  49. </if>
  50. <if test="bId !=null and bId != ''">
  51. and t.b_id= #{bId}
  52. </if>
  53. <if test="value !=null and value != ''">
  54. and t.value= #{value}
  55. </if>
  56. <if test="roomId !=null and roomId != ''">
  57. and t.room_id= #{roomId}
  58. </if>
  59. </insert>
  60. <!-- 查询小区房屋属性信息 add by wuxw 2018-07-03 -->
  61. <select id="getRoomAttrInfo" parameterType="Map" resultType="Map">
  62. select t.attr_id,t.attr_id attrId,t.spec_cd,t.spec_cd specCd,t.status_cd,t.status_cd statusCd,t.b_id,t.b_id bId,t.value,t.room_id,t.room_id roomId
  63. from building_room_attr t
  64. where 1 =1
  65. <if test="attrId !=null and attrId != ''">
  66. and t.attr_id= #{attrId}
  67. </if>
  68. <if test="specCd !=null and specCd != ''">
  69. and t.spec_cd= #{specCd}
  70. </if>
  71. <if test="statusCd !=null and statusCd != ''">
  72. and t.status_cd= #{statusCd}
  73. </if>
  74. <if test="bId !=null and bId != ''">
  75. and t.b_id= #{bId}
  76. </if>
  77. <if test="value !=null and value != ''">
  78. and t.value= #{value}
  79. </if>
  80. <if test="roomId !=null and roomId != ''">
  81. and t.room_id= #{roomId}
  82. </if>
  83. <if test="page != -1 and page != null and page != ''">
  84. limit page,row
  85. </if>
  86. <if test="roomIds != null and roomIds != null">
  87. and t.room_id in
  88. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  89. #{item}
  90. </foreach>
  91. </if>
  92. </select>
  93. <!-- 修改小区房屋属性信息 add by wuxw 2018-07-03 -->
  94. <update id="updateRoomAttrInfoInstance" parameterType="Map">
  95. update building_room_attr t set t.status_cd = #{statusCd}
  96. <if test="newBId != null and newBId != ''">
  97. ,t.b_id = #{newBId}
  98. </if>
  99. <if test="specCd !=null and specCd != ''">
  100. , t.spec_cd= #{specCd}
  101. </if>
  102. <if test="value !=null and value != ''">
  103. , t.value= #{value}
  104. </if>
  105. <if test="roomId !=null and roomId != ''">
  106. , t.room_id= #{roomId}
  107. </if>
  108. where 1=1 <if test="attrId !=null and attrId != ''">
  109. and t.attr_id= #{attrId}
  110. </if>
  111. <if test="bId !=null and bId != ''">
  112. and t.b_id= #{bId}
  113. </if>
  114. </update>
  115. <!-- 查询小区房屋属性数量 add by wuxw 2018-07-03 -->
  116. <select id="queryRoomAttrsCount" parameterType="Map" resultType="Map">
  117. select count(1) count
  118. from building_room_attr t
  119. where 1 =1
  120. <if test="attrId !=null and attrId != ''">
  121. and t.attr_id= #{attrId}
  122. </if>
  123. <if test="specCd !=null and specCd != ''">
  124. and t.spec_cd= #{specCd}
  125. </if>
  126. <if test="statusCd !=null and statusCd != ''">
  127. and t.status_cd= #{statusCd}
  128. </if>
  129. <if test="bId !=null and bId != ''">
  130. and t.b_id= #{bId}
  131. </if>
  132. <if test="value !=null and value != ''">
  133. and t.value= #{value}
  134. </if>
  135. <if test="roomId !=null and roomId != ''">
  136. and t.room_id= #{roomId}
  137. </if>
  138. </select>
  139. </mapper>