linwe
2023-12-23 55d677758efadb6d42e6d4e595cecc2c50c20d5a
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -33,7 +33,95 @@
        <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>
    <!--自定义分页查询-->
    <select id="getGridmanList" resultType="org.springblade.modules.grid.vo.GridmanVO">
        select
        jgm.*
        from jczz_gridman jgm
        where jgm.is_deleted = 0
        <if test="gridman.gridmanName!=null and gridman.gridmanName!=''">
            and jgm.gridman_name like concat('%',#{gridman.gridmanName},'%')
        </if>
        <if test="gridman.mobile!=null and gridman.mobile!=''">
            and jgm.mobile like concat('%',#{gridman.mobile},'%')
        </if>
    </select>
    <select id="getGridStatistics" resultType="java.lang.Integer">
        SELECT count(1) number
        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
        <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
        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.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="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>