From 9f6332a751676891cb910f2b6fd50833cbc865c7 Mon Sep 17 00:00:00 2001
From: zhongrj <646384940@qq.com>
Date: Tue, 19 Mar 2024 16:05:19 +0800
Subject: [PATCH] 报警单查询修改

---
 src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml |   73 +++++++++++++++++++++++++++++++++++-
 1 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml b/src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml
index aa2fa84..0a26fa9 100644
--- a/src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml
+++ b/src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml
@@ -3,14 +3,81 @@
 <mapper namespace="org.springblade.modules.police.mapper.PoliceAlarmRecordsMapper">
 
     <!-- 通用查询映射结果 -->
-    <resultMap id="policeAlarmRecordsResultMap" type="org.springblade.modules.police.entity.PoliceAlarmRecordsEntity">
+    <resultMap id="policeAlarmRecordsResultMap" type="org.springblade.modules.police.vo.PoliceAlarmRecordsVO">
     </resultMap>
 
 
     <select id="selectPoliceAlarmRecordsPage" resultMap="policeAlarmRecordsResultMap">
-        select * from jczz_police_alarm_records
+        select jpar.* from jczz_police_alarm_records jpar
+        LEFT JOIN jczz_grid jg on jg.grid_code = jpar.grid_code and jg.is_deleted = 0
+        LEFT JOIN jczz_police_affairs_grid jpag on jpar.jw_grid_code= jpag.jw_grid_code and jpag.is_deleted = 0
+        LEFT JOIN blade_region br on br.code = jpag.community_code
         <where>
-            <if test="vo.status != null ">and status = #{vo.status}</if>
+            <if test="vo.status != null ">
+                and jpar.status = #{vo.status}
+            </if>
+            <if test="vo.alarmDescribe != null and vo.alarmDescribe != ''">
+                and jpar.alarm_describe like concat('%',#{vo.alarmDescribe},'%')
+            </if>
+            <if test="vo.policeName != null and vo.policeName != ''">
+                and jpar.police_name like concat('%',#{vo.policeName},'%')
+            </if>
+            <if test="isAdministrator==2">
+                <choose>
+                    <when test="vo.roleName != null and vo.roleName != ''">
+                        <if test="vo.roleName=='wgy'">
+                            <choose>
+                                <when test="gridCodeList !=null and gridCodeList.size()>0">
+                                    and jg.grid_code in
+                                    <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and jg.grid_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
+                        <if test="vo.roleName=='mj'">
+                            <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>
+                    </when>
+                    <otherwise>
+                        <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
+                                jpag.community_code in
+                                <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=",">
+                                    #{code}
+                                </foreach>
+                                )
+                            </when>
+                            <otherwise>
+                                and
+                                (
+                                jg.grid_code in ('') or jpag.community_code in in ('')
+                                )
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
            and  is_deleted = 0
         </where>
     </select>

--
Gitblit v1.9.3