zhongrj
2024-04-17 f7018ca7d42b7f84d0191d748cfdb2d38473ea86
src/main/java/org/springblade/modules/house/mapper/HouseMapper.xml
@@ -922,5 +922,60 @@
        limit #{i},#{size}
    </select>
    <!--查询无房屋状态的房屋数量-->
    <select id="getNotBindLabelHouseNum" resultType="java.lang.Integer">
        select count(*) from (
            SELECT
            jh.house_code,
            case when c.house_code is not null then 1
            when a.house_code is not null and b.house_code is null then 2
            when b.house_code is not null then 3
            end as status
            FROM
            jczz_house jh
            left join
            (
            select house_code from jczz_household where is_deleted = 0 and relationship = 1 and house_code is not null and house_code != '' GROUP BY house_code
            ) a on a.house_code = jh.house_code
            left join
            (
            select house_code from jczz_household where is_deleted = 0 and relationship = 18 and house_code is not null and house_code != '' GROUP BY house_code
            ) b on b.house_code = jh.house_code
            left join
            (
            select house_code from jczz_household where is_deleted = 0 and relationship is null or (relationship!=1 and relationship!=18) and house_code is not null and house_code != '' GROUP BY house_code
            ) c on c.house_code = jh.house_code
        ) d left join jczz_user_house_label juhl on d.house_code = juhl.house_code and lable_type = 2
        where juhl.id is null and status is not null
    </select>
    <!--查询无房屋状态的房屋列表集合-->
    <select id="getNotBindLabelHouseList" resultType="org.springblade.modules.house.vo.HouseVO">
        select d.* from (
            SELECT
            jh.house_code,
            case when c.house_code is not null then 1
            when a.house_code is not null and b.house_code is null then 2
            when b.house_code is not null then 3
            end as status
            FROM
            jczz_house jh
            left join
            (
            select house_code from jczz_household where is_deleted = 0 and relationship = 1 and house_code is not null and house_code != '' GROUP BY house_code
            ) a on a.house_code = jh.house_code
            left join
            (
            select house_code from jczz_household where is_deleted = 0 and relationship = 18 and house_code is not null and house_code != '' GROUP BY house_code
            ) b on b.house_code = jh.house_code
            left join
            (
            select house_code from jczz_household where is_deleted = 0 and relationship is null or (relationship!=1 and relationship!=18) and house_code is not null and house_code != '' GROUP BY house_code
            ) c on c.house_code = jh.house_code
        ) d left join jczz_user_house_label juhl on d.house_code = juhl.house_code and lable_type = 2
        where juhl.id is null and status is not null
        limit #{i},#{size}
    </select>
</mapper>