OwnerServiceDaoImplMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  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="ownerServiceDaoImpl">
  6. <!-- 保存业主信息 add by wuxw 2018-07-03 -->
  7. <insert id="saveBusinessOwnerInfo" parameterType="Map">
  8. insert into business_building_owner(
  9. operate,sex,name,link,remark,owner_id,b_id,user_id,age,member_id,owner_type_cd,community_id,id_card,state,owner_flag
  10. ) values (
  11. #{operate},#{sex},#{name},#{link},#{remark},#{ownerId},#{bId},#{userId},#{age},#{memberId},#{ownerTypeCd},#{communityId},#{idCard},#{state},#{ownerFlag}
  12. )
  13. </insert>
  14. <!-- 查询业主信息(Business) add by wuxw 2018-07-03 -->
  15. <select id="getBusinessOwnerInfo" parameterType="Map" resultType="Map">
  16. select t.operate,t.sex,t.name,t.link,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,
  17. t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,
  18. t.owner_type_cd ownerTypeCd,t.community_id,t.community_id communityId,t.owner_flag,t.owner_flag ownerFlag,
  19. t.id_card, t.id_card idCard,t.state
  20. from business_building_owner t
  21. where 1 =1
  22. <if test="operate !=null and operate != ''">
  23. and t.operate= #{operate}
  24. </if>
  25. <if test="sex !=null ">
  26. and t.sex= #{sex}
  27. </if>
  28. <if test="name !=null and name != ''">
  29. and t.name = #{name}
  30. </if>
  31. <if test="link !=null and link != ''">
  32. and t.link= #{link}
  33. </if>
  34. <if test="remark !=null and remark != ''">
  35. and t.remark= #{remark}
  36. </if>
  37. <if test="ownerId !=null and ownerId != ''">
  38. and t.owner_id= #{ownerId}
  39. </if>
  40. <if test="communityId !=null and communityId != ''">
  41. and t.community_id= #{communityId}
  42. </if>
  43. <if test="idCard !=null and idCard != ''">
  44. and t.id_card = #{idCard}
  45. </if>
  46. <if test="bId !=null and bId != ''">
  47. and t.b_id= #{bId}
  48. </if>
  49. <if test="userId !=null and userId != ''">
  50. and t.user_id= #{userId}
  51. </if>
  52. <if test="age !=null and age != ''">
  53. and t.age= #{age}
  54. </if>
  55. <if test="state !=null and state != ''">
  56. and t.state= #{state}
  57. </if>
  58. <if test="memberId !=null and memberId != ''">
  59. and t.member_id= #{memberId}
  60. </if>
  61. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  62. and t.owner_type_cd= #{ownerTypeCd}
  63. </if>
  64. </select>
  65. <!-- 保存业主信息至 instance表中 add by wuxw 2018-07-03 -->
  66. <insert id="saveOwnerInfoInstance" parameterType="Map">
  67. insert into building_owner(
  68. sex,name,link,status_cd,remark,owner_id,b_id,user_id,age,member_id,owner_type_cd,community_id,id_card,state,owner_flag
  69. ) select t.sex,t.name,t.link,'0',t.remark,t.owner_id,t.b_id,t.user_id,t.age,t.member_id,t.owner_type_cd,
  70. t.community_id communityId,t.id_card,state,t.owner_flag
  71. from business_building_owner t where 1=1
  72. and t.operate= 'ADD'
  73. <if test="sex !=null">
  74. and t.sex= #{sex}
  75. </if>
  76. <if test="name !=null and name != ''">
  77. and t.name= #{name}
  78. </if>
  79. <if test="link !=null and link != ''">
  80. and t.link= #{link}
  81. </if>
  82. <if test="remark !=null and remark != ''">
  83. and t.remark= #{remark}
  84. </if>
  85. <if test="ownerId !=null and ownerId != ''">
  86. and t.owner_id= #{ownerId}
  87. </if>
  88. <if test="communityId !=null and communityId != ''">
  89. and t.community_id= #{communityId}
  90. </if>
  91. <if test="idCard !=null and idCard != ''">
  92. and t.id_card = #{idCard}
  93. </if>
  94. <if test="bId !=null and bId != ''">
  95. and t.b_id= #{bId}
  96. </if>
  97. <if test="userId !=null and userId != ''">
  98. and t.user_id= #{userId}
  99. </if>
  100. <if test="age !=null and age != ''">
  101. and t.age= #{age}
  102. </if>
  103. <if test="memberId !=null and memberId != ''">
  104. and t.member_id= #{memberId}
  105. </if>
  106. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  107. and t.owner_type_cd= #{ownerTypeCd}
  108. </if>
  109. <if test="state !=null and state != ''">
  110. and t.state= #{state}
  111. </if>
  112. </insert>
  113. <!-- 查询业主信息 add by wuxw 2018-07-03 -->
  114. <select id="getOwnerInfo" parameterType="Map" resultType="Map">
  115. select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,
  116. t.owner_id,t.owner_id ownerId,t.b_id,t.b_id bId,
  117. t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,
  118. t.owner_type_cd ownerTypeCd,t.create_time createTime,t.community_id,
  119. t.community_id communityId,t.id_card, t.id_card idCard,t.state,td.name ownerTypeName,
  120. t.owner_flag,t.owner_flag ownerFlag
  121. <if test="roomIds != null">
  122. , borr.room_id roomId
  123. </if>
  124. from building_owner t,t_dict td
  125. <if test="roomId != null and roomId != ''">
  126. ,building_owner_room_rel borr
  127. </if>
  128. <if test="roomIds != null ">
  129. ,building_owner_room_rel borr
  130. </if>
  131. where 1 = 1
  132. <if test="roomId != null and roomId != ''">
  133. and t.owner_id = borr.owner_id
  134. and borr.status_cd = t.status_cd
  135. and borr.room_id = #{roomId}
  136. </if>
  137. <if test="roomIds != null">
  138. and t.owner_id = borr.owner_id
  139. and borr.status_cd = t.status_cd
  140. and borr.room_id in
  141. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  142. #{item}
  143. </foreach>
  144. </if>
  145. and td.table_name = 'building_owner'
  146. and td.`table_columns` = 'owner_type_cd'
  147. and td.status_cd = t.owner_type_cd
  148. <if test="sex !=null">
  149. and t.sex= #{sex}
  150. </if>
  151. <if test="name !=null and name != ''">
  152. and t.name = #{name}
  153. </if>
  154. <if test="link !=null and link != ''">
  155. and t.link= #{link}
  156. </if>
  157. <if test="statusCd !=null and statusCd != ''">
  158. and t.status_cd= #{statusCd}
  159. </if>
  160. <if test="remark !=null and remark != ''">
  161. and t.remark= #{remark}
  162. </if>
  163. <if test="ownerId !=null and ownerId != ''">
  164. and t.owner_id= #{ownerId}
  165. </if>
  166. <if test="communityId !=null and communityId != ''">
  167. and t.community_id= #{communityId}
  168. </if>
  169. <if test="idCard !=null and idCard != ''">
  170. and t.id_card = #{idCard}
  171. </if>
  172. <if test="bId !=null and bId != ''">
  173. and t.b_id= #{bId}
  174. </if>
  175. <if test="userId !=null and userId != ''">
  176. and t.user_id= #{userId}
  177. </if>
  178. <if test="ownerFlag !=null and ownerFlag != ''">
  179. and t.owner_flag= #{ownerFlag}
  180. </if>
  181. <if test="age !=null and age != ''">
  182. and t.age= #{age}
  183. </if>
  184. <if test="state !=null and state != ''">
  185. and t.state= #{state}
  186. </if>
  187. <if test="memberId !=null and memberId != ''">
  188. and t.member_id= #{memberId}
  189. </if>
  190. <if test="ownerIds != null and ownerIds != ''">
  191. and t.owner_id in
  192. <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
  193. #{item}
  194. </foreach>
  195. </if>
  196. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  197. and t.owner_type_cd= #{ownerTypeCd}
  198. </if>
  199. <if test="ownerTypeCds != null">
  200. and t.owner_type_cd in
  201. <foreach collection="ownerTypeCds" item="item" open="(" close=")" separator=",">
  202. #{item}
  203. </foreach>
  204. </if>
  205. order by t.create_time desc
  206. <if test="page != -1 and page != null ">
  207. limit #{page}, #{row}
  208. </if>
  209. </select>
  210. <!-- 查询业主信息 add by wuxw 2018-07-03 -->
  211. <select id="getOwnerInfoCount" parameterType="Map" resultType="Map">
  212. select count(1) count
  213. from building_owner t
  214. <if test="roomId != null and roomId != ''">
  215. ,building_owner_room_rel borr
  216. </if>
  217. <if test="roomIds != null ">
  218. ,building_owner_room_rel borr
  219. </if>
  220. where 1 =1
  221. <if test="roomId != null and roomId != ''">
  222. and t.owner_id = borr.owner_id
  223. and borr.status_cd = '0'
  224. and borr.room_id = #{roomId}
  225. </if>
  226. <if test="roomIds != null">
  227. and t.owner_id = borr.owner_id
  228. and borr.status_cd = '0'
  229. and borr.room_id in
  230. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  231. #{item}
  232. </foreach>
  233. </if>
  234. <if test="sex !=null">
  235. and t.sex= #{sex}
  236. </if>
  237. <if test="name !=null and name != ''">
  238. and t.name like concat('%',#{name},'%')
  239. </if>
  240. <if test="link !=null and link != ''">
  241. and t.link= #{link}
  242. </if>
  243. <if test="statusCd !=null and statusCd != ''">
  244. and t.status_cd= #{statusCd}
  245. </if>
  246. <if test="remark !=null and remark != ''">
  247. and t.remark= #{remark}
  248. </if>
  249. <if test="ownerId !=null and ownerId != ''">
  250. and t.owner_id= #{ownerId}
  251. </if>
  252. <if test="communityId !=null and communityId != ''">
  253. and t.community_id= #{communityId}
  254. </if>
  255. <if test="idCard !=null and idCard != ''">
  256. and t.id_card = #{idCard}
  257. </if>
  258. <if test="bId !=null and bId != ''">
  259. and t.b_id= #{bId}
  260. </if>
  261. <if test="userId !=null and userId != ''">
  262. and t.user_id= #{userId}
  263. </if>
  264. <if test="ownerFlag !=null and ownerFlag != ''">
  265. and t.owner_flag= #{ownerFlag}
  266. </if>
  267. <if test="age !=null and age != ''">
  268. and t.age= #{age}
  269. </if>
  270. <if test="state !=null and state != ''">
  271. and t.state= #{state}
  272. </if>
  273. <if test="memberId !=null and memberId != ''">
  274. and t.member_id= #{memberId}
  275. </if>
  276. <if test="ownerIds != null and ownerIds != ''">
  277. and t.owner_id in
  278. <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
  279. #{item}
  280. </foreach>
  281. </if>
  282. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  283. and t.owner_type_cd= #{ownerTypeCd}
  284. </if>
  285. </select>
  286. <!-- 修改业主信息 add by wuxw 2018-07-03 -->
  287. <update id="updateOwnerInfoInstance" parameterType="Map">
  288. update building_owner t set t.status_cd = #{statusCd}
  289. <if test="newBId != null and newBId != ''">
  290. ,t.b_id = #{newBId}
  291. </if>
  292. <if test="sex !=null ">
  293. , t.sex= #{sex}
  294. </if>
  295. <if test="name !=null and name != ''">
  296. , t.name= #{name}
  297. </if>
  298. <if test="link !=null and link != ''">
  299. , t.link= #{link}
  300. </if>
  301. <if test="remark !=null and remark != ''">
  302. , t.remark= #{remark}
  303. </if>
  304. <if test="ownerId !=null and ownerId != ''">
  305. , t.owner_id= #{ownerId}
  306. </if>
  307. <if test="userId !=null and userId != ''">
  308. , t.user_id= #{userId}
  309. </if>
  310. <if test="age !=null and age != ''">
  311. , t.age= #{age}
  312. </if>
  313. <if test="state !=null and state != ''">
  314. , t.state= #{state}
  315. </if>
  316. <if test="idCard !=null and idCard != ''">
  317. , t.id_card = #{idCard}
  318. </if>
  319. where 1=1
  320. <if test="bId !=null and bId != ''">
  321. and t.b_id= #{bId}
  322. </if>
  323. <if test="communityId !=null and communityId != ''">
  324. and t.community_id= #{communityId}
  325. </if>
  326. <if test="memberId !=null and memberId != ''">
  327. and t.member_id= #{memberId}
  328. </if>
  329. </update>
  330. <!-- 查询业主数量 add by wuxw 2018-07-03 -->
  331. <select id="queryOwnersCount" parameterType="Map" resultType="Map">
  332. select count(1) count
  333. FROM building_owner t
  334. where 1=1
  335. <if test="sex !=null ">
  336. and t.sex= #{sex}
  337. </if>
  338. <if test="name !=null and name != ''">
  339. and t.name like concat('%',#{name},'%')
  340. </if>
  341. <if test="link !=null and link != ''">
  342. and t.link= #{link}
  343. </if>
  344. <if test="statusCd !=null and statusCd != ''">
  345. and t.status_cd= #{statusCd}
  346. </if>
  347. <if test="remark !=null and remark != ''">
  348. and t.remark= #{remark}
  349. </if>
  350. <if test="ownerId !=null and ownerId != ''">
  351. and t.owner_id= #{ownerId}
  352. </if>
  353. <if test="communityId !=null and communityId != ''">
  354. and t.community_id= #{communityId}
  355. </if>
  356. <if test="idCard !=null and idCard != ''">
  357. and t.id_card = #{idCard}
  358. </if>
  359. <if test="bId !=null and bId != ''">
  360. and t.b_id= #{bId}
  361. </if>
  362. <if test="userId !=null and userId != ''">
  363. and t.user_id= #{userId}
  364. </if>
  365. <if test="ownerFlag !=null and ownerFlag != ''">
  366. and t.owner_flag= #{ownerFlag}
  367. </if>
  368. <if test="age !=null and age != ''">
  369. and t.age= #{age}
  370. </if>
  371. <if test="state !=null and state != ''">
  372. and t.state= #{state}
  373. </if>
  374. <if test="memberId !=null and memberId != ''">
  375. and t.member_id= #{memberId}
  376. </if>
  377. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  378. and t.owner_type_cd= #{ownerTypeCd}
  379. </if>
  380. </select>
  381. <!-- 查询业主数量 add by wuxw 2018-07-03 -->
  382. <select id="queryOwnersCountByCondition" parameterType="Map" resultType="Map">
  383. select count(1) count
  384. FROM building_owner t
  385. WHERE
  386. t.`status_cd` = '0'
  387. <if test="sex !=null ">
  388. and t.sex= #{sex}
  389. </if>
  390. <if test="name !=null and name != ''">
  391. and t.name like concat('%',#{name},'%')
  392. </if>
  393. <if test="link !=null and link != ''">
  394. and t.link= #{link}
  395. </if>
  396. <if test="statusCd !=null and statusCd != ''">
  397. and t.status_cd= #{statusCd}
  398. </if>
  399. <if test="remark !=null and remark != ''">
  400. and t.remark= #{remark}
  401. </if>
  402. <if test="ownerId !=null and ownerId != ''">
  403. and t.owner_id= #{ownerId}
  404. </if>
  405. <if test="communityId !=null and communityId != ''">
  406. and t.community_id= #{communityId}
  407. </if>
  408. <if test="idCard !=null and idCard != ''">
  409. and t.id_card = #{idCard}
  410. </if>
  411. <if test="bId !=null and bId != ''">
  412. and t.b_id= #{bId}
  413. </if>
  414. <if test="userId !=null and userId != ''">
  415. and t.user_id= #{userId}
  416. </if>
  417. <if test="ownerFlag !=null and ownerFlag != ''">
  418. and t.owner_flag= #{ownerFlag}
  419. </if>
  420. <if test="age !=null and age != ''">
  421. and t.age= #{age}
  422. </if>
  423. <if test="memberId !=null and memberId != ''">
  424. and t.member_id= #{memberId}
  425. </if>
  426. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  427. and t.owner_type_cd= #{ownerTypeCd}
  428. </if>
  429. </select>
  430. <!-- 查询业主信息 add by wuxw 2018-07-03 -->
  431. <select id="getOwnerInfoByCondition" parameterType="Map" resultType="Map">
  432. select t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id
  433. bId,
  434. t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,
  435. t.owner_type_cd,t.owner_type_cd ownerTypeCd,t.community_id,
  436. t.community_id communityId,t.id_card, t.id_card idCard
  437. FROM building_owner t
  438. WHERE
  439. t.`status_cd` = '0'
  440. <if test="sex !=null ">
  441. and t.sex= #{sex}
  442. </if>
  443. <if test="name !=null and name != ''">
  444. and t.name like concat('%',#{name},'%')
  445. </if>
  446. <if test="link !=null and link != ''">
  447. and t.link= #{link}
  448. </if>
  449. <if test="statusCd !=null and statusCd != ''">
  450. and t.status_cd= #{statusCd}
  451. </if>
  452. <if test="remark !=null and remark != ''">
  453. and t.remark= #{remark}
  454. </if>
  455. <if test="ownerId !=null and ownerId != ''">
  456. and t.owner_id= #{ownerId}
  457. </if>
  458. <if test="communityId !=null and communityId != ''">
  459. and t.community_id= #{communityId}
  460. </if>
  461. <if test="idCard !=null and idCard != ''">
  462. and t.id_card = #{idCard}
  463. </if>
  464. <if test="bId !=null and bId != ''">
  465. and t.b_id= #{bId}
  466. </if>
  467. <if test="userId !=null and userId != ''">
  468. and t.user_id= #{userId}
  469. </if>
  470. <if test="ownerFlag !=null and ownerFlag != ''">
  471. and t.owner_flag= #{ownerFlag}
  472. </if>
  473. <if test="age !=null and age != ''">
  474. and t.age= #{age}
  475. </if>
  476. <if test="memberId !=null and memberId != ''">
  477. and t.member_id= #{memberId}
  478. </if>
  479. <if test="ownerIds != null and ownerIds != ''">
  480. and t.owner_id in
  481. <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
  482. #{item}
  483. </foreach>
  484. </if>
  485. <if test="ownerTypeCd !=null and ownerTypeCd != ''">
  486. and t.owner_type_cd= #{ownerTypeCd}
  487. </if>
  488. <if test="page != -1 and page != null ">
  489. limit #{page}, #{row}
  490. </if>
  491. </select>
  492. <!-- 查询未入驻业主 总数 -->
  493. <select id="queryNoEnterRoomOwnerCount" parameterType="Map" resultType="Map">
  494. select
  495. COUNT(1) count
  496. from
  497. building_owner o
  498. left join building_owner_room_rel orr on o.owner_id = orr.owner_id and orr.status_cd = '0'
  499. where o.status_cd = '0'
  500. and o.owner_type_cd = '1001'
  501. and o.community_id = #{communityId}
  502. and orr.rel_id is null
  503. </select>
  504. <!-- queryOwnersByRoom -->
  505. <!-- 根据房屋查询业主信息 -->
  506. <select id="queryOwnersByRoom" parameterType="Map" resultType="Map">
  507. SELECT t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,t.owner_id,t.owner_id ownerId,t.b_id,t.b_id
  508. bId,
  509. t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,t.owner_type_cd,t.owner_type_cd ownerTypeCd,
  510. r.`room_id` roomId,r.`room_num` roomNum,t.community_id,t.community_id communityId,t.id_card, t.id_card idCard
  511. FROM building_room r,building_owner_room_rel orr,building_owner t
  512. WHERE r.`room_id` = orr.`room_id`
  513. AND orr.`owner_id` = t.`owner_id`
  514. <if test="roomId !=null and roomId != ''">
  515. AND r.`room_id` = #{roomId}
  516. </if>
  517. <if test="roomIds != null ">
  518. and r.room_id in
  519. <foreach collection="roomIds" item="item" open="(" close=")" separator=",">
  520. #{item}
  521. </foreach>
  522. </if>
  523. <if test="communityId !=null and communityId != ''">
  524. and t.community_id= #{communityId}
  525. </if>
  526. and t.owner_type_cd = '1001'
  527. AND r.`status_cd` = '0'
  528. AND orr.`status_cd` = '0'
  529. AND t.`status_cd` = '0'
  530. </select>
  531. <!-- 根据停车位查询 -->
  532. <select id="queryOwnersByParkingSpace" parameterType="Map" resultType="Map">
  533. select ps.num,ps.ps_id psId,t.sex,t.name,t.link,t.status_cd,t.status_cd statusCd,t.remark,t.owner_id,t.owner_id
  534. ownerId,t.b_id,t.b_id bId,
  535. t.user_id,t.user_id userId,t.age,t.member_id,t.member_id memberId,
  536. t.owner_type_cd,t.owner_type_cd ownerTypeCd,t.id_card, t.id_card idCard
  537. from p_parking_space ps , owner_car oc,building_owner t
  538. where ps.ps_id = oc.ps_id
  539. and oc.owner_id = t.owner_id
  540. AND oc.`status_cd` = '0'
  541. AND ps.`status_cd` = '0'
  542. and oc.car_type_cd='1001'
  543. AND t.`status_cd` = '0'
  544. <if test="psIds != null ">
  545. and ps.ps_id in
  546. <foreach collection="psIds" item="item" open="(" close=")" separator=",">
  547. #{item}
  548. </foreach>
  549. </if>
  550. <if test="psId !=null and psId != ''">
  551. AND ps.`ps_id` = #{psId}
  552. </if>
  553. </select>
  554. <select id="queryOwnerLogsByRoom" parameterType="Map" resultType="Map">
  555. SELECT
  556. bo.owner_id ownerId,
  557. bo.`name`,
  558. bo.link,
  559. t.start_time startTime,
  560. t.end_time endTime,
  561. t.create_time createTime,
  562. t.room_id roomId
  563. FROM
  564. business_building_owner_room_rel t
  565. INNER JOIN building_owner bo ON t.owner_id = bo.owner_id AND bo.status_cd = '0' AND bo.community_id = #{communityId}
  566. WHERE
  567. t.operate = 'ADD'
  568. AND t.room_id = #{roomId}
  569. ORDER BY
  570. t.create_time DESC
  571. <if test="page != -1 and page != null ">
  572. limit #{page}, #{row}
  573. </if>
  574. </select>
  575. <select id="queryOwnerLogsCountByRoom" parameterType="Map" resultType="Map">
  576. select
  577. COUNT(1) count
  578. from business_building_owner_room_rel t
  579. inner join building_owner bo on t.owner_id = bo.owner_id and bo.status_cd = '0' and bo.community_id = #{communityId}
  580. where t.operate = 'ADD'
  581. and t.room_id = #{roomId}
  582. order by t.create_time desc
  583. </select>
  584. </mapper>