linwe
2024-06-24 60e1a68fa319cd9e92d632bf678b31af20973508
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -79,11 +79,16 @@
        SELECT count(1) number
        FROM jczz_gridman jgm
        LEFT JOIN jczz_grid jg ON jg.grid_code = jgm.grid_code
        WHERE jg.community_code = #{code}
        AND jg.is_deleted = 0
        <if test="userId!=null and roleType == '1'">
            and jgm.user_id= #{userId}
        </if>
        <where>
            jg.community_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            AND jg.is_deleted = 0
            <if test="userId!=null and roleType == '1'">
                and jgm.user_id= #{userId}
            </if>
        </where>
    </select>
    <select id="getCompanyStatistics" resultType="java.lang.Integer">
@@ -92,23 +97,27 @@
        FROM
        jczz_property_company_district jpcd
        LEFT JOIN jczz_district jd ON jd.id = jpcd.district_id
        WHERE
        jd.community_code = #{code}
        and jpcd.is_deleted= 0
        <if test="userId!=null and roleType == '1'">
            AND jd.aoi_code in (
            SELECT distinct
            jda.aoi_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
            LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            AND jda.aoi_code IS NOT NULL
            )
        </if>
        <where>
            jd.community_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            and jpcd.is_deleted= 0
            <if test="userId!=null and roleType == '1'">
                AND jd.aoi_code in (
                SELECT distinct
                jda.aoi_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
                LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                AND jda.aoi_code IS NOT NULL
                )
            </if>
        </where>
    </select>
    <select id="getOwnersCommitteeStatistics" resultType="java.lang.Integer">
@@ -116,23 +125,27 @@
        count(1)
        FROM jczz_owners_committee joc LEFT JOIN
        jczz_district jd ON jd.id = joc.area_id
        WHERE
        jd.community_code = #{code}
        and joc.delete_flag= 0
        <if test="userId!=null and roleType == '1'">
            AND jd.aoi_code in (
            SELECT distinct
            jda.aoi_code
            FROM
            jczz_grid jg
            LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
            LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            AND jda.aoi_code IS NOT NULL
            )
        </if>
        <where>
            jd.community_code in
            <foreach collection="communityCodeList" item="code" open="(" close=")" separator=",">
                #{code}
            </foreach>
            and joc.delete_flag= 0
            <if test="userId!=null and roleType == '1'">
                AND jd.aoi_code in (
                SELECT distinct
                jda.aoi_code
                FROM
                jczz_grid jg
                LEFT JOIN jczz_gridman jgm ON jg.grid_code = jgm.grid_code
                LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jg.house_code
                WHERE
                jgm.user_id = #{userId}
                AND jg.is_deleted = 0
                AND jda.aoi_code IS NOT NULL
                )
            </if>
        </where>
    </select>