From c10d6358b9f014375a13821465bc978d0c0da22e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Wed, 29 May 2024 17:17:08 +0800
Subject: [PATCH] 通过E呼即办数据统计

---
 src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml |  207 ++++++++++++++++++++++++++-------------------------
 1 files changed, 106 insertions(+), 101 deletions(-)

diff --git a/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml b/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
index 7ff58ae..eee8477 100644
--- a/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
+++ b/src/main/java/org/springblade/modules/task/mapper/TaskMapper.xml
@@ -29,8 +29,9 @@
         br.town_code streetCode,
         jp.principal as realName,
         jp.principal_phone as phone,
-        jp.nine_type ,
-        jp.front_type ,
+        jp.nine_type,
+        jp.front_type,
+        jp.place_name,
         jt.id,
         jt.NAME,
         jt.type,
@@ -53,59 +54,61 @@
         LEFT JOIN blade_region br on br.code = jg.community_code
         LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
         <where>
-            <if test="task.roleName != null and task.roleName != ''">
-                <if test="task.roleName=='wgy'">
-                    <if test="isAdministrator==2">
-                        <choose>
-                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                                and jp.grid_code in
-                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                                    #{code}
-                                </foreach>
-                            </when>
-                            <otherwise>
-                                and jp.grid_code in ('')
-                            </otherwise>
-                        </choose>
-                    </if>
-                </if>
-                <if test="task.roleName=='mj'">
-                    <if test="isAdministrator==2">
-                        <choose>
-                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                                and jpag.community_code in
-                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                                    #{code}
-                                </foreach>
-                            </when>
-                            <otherwise>
-                                and jpag.community_code in ('')
-                            </otherwise>
-                        </choose>
-                    </if>
-                </if>
-            </if>
             <if test="isAdministrator==2">
                 <choose>
-                    <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                        and
-                        (
-                        jg.grid_code in
-                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                            #{code}
-                        </foreach>
-                        or
-                        br.village_code in
-                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                            #{code}
-                        </foreach>
-                        )
+                    <when test="task.roleName != null and task.roleName != ''">
+                        <if test="task.roleName=='wgy'">
+                            <choose>
+                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                                    and jh.grid_code in
+                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")"
+                                             separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and jh.grid_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
+                        <if test="task.roleName=='mj' and isAdministrator==2">
+                            <choose>
+                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                                    and br.village_code in
+                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")"
+                                             separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and br.village_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
                     </when>
                     <otherwise>
-                        and
-                        (
-                        jg.grid_code in ('') or br.village_code in ('')
-                        )
+                        <choose>
+                            <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                                and
+                                (
+                                jg.grid_code in
+                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                    #{code}
+                                </foreach>
+                                or
+                                br.village_code in
+                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                    #{code}
+                                </foreach>
+                                )
+                            </when>
+                            <otherwise>
+                                and
+                                (
+                                jg.grid_code in ('') or br.village_code in ('')
+                                )
+                            </otherwise>
+                        </choose>
                     </otherwise>
                 </choose>
             </if>
@@ -194,57 +197,59 @@
         LEFT JOIN blade_region br on br.code = jg.community_code
         LEFT JOIN jczz_task_bail_reporting_event jtbre on jtbre.task_id = jt.id
         <where>
-            <if test="task.roleName != null and task.roleName != ''">
-                <if test="task.roleName=='wgy'">
-                    <if test="isAdministrator==2">
+            <if test="isAdministrator==2">
+                <choose>
+                    <when test="task.roleName != null and task.roleName != ''">
+                        <if test="task.roleName=='wgy'">
+                            <choose>
+                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                                    and jh.grid_code in
+                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and jh.grid_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
+                        <if test="task.roleName=='mj' and isAdministrator==2">
+                            <choose>
+                                <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
+                                    and br.village_code in
+                                    <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and br.village_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
+                    </when>
+                    <otherwise>
                         <choose>
                             <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                                and jh.grid_code in
+                                and
+                                (
+                                jg.grid_code in
                                 <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
                                     #{code}
                                 </foreach>
+                                or
+                                br.village_code in
+                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                    #{code}
+                                </foreach>
+                                )
                             </when>
                             <otherwise>
-                                and jh.grid_code in ('')
+                                and
+                                (
+                                jg.grid_code in ('') or br.village_code in ('')
+                                )
                             </otherwise>
                         </choose>
-                    </if>
-                </if>
-                <if test="task.roleName=='mj' and isAdministrator==2">
-                    <choose>
-                        <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                            and br.village_code in
-                            <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                                #{code}
-                            </foreach>
-                        </when>
-                        <otherwise>
-                            and br.village_code in ('')
-                        </otherwise>
-                    </choose>
-                </if>
-            </if>
-            <if test="isAdministrator==2">
-                <choose>
-                    <when test="regionChildCodesList !=null and regionChildCodesList.size()>0">
-                        and
-                        (
-                        jg.grid_code in
-                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                            #{code}
-                        </foreach>
-                        or
-                        br.village_code in
-                        <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
-                            #{code}
-                        </foreach>
-                        )
-                    </when>
-                    <otherwise>
-                        and
-                        (
-                        jg.grid_code in ('') or br.village_code in ('')
-                        )
                     </otherwise>
                 </choose>
             </if>
@@ -417,7 +422,6 @@
                 and jt.report_type in (5,8)
             </if>
             and jt.is_deleted = 0
-            and jt.house_code is not null
         </where>
     </select>
 
@@ -461,11 +465,12 @@
         </where>
     </select>
 
+    <!--取保候审人员查询-->
     <select id="getBailReportingPage" resultType="org.springblade.modules.task.vo.TaskVO">
         SELECT
-        IFNULL( jda.address_name, jp.location ) AS address_name,
+        IFNULL( jda.address_name, jh.house_name ) AS address_name,
         jtbre.apply_name,
-        jgr.district_code aoiCode,
+        jh.district_code aoiCode,
         jda.region_code,
         jg.community_code neiCode,
         jc.street_code streetCode,
@@ -491,9 +496,9 @@
         FROM
         jczz_task jt
         LEFT JOIN jczz_doorplate_address jda ON jda.address_code = jt.house_code
-        LEFT JOIN jczz_place jp ON jt.house_code = jp.house_code and jp.is_deleted = 0
-        LEFT JOIN jczz_grid_range jgr on jgr.house_code= jt.house_code
-        LEFT JOIN jczz_grid jg on jg.id = jgr.grid_id and jg.is_deleted = 0
+        LEFT JOIN jczz_house jh ON jt.house_code = jh.house_code and jh.is_deleted = 0
+        LEFT JOIN jczz_grid jg on jg.grid_code = jh.grid_code and jg.is_deleted = 0
+        LEFT JOIN jczz_police_affairs_grid jpag on jh.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
         LEFT JOIN jczz_community jc on jc.`code`= jg.community_code and jc.is_deleted = 0
         LEFT JOIN jczz_task_bail_reporting_event jtbre on jtbre.task_id = jt.id and jtbre.is_deleted = 0
         LEFT JOIN blade_user bu on bu.id = jtbre.check_user_id and bu.is_deleted = 0
@@ -519,7 +524,7 @@
             </if>
 
             <if test="task.aoiCode != null and task.aoiCode != null">
-                and jgr.district_code = #{task.aoiCode}
+                and jh.district_code = #{task.aoiCode}
             </if>
 
             <if test="task.neiCode != null and task.neiCode != null">
@@ -543,7 +548,7 @@
             </if>
 
             <if test="task.districtName != null and task.districtName != null">
-                and jgr.district_name like concat('%', #{task.districtName}, '%')
+                and jh.district_name like concat('%', #{task.districtName}, '%')
             </if>
 
             <if test="task.frequency != null and task.frequency != ''">

--
Gitblit v1.9.3