linwe
2023-12-18 d0b0e00e40226700a0ffa1f1671a8dc273610f67
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -35,5 +35,62 @@
        </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_grid jg
                 LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
        WHERE jg.community_code = #{code}
          AND jg.is_deleted = 0
        <if test="userId!=null">
          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 EXISTS (
            SELECT
            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 jd.aoi_code = jda.aoi_code
            AND jda.aoi_code IS NOT NULL
            GROUP BY
            jda.aoi_code
            )
        </if>
    </select>
</mapper>