linwei
2024-01-08 ad2ec97fe0c60eee4bb7c8cdacff7c876f280ea7
src/main/java/org/springblade/modules/grid/mapper/GridmanMapper.xml
@@ -20,9 +20,13 @@
    <!--自定义分页查询-->
    <select id="selectGridmanPage" resultType="org.springblade.modules.grid.vo.GridmanVO">
        select
        jgm.*,jg.community_code communityCode
        jgm.*,
        jg.grid_name gridName,jg.community_code communityCode,
        br.name as communityName,
        br.town_name as townName
        from jczz_gridman jgm
        left join jczz_grid jg on jg.id = jgm.grid_id and jg.is_deleted = 0
        left join blade_region br on br.code = jg.community_code
        where jgm.is_deleted = 0
        <if test="gridman.gridmanName!=null and gridman.gridmanName!=''">
            and jgm.gridman_name like concat('%',#{gridman.gridmanName},'%')
@@ -35,6 +39,15 @@
        </if>
        <if test="gridman.communityCode!=null and gridman.communityCode!=''">
            and jg.community_code like concat('%',#{gridman.communityCode},'%')
        </if>
        <if test="gridman.communityName!=null and gridman.communityName!=''">
            and br.name like concat('%',#{gridman.communityName},'%')
        </if>
        <if test="gridman.townName!=null and gridman.townName!=''">
            and br.town_name like concat('%',#{gridman.townName},'%')
        </if>
        <if test="gridman.regionCode != null and gridman.regionCode !='' ">
            and jg.community_code like concat('%',#{gridman.regionCode},'%')
        </if>
    </select>
@@ -96,7 +109,7 @@
        jczz_district jd ON jd.id = joc.area_id
        WHERE
        jd.community_code = #{code}
        and jpcd.is_deleted= 0
        and joc.delete_flag= 0
        <if test="userId!=null and roleType == '1'">
            AND jd.aoi_code in (
            SELECT distinct
@@ -124,4 +137,27 @@
        where jgm.is_deleted = 0
        and jgm.id = #{gridman.id}
    </select>
    <!--查询网格id-->
    <select id="getGridIdByUserId" resultType="java.lang.Integer">
        select
        jgm.grid_id
        from jczz_gridman jgm
        where jgm.is_deleted = 0
        and jgm.user_id = #{userId}
        limit 1
    </select>
    <select id="getGridManByCode" resultType="org.springblade.modules.system.entity.User">
        SELECT
            *
        FROM
            blade_user bu
                LEFT JOIN jczz_gridman jgm ON bu.id = jgm.user_id
                LEFT JOIN jczz_grid jg ON jgm.grid_id = jg.id
                LEFT JOIN jczz_grid_range jgr ON jgr.grid_id = jg.id
        WHERE
            jgr.house_code = #{houseCode}  and bu.is_deleted = 0
    </select>
</mapper>