|
|
|
<?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.model2d3d.viewer.back.dao.ex.BasicBuildingMapperExt">
|
|
|
|
|
|
|
|
|
|
|
|
<select id="checkExist" resultType="java.util.Map">
|
|
|
|
SELECT
|
|
|
|
CASE
|
|
|
|
WHEN name = #{buildingName} THEN 'buildingName'
|
|
|
|
WHEN unique_identification = #{uniqueIdentification} THEN 'uniqueIdentification'
|
|
|
|
END AS conflict_field
|
|
|
|
FROM
|
|
|
|
basic_building
|
|
|
|
WHERE
|
|
|
|
flag != 1 AND (name = #{buildingName} OR unique_identification = #{uniqueIdentification})
|
|
|
|
<if test="companyId != null">
|
|
|
|
AND company_id = #{companyId}
|
|
|
|
</if>
|
|
|
|
<if test="buildingId != null">
|
|
|
|
AND building_id != #{buildingId}
|
|
|
|
</if>
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getListPage" resultType="com.model2d3d.viewer.back.vo.building.BuildingPageVO">
|
|
|
|
SELECT
|
|
|
|
bbuilding.building_id buildingId,
|
|
|
|
bbuilding.company_id companyId,
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
bbuilding.address,
|
|
|
|
bbuilding.unique_identification,
|
|
|
|
bbuilding.dimensional_url,
|
|
|
|
bcomp.company_name
|
|
|
|
FROM
|
|
|
|
basic_building bbuilding
|
|
|
|
INNER JOIN basic_company bcomp ON bcomp.id = bbuilding.company_id
|
|
|
|
WHERE
|
|
|
|
bbuilding.flag != 1 AND bcomp.flag != 1
|
|
|
|
AND bbuilding.company_id IN <foreach collection="params.companyIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
<if test="params.buildingIdList != null">
|
|
|
|
AND bbuilding.building_id IN <foreach collection="params.buildingIdList" item="item" open="(" separator="," close=")">#{item}</foreach>
|
|
|
|
</if>
|
|
|
|
<if test="params.buildingName != null">
|
|
|
|
AND bbuilding.name LIKE CONCAT('%',#{params.buildingName},'%')
|
|
|
|
</if>
|
|
|
|
ORDER BY bbuilding.create_time DESC, bbuilding.building_id
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
<select id="getBoundBuildings" resultType="com.model2d3d.viewer.back.vo.building.BuildingPageVO">
|
|
|
|
SELECT
|
|
|
|
bbuilding.building_id buildingId,
|
|
|
|
bbuilding.company_id companyId,
|
|
|
|
bbuilding.name buildingName,
|
|
|
|
bbuilding.address,
|
|
|
|
bbuilding.unique_identification,
|
|
|
|
bbuilding.dimensional_url,
|
|
|
|
bcomp.company_name
|
|
|
|
FROM
|
|
|
|
basic_building bbuilding
|
|
|
|
<if test='userId != null and !"1".equals(userId)'>
|
|
|
|
INNER JOIN user_building_relation ubr ON ubr.building_id = bbuilding.building_id
|
|
|
|
</if>
|
|
|
|
INNER JOIN basic_company bcomp ON bcomp.id = bbuilding.company_id
|
|
|
|
WHERE
|
|
|
|
bbuilding.flag != 1 AND bcomp.flag != 1
|
|
|
|
<if test='userId != null and !"1".equals(userId)'>
|
|
|
|
AND ubr.user_id = #{userId}
|
|
|
|
</if>
|
|
|
|
ORDER BY bbuilding.create_time DESC, bbuilding.building_id
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
</mapper>
|