<?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.usky.iot.mapper.BaseBuildFacilityMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.usky.iot.domain.BaseBuildFacility">
        <id column="id" property="id" />
        <result column="facility_num" property="facilityNum" />
        <result column="facility_name" property="facilityName" />
        <result column="facility_type" property="facilityType" />
        <result column="floor" property="floor" />
        <result column="address" property="address" />
        <result column="images_url" property="imagesUrl" />
        <result column="device_id" property="deviceId" />
        <result column="contact" property="contact" />
        <result column="contact_phone" property="contactPhone" />
        <result column="plane_x" property="planeX" />
        <result column="plane_y" property="planeY" />
        <result column="coordinate_x" property="coordinateX" />
        <result column="coordinate_y" property="coordinateY" />
        <result column="coordinate_z" property="coordinateZ" />
        <result column="delete_flag" property="deleteFlag" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="update_by" property="updateBy" />
        <result column="create_by" property="createBy" />
        <result column="dept_id" property="deptId" />
        <result column="tenant_id" property="tenantId" />
        <result column="facility_desc" property="facilityDesc" />
        <result column="angles_x" property="anglesX" />
        <result column="angles_y" property="anglesY" />
        <result column="angles_z" property="anglesZ" />
        <result column="scale_l" property="scaleL" />
        <result column="scale_w" property="scaleW" />
        <result column="scale_h" property="scaleH" />
    </resultMap>
    <select id="baseBuildFacilityTypeList" resultType="com.usky.iot.domain.BaseBuildFacilityType">
        select
            bbft.*
        from base_build_facility_type bbft
        <where>
            <if test="1 == 1">
                AND bbft.type_code = #{facilityType}
            </if>
        </where>
    </select>
    <select id="getBuildName" resultType="com.usky.iot.domain.BaseBuild">
        select
            bb.*
        from base_build bb
        <where>
            <if test="buildIdList != null and buildIdList.size() > 0">
                AND bb.id in
                <foreach item="item" collection="buildIdList" open="(" separator="," close=")">
                    #{item}
                </foreach>
            </if>
        </where>
    </select>

</mapper>
