|
|
|
|
<?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.BasicSpaceMapperExt">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <select id="checkExist" resultType="java.lang.Integer"> -->
|
|
|
|
|
<!-- SELECT -->
|
|
|
|
|
<!-- COUNT(1) -->
|
|
|
|
|
<!-- FROM -->
|
|
|
|
|
<!-- basic_space -->
|
|
|
|
|
<!-- WHERE -->
|
|
|
|
|
<!-- flag != 1 AND name = #{spaceName} -->
|
|
|
|
|
<!-- <if test="companyId != null"> -->
|
|
|
|
|
<!-- AND company_id = #{companyId} -->
|
|
|
|
|
<!-- </if> -->
|
|
|
|
|
<!-- <if test="floorId != null"> -->
|
|
|
|
|
<!-- AND floor_id = #{floorId} -->
|
|
|
|
|
<!-- </if> -->
|
|
|
|
|
<!-- <if test="spaceId != null"> -->
|
|
|
|
|
<!-- AND space_id != #{spaceId} -->
|
|
|
|
|
<!-- </if> -->
|
|
|
|
|
<!-- </select> -->
|
|
|
|
|
<select id="checkExist" resultType="java.util.Map">
|
|
|
|
|
SELECT
|
|
|
|
|
CASE
|
|
|
|
|
<!-- WHEN s.name = #{spaceName} THEN 'spaceName' -->
|
|
|
|
|
WHEN s.udf_space_id = #{udfSpaceId} THEN 'udfSpaceId'
|
|
|
|
|
END AS conflict_field
|
|
|
|
|
FROM basic_space s
|
|
|
|
|
INNER JOIN basic_floor f ON s.floor_id = f.floor_id
|
|
|
|
|
WHERE
|
|
|
|
|
s.flag != 1
|
|
|
|
|
AND f.flag != 1
|
|
|
|
|
AND f.building_id = (
|
|
|
|
|
SELECT building_id
|
|
|
|
|
FROM basic_floor
|
|
|
|
|
WHERE floor_id = #{floorId}
|
|
|
|
|
AND flag != 1
|
|
|
|
|
LIMIT 1
|
|
|
|
|
)
|
|
|
|
|
AND (
|
|
|
|
|
<!-- (s.name = #{spaceName}) -->
|
|
|
|
|
<!-- OR -->
|
|
|
|
|
(s.udf_space_id = #{udfSpaceId})
|
|
|
|
|
)
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
AND s.company_id = #{companyId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="spaceId != null">
|
|
|
|
|
AND s.space_id != #{spaceId}
|
|
|
|
|
</if>
|
|
|
|
|
LIMIT 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getListPage" resultType="com.techsor.datacenter.business.vo.space.SpacePageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bspace.space_id spaceId,
|
|
|
|
|
bspace.company_id companyId,
|
|
|
|
|
bcomp.company_name companyName,
|
|
|
|
|
btenant.tenant_name tenantName,
|
|
|
|
|
bfloor.building_id buildingId,
|
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
|
bspace.floor_id floorId,
|
|
|
|
|
bfloor.name floorName,
|
|
|
|
|
bspace.name spaceName,
|
|
|
|
|
bspace.udf_space_id udfSpaceId,
|
|
|
|
|
bspace.pdf_user_manual,
|
|
|
|
|
bspace.pdf_device_image,
|
|
|
|
|
bspace.images_introduction,
|
|
|
|
|
bspace.pdf_construction_equipment,
|
|
|
|
|
bspace.pdf_electrical_equipment,
|
|
|
|
|
bspace.pdf_ventilation_equipment,
|
|
|
|
|
bspace.pdf_sanitary_equipment,
|
|
|
|
|
bspace.pdf_fire_protection_equipment,
|
|
|
|
|
bspace.pdf_other_equipment,
|
|
|
|
|
bspace.space_category,
|
|
|
|
|
bspace.area,
|
|
|
|
|
bspace.`usage`,
|
|
|
|
|
bspace.risk_factor,
|
|
|
|
|
bspace.user_department_or_tenant,
|
|
|
|
|
bspace.usage_start_date,
|
|
|
|
|
bspace.usage_status,
|
|
|
|
|
bspace.supporting_facilities,
|
|
|
|
|
bspace.power_capacity,
|
|
|
|
|
bspace.remark1,
|
|
|
|
|
bspace.remark2,
|
|
|
|
|
bspace.remark3,
|
|
|
|
|
bspace.tenant_id tenantId,
|
|
|
|
|
btenant.tenant_udf_id tenantUdfId,
|
|
|
|
|
btenant.tenant_name tenantName
|
|
|
|
|
FROM
|
|
|
|
|
basic_space bspace
|
|
|
|
|
INNER JOIN data_center_aeon_admin.basic_company bcomp ON bcomp.id = bspace.company_id
|
|
|
|
|
INNER JOIN basic_floor bfloor ON bfloor.floor_id = bspace.floor_id
|
|
|
|
|
INNER JOIN basic_building bbuilding ON bbuilding.building_id = bfloor.building_id
|
|
|
|
|
LEFT JOIN basic_tenant btenant ON btenant.tenant_id = bspace.tenant_id
|
|
|
|
|
WHERE
|
|
|
|
|
bspace.flag != 1 AND bcomp.flag != 1 AND bfloor.flag != 1 AND (btenant.flag IS NULL OR btenant.flag != 1)
|
|
|
|
|
AND bspace.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="spaceIdList != null">
|
|
|
|
|
AND bspace.space_id IN <foreach collection="spaceIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="floorIdList != null">
|
|
|
|
|
AND bspace.floor_id IN <foreach collection="floorIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="buildingIdList != null">
|
|
|
|
|
AND bfloor.building_id IN <foreach collection="buildingIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="spaceName != null">
|
|
|
|
|
AND bspace.name LIKE CONCAT('%',#{spaceName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getListPage4Import" resultType="com.techsor.datacenter.business.vo.space.SpacePageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bspace.space_id spaceId,
|
|
|
|
|
bspace.company_id companyId,
|
|
|
|
|
bcomp.company_name companyName,
|
|
|
|
|
bspace.floor_id floorId,
|
|
|
|
|
bfloor.name floorName,
|
|
|
|
|
bfloor.building_id buildingId,
|
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
|
bspace.name spaceName,
|
|
|
|
|
bspace.udf_space_id,
|
|
|
|
|
bfloor.udf_floor_id,
|
|
|
|
|
bbuilding.udf_building_id,
|
|
|
|
|
btenant.tenant_udf_id tenantUdfId
|
|
|
|
|
FROM
|
|
|
|
|
basic_space bspace
|
|
|
|
|
INNER JOIN data_center_aeon_admin.basic_company bcomp ON bcomp.id = bspace.company_id
|
|
|
|
|
INNER JOIN basic_floor bfloor ON bfloor.floor_id = bspace.floor_id
|
|
|
|
|
INNER JOIN basic_building bbuilding ON bfloor.building_id = bbuilding.building_id
|
|
|
|
|
LEFT JOIN basic_tenant btenant ON btenant.tenant_id = bspace.tenant_id
|
|
|
|
|
WHERE
|
|
|
|
|
bspace.flag != 1 AND bcomp.flag != 1 AND bfloor.flag != 1 AND (btenant.flag IS NULL OR btenant.flag != 1)
|
|
|
|
|
AND bspace.company_id IN <foreach collection="companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
<if test="spaceIdList != null">
|
|
|
|
|
AND bspace.space_id IN <foreach collection="spaceIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="floorIdList != null">
|
|
|
|
|
AND bspace.floor_id IN <foreach collection="floorIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="spaceName != null">
|
|
|
|
|
AND bspace.name LIKE CONCAT('%',#{spaceName},'%')
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAll" resultType="com.techsor.datacenter.business.vo.space.SpacePageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bspace.space_id spaceId,
|
|
|
|
|
bspace.company_id companyId,
|
|
|
|
|
bcomp.company_name companyName,
|
|
|
|
|
bspace.floor_id floorId,
|
|
|
|
|
bfloor.name floorName,
|
|
|
|
|
bspace.name spaceName,
|
|
|
|
|
bspace.udf_space_id udfSpaceId,
|
|
|
|
|
btenant.tenant_udf_id tenantUdfId
|
|
|
|
|
FROM
|
|
|
|
|
basic_space bspace
|
|
|
|
|
INNER JOIN data_center_aeon_admin.basic_company bcomp ON bcomp.id = bspace.company_id
|
|
|
|
|
INNER JOIN basic_floor bfloor ON bfloor.floor_id = bspace.floor_id
|
|
|
|
|
LEFT JOIN basic_tenant btenant ON btenant.tenant_id = bspace.tenant_id
|
|
|
|
|
WHERE
|
|
|
|
|
bspace.flag != 1 AND bcomp.flag != 1 AND bfloor.flag != 1 AND (btenant.flag IS NULL OR btenant.flag != 1)
|
|
|
|
|
<if test="companyId != null">
|
|
|
|
|
AND bspace.company_id = #{companyId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getSpaceId" resultType="com.techsor.datacenter.business.vo.space.SpacePageVO">
|
|
|
|
|
SELECT
|
|
|
|
|
s.space_id,
|
|
|
|
|
s.images_introduction,
|
|
|
|
|
s.pdf_construction_equipment,
|
|
|
|
|
s.pdf_electrical_equipment,
|
|
|
|
|
s.pdf_ventilation_equipment,
|
|
|
|
|
s.pdf_sanitary_equipment,
|
|
|
|
|
s.pdf_fire_protection_equipment,
|
|
|
|
|
s.pdf_other_equipment
|
|
|
|
|
FROM basic_space s
|
|
|
|
|
INNER JOIN basic_floor f ON s.floor_id = f.floor_id
|
|
|
|
|
INNER JOIN basic_building b ON f.building_id = b.building_id
|
|
|
|
|
WHERE s.udf_space_id = #{udfSpaceId}
|
|
|
|
|
AND b.udf_building_id = #{udfBuildingId}
|
|
|
|
|
AND s.flag = 0
|
|
|
|
|
AND f.flag = 0
|
|
|
|
|
AND b.flag = 0
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getUdfBuildingIdBySpaceId" resultType="java.lang.String">
|
|
|
|
|
SELECT
|
|
|
|
|
bbuilding.udf_building_id
|
|
|
|
|
FROM
|
|
|
|
|
basic_space bspace
|
|
|
|
|
INNER JOIN basic_floor bfloor ON bfloor.floor_id = bspace.floor_id
|
|
|
|
|
INNER JOIN basic_building bbuilding ON bfloor.building_id = bbuilding.building_id
|
|
|
|
|
WHERE
|
|
|
|
|
bspace.flag != 1 AND bfloor.flag != 1 AND bbuilding.flag != 1 AND bspace.space_id = #{spaceId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getApiQuerySpaceInfo" resultType="com.techsor.datacenter.business.vo.space.ApiSpaceWithAssetVO">
|
|
|
|
|
SELECT
|
|
|
|
|
bspace.space_id spaceId,
|
|
|
|
|
bspace.udf_space_id udfSpaceId,
|
|
|
|
|
bspace.name spaceName,
|
|
|
|
|
btenant.tenant_udf_id tenantUdfId,
|
|
|
|
|
btenant.tenant_name tenantName,
|
|
|
|
|
bspace.pdf_user_manual,
|
|
|
|
|
bspace.pdf_device_image,
|
|
|
|
|
bspace.images_introduction,
|
|
|
|
|
bspace.pdf_construction_equipment,
|
|
|
|
|
bspace.pdf_electrical_equipment,
|
|
|
|
|
bspace.pdf_ventilation_equipment,
|
|
|
|
|
bspace.pdf_sanitary_equipment,
|
|
|
|
|
bspace.pdf_fire_protection_equipment,
|
|
|
|
|
bspace.pdf_other_equipment,
|
|
|
|
|
bspace.space_category,
|
|
|
|
|
bspace.area,
|
|
|
|
|
bspace.usage,
|
|
|
|
|
bspace.risk_factor,
|
|
|
|
|
bspace.user_department_or_tenant,
|
|
|
|
|
bspace.usage_start_date,
|
|
|
|
|
bspace.usage_status,
|
|
|
|
|
bspace.supporting_facilities,
|
|
|
|
|
bspace.power_capacity,
|
|
|
|
|
bspace.remark1,
|
|
|
|
|
bspace.remark2,
|
|
|
|
|
bspace.remark3
|
|
|
|
|
FROM
|
|
|
|
|
basic_space bspace
|
|
|
|
|
INNER JOIN basic_floor bfloor ON bfloor.floor_id = bspace.floor_id
|
|
|
|
|
INNER JOIN basic_building bbuilding ON bbuilding.building_id = bfloor.building_id
|
|
|
|
|
LEFT JOIN basic_tenant btenant ON btenant.tenant_id = bspace.tenant_id
|
|
|
|
|
WHERE
|
|
|
|
|
bspace.flag != 1 AND bfloor.flag != 1 AND bbuilding.flag != 1 AND (btenant.flag IS NULL OR btenant.flag != 1)
|
|
|
|
|
AND bspace.company_id IN <foreach collection="companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
<if test="udfSpaceId != null">
|
|
|
|
|
AND bspace.udf_space_id = #{udfSpaceId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="udfFloorId != null">
|
|
|
|
|
AND bfloor.udf_floor_id = #{udfFloorId}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="udfBuildingId != null">
|
|
|
|
|
AND bbuilding.udf_building_id = #{udfBuildingId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="getAsset4QuerySpaceInfo" resultType="com.techsor.datacenter.business.vo.asset.ApiMonitoringAssetVO">
|
|
|
|
|
SELECT
|
|
|
|
|
basset.equipment_id assetId,
|
|
|
|
|
basset.`symbol`,
|
|
|
|
|
basset.name assetName,
|
|
|
|
|
basset.pdf_user_manual,
|
|
|
|
|
basset.pdf_device_image,
|
|
|
|
|
basset.images_introduction,
|
|
|
|
|
basset.udf_equipment_id udfAssetId,
|
|
|
|
|
basset.space_id spaceId,
|
|
|
|
|
bspace.name spaceName,
|
|
|
|
|
basset.remark,
|
|
|
|
|
acbig.class_name classBig,
|
|
|
|
|
acmedium.class_name classMedium,
|
|
|
|
|
acsmall.class_name classSmall,
|
|
|
|
|
basset.manufacturer,
|
|
|
|
|
basset.`model`,
|
|
|
|
|
basset.manufacturing_date manufacturingDate,
|
|
|
|
|
basset.specifications1,
|
|
|
|
|
basset.specifications2,
|
|
|
|
|
basset.specifications3,
|
|
|
|
|
basset.specifications4,
|
|
|
|
|
basset.specifications5,
|
|
|
|
|
basset.specifications6,
|
|
|
|
|
basset.user_manual userManualURL,
|
|
|
|
|
basset.device_image deviceDrawingURL
|
|
|
|
|
FROM
|
|
|
|
|
basic_monitoring_asset basset
|
|
|
|
|
INNER JOIN basic_space bspace ON bspace.space_id = basset.space_id
|
|
|
|
|
LEFT JOIN basic_asset_class_big acbig ON basset.class_big_id = acbig.id
|
|
|
|
|
LEFT JOIN basic_asset_class_medium acmedium ON basset.class_medium_id = acmedium.id
|
|
|
|
|
LEFT JOIN basic_asset_class_small acsmall ON basset.class_small_id = acsmall.id
|
|
|
|
|
WHERE
|
|
|
|
|
basset.flag != 1 AND bspace.flag != 1
|
|
|
|
|
<if test="spaceId != null">
|
|
|
|
|
AND basset.space_id = #{spaceId}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="downloadSpace" resultType="com.techsor.datacenter.business.vo.space.SpaceDownloadVO">
|
|
|
|
|
select
|
|
|
|
|
basic_company.company_name,
|
|
|
|
|
basic_building.udf_building_id udfBuildingId,
|
|
|
|
|
basic_floor.udf_floor_id udfFloorId,
|
|
|
|
|
bspace.name spaceName,
|
|
|
|
|
bspace.udf_space_id udfSpaceId,
|
|
|
|
|
bspace.space_category spaceCategory,
|
|
|
|
|
bspace.area area,
|
|
|
|
|
bspace.usage "usage",
|
|
|
|
|
bspace.risk_factor riskFactor,
|
|
|
|
|
bspace.user_department_or_tenant userDepartmentOrTenant,
|
|
|
|
|
bspace.usage_start_date usageStartDate,
|
|
|
|
|
bspace.usage_status usageStatus,
|
|
|
|
|
bspace.supporting_facilities supportingFacilities,
|
|
|
|
|
bspace.power_capacity powerCapacity,
|
|
|
|
|
bspace.remark1 remark1,
|
|
|
|
|
bspace.remark2 remark2,
|
|
|
|
|
bspace.remark3 remark3,
|
|
|
|
|
btenant.tenant_udf_id tenantUdfId
|
|
|
|
|
from
|
|
|
|
|
basic_space bspace
|
|
|
|
|
left join data_center_aeon_admin.basic_company on bspace.company_id = basic_company.id
|
|
|
|
|
left join basic_floor on bspace.floor_id = basic_floor.floor_id
|
|
|
|
|
left join basic_building on basic_floor.building_id = basic_building.building_id
|
|
|
|
|
left join basic_tenant btenant ON btenant.tenant_id = bspace.tenant_id
|
|
|
|
|
where
|
|
|
|
|
basic_building.flag!=1 and basic_floor.flag!=1 and bspace.flag!=1
|
|
|
|
|
AND bspace.company_id IN <foreach collection="companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
<if test="buildingIdList != null">
|
|
|
|
|
AND basic_building.building_id IN <foreach collection="buildingIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="floorIdList != null">
|
|
|
|
|
AND basic_floor.floor_id IN <foreach collection="floorIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
|
</if>
|
|
|
|
|
<if test="spaceName != null and spaceName != ''">
|
|
|
|
|
AND (
|
|
|
|
|
bspace.name LIKE CONCAT('%',#{spaceName},'%')
|
|
|
|
|
or
|
|
|
|
|
bspace.udf_space_id LIKE CONCAT('%',#{spaceName},'%')
|
|
|
|
|
)
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
</mapper>
|