BuildingDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="platform.modules.carrier.dao.BuildingDao">
  4. <select id="getParkBuildings" resultType="platform.modules.carrier.entity.Building">
  5. select * from ic_building
  6. where del_flag = 0
  7. <if test="condition.parkId != null and condition.parkId !=''">
  8. and park_id = #{condition.parkId}
  9. </if>
  10. <if test="condition.is_use != null and condition.is_use !=''">
  11. and is_use = #{condition.is_use}
  12. </if>
  13. <if test="condition.totalFloors != null and condition.totalFloors !=''">
  14. and floor_count = #{condition.totalFloors}
  15. </if>
  16. <if test="condition.buildName != null and condition.buildName !=''">
  17. and build_name like concat('%', concat(#{condition.buildName},'%'))
  18. </if>
  19. <if test="condition.no != null and condition.no !=''">
  20. and no = #{condition.no}
  21. </if>
  22. <if test="condition.carrierAttriute != null and condition.carrierAttriute !=''">
  23. and carrier_attriute = #{condition.carrierAttriute}
  24. </if>
  25. <if test="condition.carrierNature != null and condition.carrierNature !=''">
  26. and carrier_nature = #{condition.carrierNature}
  27. </if>
  28. <if test="condition.build_use != null and condition.build_use != ''">
  29. and build_use = #{condition.build_use}
  30. </if>
  31. order by create_time desc
  32. </select>
  33. <select id="getBuildingsByQuery" resultType="platform.modules.carrier.entity.Building">
  34. select
  35. DISTINCT b.*,
  36. p.name as park_name,
  37. s.name as street_name,
  38. p.contact,
  39. p.phone
  40. from ic_building b
  41. left join y_floor f on f.building_id = b.id
  42. left join ic_park p on p.id = b.park_id
  43. left join s_street s on s.id = p.street_id
  44. where b.del_flag = 0 and b.is_use = 1 and f.is_use = 1 and f.del_flag = 0 and p.is_start = 1 and p.del_flag = 0
  45. <if test="query.streetId != null and query.streetId != ''">
  46. and s.id in ( #{query.streetId} )
  47. </if>
  48. <if test="query.parkId != null and query.parkId != ''">
  49. and p.id in (#{query.parkId})
  50. </if>
  51. <choose>
  52. <when test="query.count != null and query.count == 1">
  53. <choose>
  54. <when test="query.demandDate != null and query.demandDate != ''">
  55. and (f.remain_area +
  56. (
  57. IFNULL(
  58. (
  59. SELECT
  60. IFNULL(SUM( cf.area ),0)
  61. FROM
  62. ic_contract_floor cf
  63. WHERE
  64. cf.floor_id = f.id AND cf.status = 2
  65. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  66. )
  67. , 0 )
  68. ))
  69. >0
  70. <if test="query.minArea != null and query.minArea != ''">
  71. and (f.remain_area +
  72. (
  73. IFNULL(
  74. (
  75. SELECT
  76. IFNULL(SUM( cf.area ),0)
  77. FROM
  78. ic_contract_floor cf
  79. WHERE
  80. cf.floor_id = f.id AND cf.status = 2
  81. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  82. ), 0)
  83. ))
  84. >= #{query.minArea}
  85. </if>
  86. <if test="query.maxArea != null and query.maxArea != ''">
  87. and (f.remain_area +
  88. (
  89. IFNULL(
  90. (
  91. SELECT
  92. IFNULL(SUM( cf.area ),0)
  93. FROM
  94. ic_contract_floor cf
  95. WHERE
  96. cf.floor_id = f.id AND cf.status = 2
  97. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  98. ),0)
  99. ))
  100. <![CDATA[ <= ]]> #{query.maxArea}
  101. </if>
  102. </when>
  103. <otherwise>
  104. and f.remain_area > 0
  105. <if test="query.minArea != null and query.minArea != ''">
  106. and f.remain_area >= #{query.minArea}
  107. </if>
  108. <if test="query.maxArea != null and query.maxArea != ''">
  109. and f.remain_area <![CDATA[ <= ]]> #{query.maxArea}
  110. </if>
  111. </otherwise>
  112. </choose>
  113. </when>
  114. <otherwise>
  115. <choose>
  116. <when test="query.demandDate != null and query.demandDate != ''">
  117. and ((select IFNULL(SUM(remain_area),0) from y_floor where building_id = b.id AND del_flag = 0 AND is_use = 1) +
  118. (
  119. IFNULL(
  120. (
  121. SELECT
  122. IFNULL(SUM( cf.area ),0)
  123. FROM
  124. ic_contract_floor cf
  125. WHERE
  126. cf.building_id = b.id AND cf.status = 2
  127. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  128. ),
  129. 0 )
  130. ))
  131. > 0
  132. <if test="query.minArea != null and query.minArea != ''">
  133. and ((select IFNULL(SUM(remain_area),0) from y_floor where building_id = b.id AND del_flag = 0 AND is_use = 1) +
  134. (
  135. IFNULL(
  136. (
  137. SELECT
  138. IFNULL(SUM( cf.area ),0)
  139. FROM
  140. ic_contract_floor cf
  141. WHERE
  142. cf.building_id = b.id AND cf.status = 2
  143. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  144. ),
  145. 0)
  146. ))
  147. >= #{query.minArea}
  148. </if>
  149. <if test="query.maxArea != null and query.maxArea != ''">
  150. and ((select IFNULL(SUM(remain_area),0) from y_floor where building_id = b.id AND del_flag = 0 AND is_use = 1) +
  151. (
  152. IFNULL(
  153. (
  154. SELECT
  155. IFNULL(SUM( cf.area ),0)
  156. FROM
  157. ic_contract_floor cf
  158. WHERE
  159. cf.building_id = b.id AND cf.status = 2
  160. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  161. ),
  162. 0 )
  163. ))
  164. <![CDATA[ <= ]]> #{query.maxArea}
  165. </if>
  166. <if test="query.minFloorArea != null and query.minFloorArea != ''">
  167. and (f.remain_area +
  168. (
  169. IFNULL(
  170. (
  171. SELECT
  172. IFNULL(SUM( cf.area ),0)
  173. FROM
  174. ic_contract_floor cf
  175. WHERE
  176. cf.floor_id = f.id AND cf.status = 2
  177. AND cf.contract_end > NOW() AND cf.contract_end <![CDATA[ < ]]> #{query.demandDate}
  178. ),
  179. 0)
  180. ))
  181. <![CDATA[ >= ]]> #{query.minFloorArea}
  182. </if>
  183. </when>
  184. <otherwise>
  185. and (select IFNULL(SUM(remain_area),0) from y_floor where building_id = b.id AND del_flag = 0 AND is_use = 1) > 0
  186. <if test="query.minArea != null and query.minArea != ''">
  187. and (select IFNULL(SUM(remain_area),0) from y_floor where building_id = b.id AND del_flag = 0 AND is_use = 1) >= #{query.minArea}
  188. </if>
  189. <if test="query.maxArea != null and query.maxArea != ''">
  190. and (select IFNULL(SUM(remain_area),0) from y_floor where building_id = b.id AND del_flag = 0 AND is_use = 1) <![CDATA[ <= ]]> #{query.maxArea}
  191. </if>
  192. </otherwise>
  193. </choose>
  194. </otherwise>
  195. </choose>
  196. <if test="query.carrierAttriute != null and query.carrierAttriute != ''">
  197. and b.carrier_attriute in (#{query.carrierAttriute})
  198. </if>
  199. <if test="query.carrierNature != null and query.carrierNature != ''">
  200. and b.carrier_nature = #{query.carrierNature}
  201. </if>
  202. <if test="query.carrierStructure != null and query.carrierStructure != ''">
  203. and b.carrier_structure in (#{query.carrierStructure})
  204. </if>
  205. <if test="query.landingPlatformCount != null and query.landingPlatformCount != ''">
  206. and b.landing_platform_count >= #{query.landingPlatformCount}
  207. </if>
  208. <if test="query.intercolumniation != null and query.intercolumniation != ''">
  209. and b.intercolumniation >= #{query.intercolumniation}
  210. </if>
  211. <if test="query.spqn != null and query.spqn != ''">
  212. and b.spqn in (#{query.spqn})
  213. </if>
  214. <if test="query.liftLoadBearing != null and query.liftLoadBearing != ''">
  215. and b.lift_load_bearing >= #{query.liftLoadBearing}
  216. </if>
  217. <if test="query.capacity != null and query.capacity != ''">
  218. and f.capacity >= #{query.capacity}
  219. </if>
  220. <if test="query.floorHeight != null and query.floorHeight != ''">
  221. and b.floor_height is not null and b.floor_height >= #{query.floorHeight}
  222. </if>
  223. <if test="query.build_use != null and query.build_use != ''">
  224. and b.build_use in (#{query.build_use})
  225. </if>
  226. </select>
  227. <select id="findBuildingList" resultType="platform.modules.carrier.dto.BuildingFloorVo"
  228. parameterType="platform.modules.carrier.dto.CustomSearchCondition">
  229. SELECT
  230. park.name park_name,
  231. building.id building_id,
  232. building.build_name building_name,
  233. floor.floor floor,
  234. floor.id floor_id,
  235. floor.floor_height,
  236. floor.capacity,
  237. floor.is_use isUse
  238. FROM
  239. y_floor floor
  240. JOIN ic_building building ON building.id = floor.building_id
  241. LEFT JOIN ic_park park ON park.id = building.park_id
  242. WHERE
  243. floor.del_flag = 0 and floor.is_use = 1
  244. AND building.del_flag = 0 and building.is_use = 1
  245. AND park.del_flag = 0 AND park.is_start = 1
  246. <if test="condition.park_id != null and condition.park_id != ''">
  247. AND park.id = #{condition.park_id}
  248. </if>
  249. <if test="condition.building_id != null and condition.building_id != ''">
  250. AND building.id = #{condition.building_id}
  251. </if>
  252. <if test="condition.building_name != null and condition.building_name != ''">
  253. AND building.build_name like concat('%', concat(#{condition.building_name}, '%'))
  254. </if>
  255. <if test="condition.isUse != null and condition.isUse != ''">
  256. AND floor.is_use = #{condition.isUse}
  257. </if>
  258. ORDER BY building.id DESC
  259. </select>
  260. <select id="findBuildingByCondition" resultType="platform.modules.carrier.entity.Building">
  261. select * from ic_building b
  262. left join ic_park p on p.id = b.park_id
  263. left join s_street s on s.id = p.street_id
  264. where b.del_flag = 0 and p.del_flag = 0 and s.del_flag = 0
  265. <if test="condition.no != null and condition.no != ''">
  266. and b.`no` like concat('%', concat(#{condition.no}, '%'))
  267. </if>
  268. <if test="condition.buildName != null and condition.buildName != ''">
  269. and b.build_name like concat('%', concat(#{condition.buildName}, '%'))
  270. </if>
  271. <if test="condition.streetNo != null and condition.streetNo != ''">
  272. and s.`no` = #{condition.streetNo}
  273. </if>
  274. <if test="condition.parkNo != null and condition.parkNo != ''">
  275. and p.`no` = #{condition.parkNo}
  276. </if>
  277. <if test="condition.streetId != null and condition.streetId != ''">
  278. and s.id = #{condition.streetId}
  279. </if>
  280. <if test="condition.parkId != null and condition.parkId != ''">
  281. and b.park_id = #{condition.parkId}
  282. </if>
  283. <if test="condition.minArea != null and condition.minArea != ''">
  284. and b.area >= #{condition.minArea}
  285. </if>
  286. <if test="condition.maxArea != null and condition.maxArea != ''">
  287. and b.area <![CDATA[ <= ]]> #{condition.maxArea}
  288. </if>
  289. <if test="condition.totalFloors != null and condition.totalFloors != ''">
  290. and b.floor_count = #{condition.totalFloors}
  291. </if>
  292. <if test="condition.build_use != null and condition.build_use != ''">
  293. and b.build_use = #{condition.build_use}
  294. </if>
  295. </select>
  296. <update id="updateNoBatch" parameterType="list">
  297. update ic_building
  298. <trim prefix="set" suffixOverrides=",">
  299. <trim prefix="no =case" suffix="end,">
  300. <foreach collection="list" item="i" index="index">
  301. <if test="i.no!=null">
  302. when id=#{i.id} then #{i.no}
  303. </if>
  304. </foreach>
  305. </trim>
  306. </trim>
  307. where
  308. <foreach collection="list" separator="or" item="i" index="index" >
  309. id=#{i.id}
  310. </foreach>
  311. </update>
  312. <select id="getBuildingStatistic" resultType="platform.modules.carrier.entity.Building">
  313. SELECT
  314. b.*
  315. FROM
  316. ic_building b
  317. WHERE
  318. b.del_flag = FALSE AND b.is_use = 1
  319. AND b.park_id = #{condition.parkId}
  320. <if test="condition.is_use != null and condition.is_use !=''">
  321. and b.is_use = #{condition.is_use}
  322. </if>
  323. <if test="condition.totalFloors != null and condition.totalFloors !=''">
  324. and b.floor_count = #{condition.totalFloors}
  325. </if>
  326. <if test="condition.buildName != null and condition.buildName !=''">
  327. and b.build_name like concat('%', concat(#{condition.buildName},'%'))
  328. </if>
  329. <if test="condition.no != null and condition.no !=''">
  330. and b.no like concat('%', concat(#{condition.no},'%'))
  331. </if>
  332. <if test="condition.carrierAttriute != null and condition.carrierAttriute !=''">
  333. and b.carrier_attriute = #{condition.carrierAttriute}
  334. </if>
  335. <if test="condition.carrierNature != null and condition.carrierNature !=''">
  336. and b.carrier_nature = #{condition.carrierNature}
  337. </if>
  338. <if test="condition.build_use != null and condition.build_use != ''">
  339. and b.build_use = #{condition.build_use}
  340. </if>
  341. order by b.create_time desc
  342. </select>
  343. <select id="getBuildAreaStatistic" resultType="platform.modules.carrier.dto.CarrierLibraryResult">
  344. SELECT
  345. IFNULL(SUM( f.remain_area ), 0) AS sumRestArea
  346. FROM
  347. ic_building b
  348. LEFT JOIN y_floor f ON f.building_id = b.id
  349. WHERE
  350. b.del_flag = FALSE AND b.is_use = 1 AND f.del_flag = FALSE AND f.is_use = 1
  351. and b.id = #{id}
  352. </select>
  353. <select id="getBuildRentAreaStatistic" resultType="java.lang.Double">
  354. SELECT
  355. IFNULL(SUM( cf.area ),0)
  356. FROM
  357. ic_building b
  358. LEFT JOIN y_floor f ON f.building_id = b.id
  359. LEFT JOIN ic_contract_floor cf ON cf.floor_id = f.id
  360. WHERE
  361. b.del_flag = FALSE AND b.is_use = 1 AND f.del_flag = FALSE AND f.is_use = 1 AND cf.status = 2
  362. AND cf.contract_end > NOW( )
  363. and b.id = #{id}
  364. </select>
  365. <select id="findBuildingNumByParkId" resultType="java.lang.Integer">
  366. select count(id) from ic_building
  367. where park_id = #{id}
  368. </select>
  369. <select id="getBuildingCount" resultType="java.lang.Integer">
  370. select count(id) from ic_building where del_flag = TRUE AND is_use =TRUE AND park_id = #{id}
  371. </select>
  372. <select id="findBuildingRemainArea" resultType="java.lang.Double">
  373. select IFNULL(SUM(remain_area),0)
  374. <if test="query.demandDate != null and query.demandDate != ''">
  375. + IFNULL((SELECT SUM(area) FROM ic_contract_floor WHERE contract_end <![CDATA[ < ]]> #{query.demandDate} AND building_id = #{query.building_id} AND status = 2), 0)
  376. </if>
  377. from y_floor where del_flag = false AND is_use = true AND building_id = #{query.building_id}
  378. </select>
  379. <select id="findBySteetId" resultType="platform.modules.carrier.entity.Building">
  380. SELECT
  381. b.id,
  382. b.build_name,
  383. IFNULL(
  384. b.area,
  385. (
  386. SELECT
  387. SUM(
  388. IFNULL(
  389. area,
  390. ( remain_area + ( SELECT SUM( area ) FROM ic_contract_floor cf WHERE cf.building_id = b.id AND cf.floor = floor AND `status` = 2) )
  391. )
  392. )
  393. FROM
  394. y_floor
  395. WHERE
  396. building_id = b.id
  397. )
  398. ) AS area
  399. FROM
  400. ic_building b
  401. LEFT JOIN ic_park p ON p.id = b.park_id
  402. WHERE
  403. p.street_id = #{id}
  404. AND b.is_use = 1
  405. AND b.del_flag = 0
  406. AND p.del_flag = 0
  407. AND p.is_start = 1
  408. </select>
  409. <select id="findStreetTotalArea" resultType="java.lang.Double">
  410. SELECT
  411. IFNULL(
  412. sum(
  413. IFNULL(
  414. b.area,
  415. (
  416. SELECT
  417. SUM(
  418. IFNULL(
  419. area,
  420. ( remain_area + ( SELECT SUM( area ) FROM ic_contract_floor cf WHERE cf.building_id = b.id AND cf.floor = floor AND `status` = 2) )
  421. )
  422. )
  423. FROM
  424. y_floor
  425. WHERE
  426. building_id = b.id
  427. )
  428. )
  429. )
  430. , 0)
  431. FROM
  432. ic_building b
  433. LEFT JOIN ic_park p ON p.id = b.park_id
  434. WHERE
  435. p.street_id = #{id}
  436. AND b.is_use = 1
  437. AND b.del_flag = 0
  438. AND p.del_flag = 0
  439. AND p.is_start = 1
  440. </select>
  441. <select id="findParkTotalArea" resultType="java.lang.Double">
  442. SELECT
  443. IFNULL(
  444. SUM(IFNULL(
  445. b.area,
  446. (
  447. SELECT
  448. SUM(
  449. IFNULL(
  450. area,
  451. ( remain_area + ( SELECT SUM( area ) FROM ic_contract_floor cf WHERE cf.building_id = b.id AND cf.floor = floor AND `status` = 2) )
  452. )
  453. )
  454. FROM
  455. y_floor
  456. WHERE
  457. building_id = b.id
  458. )
  459. ))
  460. , 0)
  461. FROM
  462. ic_building b
  463. WHERE
  464. b.park_id = #{id}
  465. AND b.is_use = 1
  466. AND b.del_flag = 0
  467. </select>
  468. <select id="findBuildingTotalArea" resultType="java.lang.Double">
  469. SELECT
  470. IFNULL(
  471. b.area,
  472. (
  473. SELECT
  474. SUM(
  475. IFNULL(
  476. area,
  477. (
  478. remain_area + ( SELECT SUM( area ) FROM ic_contract_floor cf WHERE cf.building_id = b.id AND cf.floor = floor AND `status` = 2 )
  479. )
  480. )
  481. )
  482. FROM
  483. y_floor
  484. WHERE
  485. building_id = b.id
  486. )
  487. )
  488. FROM
  489. ic_building b
  490. WHERE
  491. b.id = #{id}
  492. AND b.is_use = 1
  493. AND b.del_flag = 0
  494. </select>
  495. <select id="findCarrierEntryArea" resultType="java.lang.Double">
  496. SELECT
  497. IFNULL(
  498. sum(
  499. IFNULL(
  500. b.area,
  501. (
  502. SELECT
  503. SUM(
  504. IFNULL(
  505. area,
  506. ( remain_area + ( SELECT SUM( area ) FROM ic_contract_floor cf WHERE cf.building_id = b.id AND cf.floor = floor AND `status` = 2) )
  507. )
  508. )
  509. FROM
  510. y_floor
  511. WHERE
  512. building_id = b.id
  513. )
  514. )
  515. )
  516. , 0)
  517. FROM
  518. ic_building b
  519. LEFT JOIN ic_park p ON p.id = b.park_id
  520. WHERE
  521. b.is_use = 1
  522. AND b.del_flag = 0
  523. AND p.del_flag = 0
  524. AND p.is_start = 1
  525. <if test="startTime != null and endTime != ''">
  526. AND b.create_time >= #{startTime}
  527. </if>
  528. <if test="startTime != null and endTime != ''">
  529. AND b.create_time <![CDATA[ <= ]]> #{endTime}
  530. </if>
  531. </select>
  532. <select id="getStreetBuildingDistribution" resultType="platform.modules.carrier.entity.CarrierDistribution">
  533. SELECT
  534. s.id,
  535. s.`name` AS streetName,
  536. COUNT( b.id ) AS buildingCount,
  537. IFNULL(
  538. sum(
  539. IFNULL(
  540. b.area,
  541. (
  542. SELECT
  543. SUM(
  544. IFNULL(
  545. area,
  546. (
  547. remain_area + ( SELECT SUM( area ) FROM ic_contract_floor cf WHERE cf.building_id = b.id AND cf.floor = floor AND `status` = 2 )
  548. )
  549. )
  550. )
  551. FROM
  552. y_floor
  553. WHERE
  554. building_id = b.id
  555. )
  556. )
  557. ),
  558. 0
  559. ) AS buildingArea
  560. FROM
  561. ic_building b
  562. LEFT JOIN ic_park p ON p.id = b.park_id
  563. LEFT JOIN s_street s ON s.id = p.street_id
  564. WHERE
  565. b.del_flag = 0
  566. AND p.del_flag = 0
  567. AND s.del_flag = 0
  568. <if test="condition.buildingCount != null and condition.buildingCount != ''">
  569. AND b.floor_count = #{condition.buildingCount}
  570. </if>
  571. <if test="condition.landing_platform_count != null and condition.landing_platform_count != ''">
  572. AND b.landing_platform_count = #{condition.landing_platform_count}
  573. </if>
  574. <if test="condition.spqn != null and condition.spqn != ''">
  575. AND b.spqn = #{condition.spqn}
  576. </if>
  577. <if test="condition.carrierNature != null and condition.carrierNature != ''">
  578. AND b.carrier_nature = #{condition.carrierNature}
  579. </if>
  580. GROUP BY
  581. s.id
  582. </select>
  583. <select id="factoryBuildingCount" resultType="platform.modules.api.dto.SkyImageCount">
  584. SELECT
  585. b.no,
  586. IFNULL(SUM( f.remain_area ), 0) AS buildingArea,
  587. IFNULL(SUM( cf.area ),0) AS rentArea
  588. FROM
  589. ic_building b
  590. LEFT JOIN y_floor f ON f.building_id = b.id
  591. LEFT JOIN ic_contract_floor cf ON cf.floor_id = f.id
  592. WHERE
  593. b.del_flag = FALSE AND b.is_use = 1 AND f.del_flag = FALSE AND f.is_use = 1 AND cf.status = 2
  594. AND cf.contract_end > NOW( )
  595. </select>
  596. <select id="findEndContractByTime" resultType="platform.modules.api.dto.SkyImageCount">
  597. SELECT
  598. DISTINCT b.`no` as no
  599. FROM
  600. ic_building b
  601. LEFT JOIN ic_contract_floor cf ON cf.building_id = b.id
  602. WHERE b.del_flag = 0 AND b.is_use = 1 AND cf.del_flag = 0
  603. <if test="startTime != null and startTime != ''">
  604. AND cf.contract_end > #{startTime}
  605. </if>
  606. <if test="endTime != null and endTime != ''">
  607. AND cf.contract_end <![CDATA[<]]> #{endTime}
  608. </if>
  609. </select>
  610. <select id="findByNo" resultType="platform.modules.carrier.entity.Building">
  611. select * from ic_building where no = #{no} and del_flag = 0
  612. </select>
  613. </mapper>