| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="platform.modules.carrier.dao.ParkDao">
- <select id="getParkListByCondition" resultType="platform.modules.carrier.entity.Park">
- select * from ic_park
- where del_flag = 0
- <if test="condition.no != null and condition.no != ''">
- and `no` like concat('%', concat(#{condition.no}, '%'))
- </if>
- <if test="condition.parkName != null and condition.parkName != ''">
- and name like concat('%', concat(#{condition.parkName}, '%'))
- </if>
- <if test="condition.area != null and condition.area != ''">
- and area >= #{condition.area}
- </if>
- <if test="condition.restArea != null and condition.restArea != ''">
- and rest_area >= #{condition.restArea}
- </if>
- <if test="condition.restRentArea != null and condition.restRentArea != ''">
- and rest_rent_area >= #{condition.restRentArea}
- </if>
- <if test="condition.transformer != null and condition.transformer != ''">
- and transformer = #{condition.transformer}
- </if>
- <if test="condition.isProperty != null and condition.isProperty != ''">
- and is_property = #{condition.isProperty}
- </if>
- <if test="condition.kvaCompensate != null and condition.kvaCompensate != ''">
- and kva_compensate = #{condition.kvaCompensate}
- </if>
- </select>
- <select id="findParkList" resultType="platform.modules.carrier.entity.Park">
- select
- p.*,
- s.name as streetName,
- (select COALESCE(sum(f.area),0) from y_floor f left join ic_building b on b.id = f.building_id where f.del_flag = false and b.park_id = p.id) AS sumBuildArea,
- (select COALESCE(sum(f.remain_area),0) from y_floor f left join ic_building b on b.id = f.building_id where f.del_flag = false and b.park_id = p.id) AS sumRestArea,
- IFNULL((SELECT COUNT(id) FROM ic_building WHERE park_id = p.id AND del_flag = 0 AND is_use = 1),0) AS buildingNum
- from ic_park p
- left join s_street s on s.id = p.street_id
- where
- p.del_flag = false and p.is_start = 1
- <if test="condition.streetId != null and condition.streetId != ''">
- and s.id = #{condition.streetId}
- </if>
- <if test="condition.parkId != null and condition.parkId != ''">
- and (p.id = #{condition.parkId} or p.id IN (SELECT park_id FROM ic_sub_park WHERE parent_id = #{condition.parkId}))
- </if>
- <if test="condition.parkName != null and condition.parkName != ''">
- and p.name like concat('%', concat(#{condition.parkName}, '%'))
- </if>
- order by CONVERT( p.name USING gbk ) COLLATE gbk_chinese_ci ASC
- </select>
- <update id="updateNoBatch" parameterType="list">
- update ic_park
- <trim prefix="set" suffixOverrides=",">
- <trim prefix="no =case" suffix="end,">
- <foreach collection="list" item="i" index="index">
- <if test="i.no!=null">
- when id=#{i.id} then #{i.no}
- </if>
- </foreach>
- </trim>
- </trim>
- where
- <foreach collection="list" separator="or" item="i" index="index">
- id=#{i.id}
- </foreach>
- </update>
- <resultMap id="parkBuildingList" type="platform.modules.carrier.dto.ParkDto">
- <id column="park_id" jdbcType="INTEGER" property="id"/>
- <result column="name" jdbcType="VARCHAR" property="name"/>
- <collection property="treeList" ofType="platform.modules.carrier.dto.BuildingDto">
- <id column="building_id" jdbcType="INTEGER" property="id"/>
- <result column="build_name" jdbcType="VARCHAR" property="build_name"/>
- <collection property="floorDtos" ofType="platform.modules.carrier.dto.FloorDto">
- <id column="floor_id" jdbcType="INTEGER" property="id"/>
- <result column="area" jdbcType="NUMERIC" property="area"/>
- <result column="remain_area" jdbcType="NUMERIC" property="remain_area"/>
- <result column="floor" jdbcType="VARCHAR" property="floor"/>
- </collection>
- </collection>
- </resultMap>
- <select id="findParkBuildingList" resultMap="parkBuildingList"
- parameterType="platform.modules.carrier.dto.CustomSearchCondition">
- SELECT
- park.id park_id,
- park. NAME,
- building.id building_id,
- building.build_name,
- floor.id floor_id,
- floor.area,
- floor.floor,
- floor.remain_area
- FROM
- ic_park park
- LEFT JOIN ic_building building ON building.park_id = park.id
- LEFT JOIN y_floor floor ON floor.building_id = building.id
- LEFT JOIN s_street street ON street.id = park.street_id
- WHERE park.del_flag = false and park.is_start = true
- <if test="param.street_id != null and param.street_id != '' ">
- AND street.id = #{param.street_id}
- </if>
- <if test="param.park_id != null and param.park_id != '' ">
- AND park.id = #{param.park_id}
- <if test="param.is_parent != null and param.is_parent != ''">
- OR park.id IN (SELECT park_id FROM ic_sub_park WHERE parent_id = #{param.park_id})
- </if>
- </if>
- </select>
- <select id="getParkStatistic" resultType="platform.modules.carrier.dto.CarrierLibraryResult">
- SELECT
- p.id,
- p.NO,
- p.`name`,
- IFNULL((SELECT SUM(b.area) FROM ic_building b WHERE b.park_id = p.id AND del_flag = 0 AND is_use = 1),0) AS sumBuildArea,
- IFNULL((SELECT SUM(f.remain_area) FROM ic_building b LEFT JOIN y_floor f ON f.building_id = b.id WHERE b.park_id = p.id AND b.del_flag = 0 AND b.is_use = 1 AND f.del_flag = 0 AND f.is_use = 1),0) AS sumRestArea,
- IFNULL((SELECT COUNT(id) FROM ic_building WHERE park_id = p.id AND del_flag = 0 AND is_use = 1),0) AS buildingNum
- FROM
- ic_park p
- WHERE
- p.del_flag = FALSE AND p.is_start = TRUE
- AND p.street_id = #{id}
- GROUP BY
- p.id
- </select>
- <select id="getParkAreaStatistic" resultType="platform.modules.carrier.dto.CarrierLibraryResult">
- SELECT
- SUM( b.area ) AS sumBuildArea,
- SUM( f.remain_area ) AS sumRestArea
- FROM
- ic_building b
- LEFT JOIN y_floor f ON f.building_id = b.id
- WHERE
- b.del_flag = FALSE AND f.del_flag = FALSE AND f.is_use = TRUE
- AND b.park_id = #{id}
- </select>
- <select id="getParkRentAreaStatistic" resultType="java.lang.Double">
- SELECT
- IFNULL(SUM( cf.area ),0)
- FROM
- ic_building b
- LEFT JOIN y_floor f ON f.building_id = b.id
- LEFT JOIN ic_contract_floor cf ON cf.floor_id = f.id
- WHERE
- b.del_flag = FALSE
- AND b.park_id = #{id} AND cf.status = 2
- AND cf.contract_end > NOW( )
- </select>
- <select id="findByStreetId" resultType="platform.modules.carrier.entity.Park">
- select id, `name` from ic_park
- WHERE del_flag = FALSE
- AND street_id = #{id}
- </select>
- <select id="findParkNames" resultType="platform.modules.carrier.entity.Park">
- select
- p.id,
- p.name
- from ic_park p
- left join s_street s on s.id = p.street_id
- where
- p.del_flag = false and p.is_start = true and p.is_start = 1
- <if test="condition.streetId != null and condition.streetId != ''">
- and s.id = #{condition.streetId}
- </if>
- <if test="condition.parkId != null and condition.parkId != ''">
- and (p.id = #{condition.parkId} or p.id IN (SELECT park_id FROM ic_sub_park WHERE parent_id = #{condition.parkId}))
- </if>
- order by CONVERT( p.name USING gbk ) COLLATE gbk_chinese_ci ASC
- </select>
- <select id="findParentParkById" resultType="platform.modules.carrier.entity.Park">
- SELECT * FROM ic_sub_park WHERE parent_id = #{park_id}
- </select>
- <select id="findbyNo" resultType="platform.modules.carrier.entity.Park">
- SELECT * FROM ic_park WHERE no = #{no} and del_flag = false
- </select>
- <select id="findBuildingNum" resultType="java.lang.Integer">
- select count(id) from ic_building where park_id = #{id} and del_flag = false and is_use = true
- </select>
- <select id="findParkRemainArea" resultType="java.lang.Double">
- SELECT IFNULL(SUM(f.remain_area),0) FROM ic_building b LEFT JOIN y_floor f ON f.building_id = b.id WHERE b.park_id = #{id} AND b.del_flag = 0 AND b.is_use = 1 AND f.del_flag = 0 AND f.is_use = 1
- </select>
- </mapper>
|