|
|
|
|
<?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="com.techsor.datacenter.business.dao.ex.BasicBuildingMapperExt">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="checkExist" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
CASE
|
|
|
|
|
WHEN name = #{buildingName} THEN 'buildingName'
|
|
|
|
|
WHEN udf_building_id = #{udfBuildingId} THEN 'udfBuildingId'
|
|
|
|
|
END AS conflict_field
|
|
|
|
|
FROM
|
|
|
|
|
basic_building
|
|
|
|
|
WHERE
|
|
|
|
|
flag != 1
|
|
|
|
|
AND (
|
|
|
|
|
name = #{buildingName}
|
|
|
|
|
OR
|
|
|
|
|
udf_building_id = #{udfBuildingId}
|
|
|
|
|
)
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
AND company_id = #{companyId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="buildingId != null">
|
|
|
|
|
AND building_id != #{buildingId}
|
|
|
|
|
</if>
|
|
|
|
|
LIMIT 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getListPage" resultType="com.techsor.datacenter.business.vo.building.BuildingPageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bbuilding.building_id buildingId,
|
|
|
|
|
bbuilding.company_id companyId,
|
|
|
|
|
bcomp.company_name companyName,
|
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
|
bbuilding.address,
|
|
|
|
|
bbuilding.udf_building_id udfBuildingId,
|
|
|
|
|
bbuilding.building_bucket,
|
|
|
|
|
bbuilding.floor_info_list,
|
|
|
|
|
bbuilding.thumbnail_num,
|
|
|
|
|
bbuilding.show_switch_2d3d,
|
|
|
|
|
bbuilding.brief_introduction,
|
|
|
|
|
bbuilding.picture_introduction,
|
|
|
|
|
bbuilding.latitude,
|
|
|
|
|
bbuilding.longitude,
|
|
|
|
|
GROUP_CONCAT(pa.id) AS siteIds,
|
|
|
|
|
GROUP_CONCAT(pa.`name`) AS siteNames
|
|
|
|
|
FROM
|
|
|
|
|
basic_building bbuilding
|
|
|
|
|
INNER JOIN data_center_aeon_admin.basic_company bcomp ON bcomp.id = bbuilding.company_id
|
|
|
|
|
LEFT JOIN dashboard_level_relation_site_building rela ON bbuilding.`building_id` = rela.building_id
|
|
|
|
|
LEFT JOIN dashboard_level_site pa ON rela.site_id = pa.`id`
|
|
|
|
|
WHERE
|
|
|
|
|
bbuilding.flag != 1 AND bcomp.flag != 1
|
|
|
|
|
AND bbuilding.company_id IN <foreach collection="companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
<if test="bindBuildingIdList != null">
|
|
|
|
|
AND bbuilding.building_id IN <foreach collection="bindBuildingIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="buildingIdList != null">
|
|
|
|
|
AND bbuilding.building_id IN <foreach collection="buildingIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="buildingName != null">
|
|
|
|
|
AND bbuilding.name LIKE CONCAT('%',#{buildingName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="platformType != null and platformType == 1">
|
|
|
|
|
AND bbuilding.show_switch_2d3d = 0
|
|
|
|
|
</if>
|
|
|
|
|
<if test="siteId != null">
|
|
|
|
|
AND pa.`id` = #{siteId}
|
|
|
|
|
</if>
|
|
|
|
|
GROUP BY bbuilding.building_id
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAll" resultType="com.techsor.datacenter.business.vo.building.BuildingPageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bbuilding.building_id buildingId,
|
|
|
|
|
bbuilding.company_id companyId,
|
|
|
|
|
bcomp.company_name companyName,
|
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
|
bbuilding.address,
|
|
|
|
|
bbuilding.udf_building_id udfBuildingId
|
|
|
|
|
FROM
|
|
|
|
|
basic_building bbuilding
|
|
|
|
|
INNER JOIN data_center_aeon_admin.basic_company bcomp ON bcomp.id = bbuilding.company_id
|
|
|
|
|
WHERE
|
|
|
|
|
bbuilding.flag != 1
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
AND bbuilding.company_id = #{companyId}
|
|
|
|
|
</if>
|
|
|
|
|
AND bcomp.flag != 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAllInList" resultType="com.techsor.datacenter.business.vo.building.BuildingPageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bbuilding.building_id buildingId,
|
|
|
|
|
bbuilding.company_id companyId,
|
|
|
|
|
bcomp.company_name companyName,
|
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
|
bbuilding.address,
|
|
|
|
|
bbuilding.udf_building_id udfBuildingId
|
|
|
|
|
FROM
|
|
|
|
|
basic_building bbuilding
|
|
|
|
|
INNER JOIN data_center_aeon_admin.basic_company bcomp ON bcomp.id = bbuilding.company_id
|
|
|
|
|
WHERE
|
|
|
|
|
bbuilding.flag != 1
|
|
|
|
|
<if test="companyIdList != null and companyIdList.size() > 0">
|
|
|
|
|
AND bbuilding.building_id IN
|
|
|
|
|
<foreach collection="companyIdList" item="companyId" open="(" separator="," close=")">
|
|
|
|
|
#{companyId}
|
|
|
|
|
</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
AND bcomp.flag != 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|