ReportCommunityServiceDaoImplMapper.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  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="reportCommunityServiceDaoImpl">
  6. <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
  7. <select id="getRoomCount" parameterType="com.java110.dto.report.ReportRoomDto" resultType="Map">
  8. select count(1) count
  9. from building_room t
  10. where t.status_cd = '0'
  11. <if test="state !=null and state != ''">
  12. and t.state= #{state}
  13. </if>
  14. <if test="communityId !=null and communityId != ''">
  15. and t.community_id= #{communityId}
  16. </if>
  17. </select>
  18. <!-- 查询 房屋 楼栋 单元 业主 -->
  19. <select id="getRoomFloorUnitAndOwner" parameterType="com.java110.dto.report.ReportRoomDto"
  20. resultType="com.java110.dto.report.ReportRoomDto">
  21. select t.apartment,t.built_up_area builtUpArea,t.community_id communityId,t.create_time createTime,
  22. t.fee_coefficient feeCoefficient,t.layer,t.room_id roomId,t.room_num roomNum,t.section,
  23. t.state,bu.unit_id unitId,bu.unit_num unitNum,ff.floor_id floorId,ff.floor_num floorNum,
  24. bo.age,bo.id_card idCard,bo.link,bo.member_id memberId,bo.`name`,bo.`name` ownerName,bo.owner_id ownerId,t.room_type roomType,
  25. t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea
  26. from building_room t
  27. INNER JOIN building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  28. inner join f_floor ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
  29. LEFT JOIN building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  30. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  31. where t.status_cd = '0'
  32. <if test="state !=null and state != ''">
  33. and t.state= #{state}
  34. </if>
  35. <if test="communityId !=null and communityId != ''">
  36. and t.community_id= #{communityId}
  37. </if>
  38. <if test="page != -1 and page != null ">
  39. limit #{page}, #{row}
  40. </if>
  41. </select>
  42. <select id="queryRoomStructures" parameterType="Map" resultType="Map">
  43. select t.apartment,t.built_up_area builtUpArea,t.community_id communityId,t.create_time createTime,
  44. t.fee_coefficient feeCoefficient,t.layer,t.room_id roomId,t.room_num roomNum,t.section,
  45. t.state,bu.unit_id unitId,bu.unit_num unitNum,ff.floor_id floorId,ff.floor_num floorNum,
  46. bo.age,bo.id_card idCard,bo.link,bo.member_id memberId,bo.`name`,bo.`name` ownerName,bo.owner_id ownerId,t.room_type roomType,
  47. t.room_sub_type roomSubType,t.room_rent roomRent,t.room_area roomArea,td.name stateName,
  48. (
  49. select if (SUM(rof.amount_owed)!='',SUM(rof.amount_owed),0) from report_owe_fee rof where rof.payer_obj_id = t.room_id and rof.payer_obj_type = '3333'
  50. ) oweAmount
  51. from building_room t
  52. INNER JOIN building_unit bu on t.unit_id = bu.unit_id and bu.status_cd = '0'
  53. inner join f_floor ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
  54. LEFT JOIN building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  55. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  56. left join t_dict td on t.state = td.status_cd and td.table_name = 'building_room' and td.table_columns = 'state'
  57. where t.status_cd = '0'
  58. and t.community_id = #{communityId}
  59. and bu.unit_id = #{unitId}
  60. order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED) asc
  61. </select>
  62. <select id="queryCarStructures" parameterType="Map" resultType="Map">
  63. select pa.num areaNum,ps.num,t.car_num carNum,br.room_id roomId,br.room_num roomNum,br.section,
  64. br.state,bu.unit_id unitId,bu.unit_num unitNum,ff.floor_id floorId,ff.floor_num floorNum,
  65. bo.age,bo.id_card idCard,bo.link,bo.member_id memberId,bo.`name`,bo.`name` ownerName,bo.owner_id ownerId,
  66. (
  67. select if (SUM(rof.amount_owed)!='',SUM(rof.amount_owed),0) from report_owe_fee rof where rof.payer_obj_id = t.car_id and rof.payer_obj_type = '6666'
  68. ) oweAmount
  69. from owner_car t
  70. INNER join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
  71. INNER JOIN building_owner_room_rel borr on bo.owner_id = borr.owner_id and borr.status_cd = '0'
  72. INNER join building_room br on borr.room_id = br.room_id and br.status_cd = '0'
  73. INNER JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
  74. inner join f_floor ff on bu.floor_id = ff.floor_id and ff.status_cd = '0'
  75. LEFT JOIN parking_space ps on t.ps_id = ps.ps_id and ps.status_cd = '0'
  76. LEFT JOIN parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
  77. where t.status_cd = '0'
  78. and t.community_id = #{communityId}
  79. and bu.unit_id = #{unitId}
  80. order by t.car_num
  81. </select>
  82. <!-- 查询房屋个数 add by wuxw 2018-07-03 -->
  83. <select id="getCarCount" parameterType="com.java110.dto.report.ReportCarDto" resultType="Map">
  84. select count(1) count
  85. from owner_car t
  86. where t.status_cd = '0'
  87. <if test="state !=null and state != ''">
  88. and t.state= #{state}
  89. </if>
  90. <if test="leaseTypes !=null ">
  91. and t.lease_type in
  92. <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
  93. #{item}
  94. </foreach>
  95. </if>
  96. <if test="communityId !=null and communityId != ''">
  97. and t.community_id= #{communityId}
  98. </if>
  99. </select>
  100. <!-- 查询 房屋 楼栋 单元 业主 -->
  101. <select id="getCarParkingSpace" parameterType="com.java110.dto.report.ReportCarDto"
  102. resultType="com.java110.dto.report.ReportCarDto">
  103. select t.car_brand carBrand,t.car_color carColor,t.car_id carId,t.car_num carNum,t.car_type carType,
  104. t.community_id communityId,bo.`name` ownerName,bo.id_card idCard,bo.link,bo.owner_id ownerId,ps.ps_id psId,
  105. ps.num,pa.pa_id paId,pa.num areaNum,ps.state,t.start_time startTime,t.end_time endTime
  106. from owner_car t
  107. INNER JOIN building_owner bo on t.owner_id = bo.member_id and t.status_cd = '0'
  108. left join parking_space ps on t.ps_id = ps.ps_id and ps.status_cd = '0'
  109. left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
  110. where t.status_cd = '0'
  111. <if test="state !=null and state != ''">
  112. and t.state= #{state}
  113. </if>
  114. <if test="leaseTypes !=null ">
  115. and t.lease_type in
  116. <foreach collection="leaseTypes" item="item" open="(" close=")" separator=",">
  117. #{item}
  118. </foreach>
  119. </if>
  120. <if test="communityId !=null and communityId != ''">
  121. and t.community_id= #{communityId}
  122. </if>
  123. <if test="page != -1 and page != null ">
  124. limit #{page}, #{row}
  125. </if>
  126. </select>
  127. <!-- 查询小区信息 add by wuxw 2018-07-03 -->
  128. <select id="getCommunitys" parameterType="Map" resultType="Map">
  129. select t.address,t.nearby_landmarks,t.nearby_landmarks nearbyLandmarks,
  130. t.city_code,t.city_code cityCode,t.name,t.status_cd,t.status_cd statusCd,t.tel,
  131. t.community_id,t.community_id communityId,t.b_id,t.b_id bId,t.map_y,t.map_y mapY,
  132. t.map_x,t.map_x mapX,t.state,ca.area_code areaCode,ca.area_name areaName,
  133. ca.parent_area_code parentAreaCode,ca.parent_area_name parentAreaName,
  134. t.community_area communityArea
  135. from s_community t,city_area ca
  136. where t.status_cd = '0'
  137. and t.city_code = ca.area_code
  138. and ca.status_cd = '0'
  139. <if test="address !=null and address != ''">
  140. and t.address= #{address}
  141. </if>
  142. <if test="nearbyLandmarks !=null and nearbyLandmarks != ''">
  143. and t.nearby_landmarks= #{nearbyLandmarks}
  144. </if>
  145. <if test="cityCode !=null and cityCode != ''">
  146. and t.city_code= #{cityCode}
  147. </if>
  148. <if test="name !=null and name != ''">
  149. and t.name like concat('%',#{name},'%')
  150. </if>
  151. <if test="statusCd !=null and statusCd != ''">
  152. and t.status_cd= #{statusCd}
  153. </if>
  154. <if test="communityId !=null and communityId != ''">
  155. and t.community_id= #{communityId}
  156. </if>
  157. <if test="communityIds !=null">
  158. and t.community_id in
  159. <foreach collection="communityIds" item="item" open="(" close=")" separator=",">
  160. #{item}
  161. </foreach>
  162. </if>
  163. <if test="bId !=null and bId != ''">
  164. and t.b_id= #{bId}
  165. </if>
  166. <if test="mapY !=null and mapY != ''">
  167. and t.map_y= #{mapY}
  168. </if>
  169. <if test="mapX !=null and mapX != ''">
  170. and t.map_x= #{mapX}
  171. </if>
  172. <if test="state !=null and state != ''">
  173. and t.state= #{state}
  174. </if>
  175. order by t.create_time ASC
  176. <if test="page != -1 and page != null ">
  177. limit #{page}, #{row}
  178. </if>
  179. </select>
  180. <!-- 查询无效费用 add by wuxw 2018-07-03 -->
  181. <select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
  182. select t.fee_id feeId from pay_fee t
  183. inner join pay_fee_config pfc on t.config_id = pfc.config_id
  184. inner join report_fee_year_collection rfyc on t.fee_id = rfyc.fee_id and rfyc.status_cd = '0'
  185. where (t.status_cd = '1' or pfc.status_cd = '1')
  186. and t.community_id= #{communityId}
  187. </select>
  188. <!--清理报表 无效数据-->
  189. <update id="deleteInvalidFee" parameterType="Map">
  190. delete from report_fee_year_collection where fee_id in
  191. <foreach collection="feeIds" item="item" open="(" close=")" separator=",">
  192. #{item}
  193. </foreach>
  194. and community_id = #{communityId}
  195. </update>
  196. <!-- 查询无效费用 add by wuxw 2018-07-03 -->
  197. <select id="queryRoomsTree" parameterType="Map" resultType="Map">
  198. SELECT t.room_id,t.room_id roomId,t.layer,t.room_num,
  199. t.room_num roomNum,t.unit_id,u.`unit_num` unitNum,
  200. u.unit_id unitId,f.floor_id floorId,f.floor_num floorNum,t.`community_id` communityId,bo.owner_id ownerId ,bo.`name` ownerName ,bo.link link
  201. FROM building_room t
  202. inner join building_unit u on t.`unit_id` = u.`unit_id` and u.`status_cd` = '0'
  203. inner JOIN f_floor f on u.`floor_id` = f.`floor_id` AND f.`community_id` = t.`community_id` AND f.`status_cd` =
  204. '0'
  205. left join building_owner_room_rel borr on t.room_id = borr.room_id and borr.status_cd = '0'
  206. left join building_owner bo on borr.owner_id = bo.member_id and bo.status_cd = '0'
  207. WHERE 1 =1
  208. and t.status_cd = '0'
  209. and u.unit_id = #{unitId}
  210. and t.community_id= #{communityId}
  211. order by CONVERT(t.layer,SIGNED),CONVERT(t.room_num,SIGNED)
  212. </select>
  213. <select id="queryHisOwnerCarCount" parameterType="Map" resultType="Map">
  214. select count(1) count
  215. from business_owner_car t
  216. left join c_business cb on t.b_id = cb.b_id
  217. left join c_orders co on cb.o_id = co.o_id
  218. left join u_user uu on co.user_id = uu.user_id
  219. left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
  220. left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
  221. left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
  222. left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
  223. left join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
  224. where 1=1
  225. and t.car_num = #{carNum}
  226. and t.community_id= #{communityId}
  227. </select>
  228. <select id="queryHisOwnerCars" parameterType="Map" resultType="Map">
  229. select t.car_color carColor,t.car_brand carBrand,t.car_type carType,t1.name
  230. carTypeName,
  231. t.car_num carNum,t.ps_id psId,t.remark,
  232. t.owner_id ownerId,t.b_id bId,t.user_id userId,t.car_id carId ,t.create_time
  233. createTime,t.community_id communityId,t2.name stateName,
  234. t.start_time startTime,t.end_time endTime,t.state,
  235. t.car_type_cd carTypeCd,t.member_id memberId,t.lease_type leaseType,
  236. t3.name leaseTypeName,t4.name carTypeCdName,t.operate,uu.`name` userName,bo.`name` ownerName,bo.link
  237. from business_owner_car t
  238. left join c_business cb on t.b_id = cb.b_id
  239. left join c_orders co on cb.o_id = co.o_id
  240. left join u_user uu on co.user_id = uu.user_id
  241. left join t_dict t1 on t.car_type=t1.status_cd and t1.table_name='owner_car' and t1.table_columns = 'car_type'
  242. left join t_dict t2 on t.state=t2.status_cd and t2.table_name='owner_car' and t2.table_columns = 'state'
  243. left join t_dict t3 on t.lease_type = t3.status_cd and t3.table_name = 'owner_car' and t3.table_columns = 'lease_type'
  244. left join t_dict t4 on t.car_type_cd=t4.status_cd and t4.table_name='owner_car' and t4.table_columns = 'car_type_cd'
  245. left join building_owner bo on t.owner_id = bo.member_id and bo.status_cd = '0'
  246. where 1=1
  247. and t.car_num = #{carNum}
  248. and t.community_id= #{communityId}
  249. order by t.create_time desc,t.operate
  250. <if test="page != -1 and page != null ">
  251. limit #{page}, #{row}
  252. </if>
  253. </select>
  254. <select id="queryHisOwnerCount" parameterType="Map" resultType="Map">
  255. select count(1) count
  256. from business_building_owner t
  257. left join c_business cb on t.b_id = cb.b_id
  258. left join c_orders co on cb.o_id = co.o_id
  259. left join u_user uu on co.user_id = uu.user_id
  260. where 1=1
  261. and t.member_id = #{memberId}
  262. and t.community_id = #{communityId}
  263. </select>
  264. <select id="queryHisOwners" parameterType="Map" resultType="Map">
  265. select t.operate,t.sex,t.name,t.link,t.remark,t.owner_id ownerId,t.b_id bId,
  266. t.age,t.member_id memberId,
  267. t.owner_type_cd ownerTypeCd,t.community_id communityId,t.owner_flag ownerFlag,
  268. t.id_card idCard,t.state,t.address,t.create_time createTime,uu.`name` userName
  269. from business_building_owner t
  270. left join c_business cb on t.b_id = cb.b_id
  271. left join c_orders co on cb.o_id = co.o_id
  272. left join u_user uu on co.user_id = uu.user_id
  273. where 1=1
  274. and t.member_id = #{memberId}
  275. and t.community_id = #{communityId}
  276. order by t.create_time desc,t.operate
  277. <if test="page != -1 and page != null ">
  278. limit #{page}, #{row}
  279. </if>
  280. </select>
  281. </mapper>