linwe
2023-12-23 55d677758efadb6d42e6d4e595cecc2c50c20d5a
src/main/java/org/springblade/modules/task/mapper/TaskReportForRepairsMapper.xml
@@ -40,6 +40,12 @@
        <if test="vo.confirmFlag != null">
            AND jtrfr.confirm_flag = #{vo.confirmFlag}
        </if>
        <if test="vo.status != null">
            AND jtrfr.status = #{vo.status}
        </if>
        <if test="vo.viewType != null">
            AND jtrfr.view_type = #{vo.viewType}
        </if>
        <if test="vo.roleName!=null and vo.roleName!=''">
            <if test="vo.roleName=='网格员'">
                <choose>
@@ -59,10 +65,53 @@
    </select>
    <!--统计查询,个人-->
    <select id="getReportForStatistics" resultType="java.lang.Integer">
        SELECT
        COUNT( 1 )
        FROM
        jczz_task_report_for_repairs jtrfr
        LEFT JOIN jczz_doorplate_address jda ON jtrfr.address_code = jda.address_code
        WHERE
        jda.nei_code = #{code}
        AND jtrfr.is_deleted = 0
        <if test="status != null">
            and jtrfr.confirm_flag = #{status}
        </if>
        <if test="type != null">
            and jtrfr.type = #{type}
        </if>
        <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 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>
    <select id="getStatisticsCount" resultType="org.springblade.modules.task.vo.TaskReportStatistics">
        SELECT
            COUNT( 1 ) AS total,
            ifnull(SUM( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ),0) AS handle
        COUNT( 1 ) AS total,
        ifnull(SUM( CASE WHEN STATUS = 10 THEN 1 ELSE 0 END ),0) AS handle
        FROM jczz_task_report_for_repairs
        WHERE is_deleted = 0
        <if test="userId != null">
@@ -76,15 +125,22 @@
        SELECT
            count(1)
        FROM
            jczz_grid_range jgr
                LEFT JOIN jczz_grid jg ON jg.id = jgr.grid_id
                LEFT JOIN jczz_task_report_for_repairs jtr on jtr.address_code=jgr.house_code
            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
        WHERE
            jg.is_deleted = 0
          and jh.confirm_flag = 1
          AND jg.user_id = #{userId}
          and jtr.confirm_flag = 1
          AND jgm.user_id = #{userId}
    </select>
    <!--更新状态-临时接口-->
    <update id="updateView">
        update jczz_task_report_for_repairs set view_type = 1
    </update>
</mapper>