linwe
2023-12-26 eb55b4133ae6b3df80d8d14fbc5b32928f296fd7
src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
@@ -24,6 +24,9 @@
        jda.address_name as addressName
        from jczz_task_report_for_repairs jtrfr
        left join jczz_doorplate_address jda on jda.address_code = jtrfr.address_code
        left join jczz_grid_range jgr on jgr.house_code = jtrfr.address_code
        left join jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
        left join blade_region br on br.code = jg.community_code
        where jtrfr.is_deleted = 0
        <if test="vo.createUser != null and vo.createUser != ''">
            AND jtrfr.create_user = #{vo.createUser}
@@ -45,6 +48,12 @@
        </if>
        <if test="vo.viewType != null">
            AND jtrfr.view_type = #{vo.viewType}
        </if>
        <if test="vo.startTime != null and vo.startTime != '' and vo.endTime != null and vo.endTime != '' ">
            AND jtrfr.create_time BETWEEN #{vo.startTime} and #{vo.endTime}
        </if>
        <if test="vo.regionCode != null and vo.regionCode !='' ">
            and jg.community_code like concat('%',#{vo.regionCode},'%')
        </if>
        <if test="vo.roleName!=null and vo.roleName!=''">
            <if test="vo.roleName=='网格员'">
@@ -74,7 +83,6 @@
        LEFT JOIN jczz_doorplate_address jda ON jtrfr.address_code = jda.address_code
        WHERE
        jda.nei_code = #{code}
        AND jda.unit_code IS NOT NULL
        AND jtrfr.is_deleted = 0
        <if test="status != null">
            and jtrfr.confirm_flag = #{status}
@@ -83,18 +91,27 @@
            and jtrfr.type = #{type}
        </if>
        <if test="userId != null">
            AND EXISTS (
            SELECT
            *
        <if test="userId != null and roleType == '1'">
            AND jda.address_code IN (
            SELECT DISTINCT
            jgr.house_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
            WHERE
            jgm.user_id = #{userId}
            AND jtrfr.address_code = jgr.house_code
            AND jg.is_deleted = 0
            )
        </if>
        <if test="userId != null and roleType == '3'">
            AND jda.address_code IN (SELECT
            jda.address_code
            FROM
            jczz_doorplate_address jda
            LEFT JOIN jczz_community jc ON jc.CODE = jda.nei_code
            WHERE
            jc.res_police_user_id = #{userId})
            )
        </if>
    </select>
@@ -113,19 +130,28 @@
    <select id="getStatistics" resultType="java.lang.Integer">
        SELECT
            count(1)
        count( 1 )
        FROM
            jczz_gridman jgm
                LEFT JOIN jczz_grid jg ON jgm.grid_id = jg.id
                LEFT JOIN jczz_grid_range jgr ON jg.id = jgr.grid_id
                LEFT JOIN jczz_task_report_for_repairs jtr ON jgr.house_code = jtr.address_code
                LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jtr.address_code
        jczz_task_report_for_repairs jtr
        LEFT JOIN jczz_doorplate_address jda ON jtr.address_code = jda.address_code
        WHERE
        jtr.is_deleted = 0
        <if test="neiCode != null and neiCode != ''">
            and jda.nei_code = #{neiCode}
        </if>
        <if test="userId != null">
            AND jtr.address_code IN (
            SELECT
            jgr.house_code
            FROM
            jczz_grid_range jgr
            LEFT JOIN jczz_grid jg ON jg.id = jgr.grid_id
            LEFT JOIN jczz_gridman jgm ON jg.id = jgm.grid_id
            WHERE
            jg.is_deleted = 0
          and jtr.confirm_flag = 1
          AND jgm.user_id = #{userId}
            AND jgm.user_id = #{userId} )
        </if>
    </select>