From 764d883b5ea3bdc06abbec548b6df0511e567978 Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Tue, 03 Sep 2024 09:46:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/binlog' into binlog

---
 src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml |  103 ++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 101 insertions(+), 2 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 07ec2fa..3b056d9 100644
--- a/src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml
+++ b/src/main/java/org/springblade/modules/police/mapper/PoliceAlarmRecordsMapper.xml
@@ -3,12 +3,111 @@
 <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 where is_deleted = 0
+        select
+        jpar.*,
+        bdb.dict_value as alarmTypeName,
+        jpag.pcs_name
+        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
+        LEFT JOIN blade_dict_biz bdb ON bdb.dict_key = jpar.alarm_type and bdb.is_deleted = 0 and bdb.code = 'applyAlarmType'
+        <where>
+            <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="vo.pcsName != null and vo.pcsName != ''">
+                and jpag.pcs_name like concat('%',#{vo.pcsName},'%')
+            </if>
+            <if test="vo.startTime != null and vo.startTime != ''">
+                and date_format(jpar.create_time,'%Y-%m-%d') &gt;= #{vo.startTime}
+            </if>
+            <if test="vo.endTime != null and vo.endTime != ''">
+                and date_format(jpar.create_time,'%Y-%m-%d') &lt;= #{vo.endTime}
+            </if>
+            <if test="vo.searchKey!=null and vo.searchKey!=''">
+                and CONCAT(
+                ifnull(jpar.name,''),
+                ifnull(jpar.phone,''),
+                ifnull(jpar.address,''),
+                ifnull(jpar.alarm_describe,''),
+                ifnull(jpar.police_name,'')
+                ) like CONCAT ('%', #{vo.searchKey},'%')
+            </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>
+                                    <if test="vo.policeId != null">
+                                        or jpar.police_id = #{vo.policeId}
+                                    </if>
+                                </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 ('')
+                                )
+                            </otherwise>
+                        </choose>
+                    </otherwise>
+                </choose>
+            </if>
+           and jpar.is_deleted = 0
+        </where>
+        order by jpar.id desc,jpar.create_time desc
     </select>
 
     <resultMap type="org.springblade.modules.police.dto.PoliceAlarmRecordsDTO" id="PoliceAlarmRecordsDTOResult">

--
Gitblit v1.9.3