linwe
2023-12-23 55d677758efadb6d42e6d4e595cecc2c50c20d5a
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -33,6 +33,9 @@
        <if test="gridman.gridId!=null">
            and jg.id = #{gridman.gridId}
        </if>
        <if test="gridman.communityCode!=null and gridman.communityCode!=''">
            and jg.community_code like concat('%',#{gridman.communityCode},'%')
        </if>
    </select>
    <!--自定义分页查询-->
@@ -51,14 +54,16 @@
    <select id="getGridStatistics" resultType="java.lang.Integer">
        SELECT count(1) number
        FROM jczz_grid jg
                 LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
        FROM jczz_gridman jgm
        LEFT JOIN jczz_grid jg  ON jg.id = jgm.grid_id
        WHERE jg.community_code = #{code}
          AND jg.is_deleted = 0
        AND jg.is_deleted = 0
        <if test="userId!=null and roleType == '1'">
          and jgm.user_id= #{userId}
        </if>
    </select>
    <select id="getCompanyStatistics" resultType="java.lang.Integer">
        SELECT
        count(1)
        FROM
@@ -67,9 +72,9 @@
        WHERE
        jd.community_code = #{code}
        and jpcd.is_deleted= 0
        <if test="userId!=null">
            AND EXISTS (
            SELECT
        <if test="userId!=null and roleType == '1'">
            AND jd.aoi_code in (
            SELECT distinct
            jda.aoi_code
            FROM
            jczz_grid jg
@@ -79,15 +84,44 @@
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            AND jd.aoi_code = jda.aoi_code
            AND jda.aoi_code IS NOT NULL
            GROUP BY
            jda.aoi_code
            )
        </if>
    </select>
    <select id="getOwnersCommitteeStatistics" resultType="java.lang.Integer">
        SELECT
        count(1)
        FROM jczz_owners_committee joc LEFT JOIN
        jczz_district jd ON jd.id = joc.area_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.id = jgm.grid_id
            LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
            LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jgr.house_code
            WHERE
            jgm.user_id = #{userId}
            AND jg.is_deleted = 0
            AND jda.aoi_code IS NOT NULL
            )
        </if>
    </select>
    <!--网格员表 自定义详情-->
    <select id="getDetail" resultType="org.springblade.modules.grid.vo.GridmanVO">
        select
        jgm.*,jg.community_code communityCode
        from jczz_gridman jgm
        left join jczz_grid jg on jg.id = jgm.grid_id and jg.is_deleted = 0
        where jgm.is_deleted = 0
        and jgm.id = #{gridman.id}
    </select>
</mapper>