<?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.ruoyi.gysl.mapper.BuildingInformationMapper">

    <select id="selectAll" resultType="com.ruoyi.gysl.entity.BuildingInformation">
        select * from gysl_building_information
        <where>
            <if test="req.xmId != null and req.xmId != ''">
                AND xm_id = #{req.xmId}
            </if>
        </where>
    </select>
    <select id="getOneXmIdToMax" resultType="com.ruoyi.gysl.entity.BuildingInformation">
        select
            MAX(floor) as floor,
            MAX(scgd) as scgd,
            MAX(two_and_four_cg) as twoAndFourCg,
            MAX(two_and_three_lmhz) as twoAndThreeLmhz
        from gysl_building_information
        where  sfwzyld = 1 and xm_id = #{id}
        group by xm_id;
    </select>
    <select id="getAllMax" resultType="com.ruoyi.gysl.entity.BuildingInformation">
            SELECT
                MAX( scgd ) AS scgd,
                MAX( floor ) AS floor,
                MAX( two_and_four_cg ) AS twoAndFourCg,
                MAX( two_and_three_lmhz ) AS twoAndThreeLmhz
            FROM
                gysl_building_information
    </select>
    <select id="getImportantBuildings" resultType="com.ruoyi.gysl.entity.BuildingInformation">
            SELECT
                xm_id,
                Max(floor),
                Max(scgd),
                Max(scdmhz),
                Max(two_and_four_cg),
                Max(two_and_three_lmhz)
            FROM
                gysl_building_information
            WHERE
                sfwzyld = 1
            GROUP BY
                xm_id,
                floor,
                scgd,
                scdmhz,
                two_and_four_cg,
                two_and_three_lmhz

    </select>

</mapper>

