From 02f3b2a577143724b09a70cd13cd3e9256f5fc21 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Tue, 12 Mar 2024 18:00:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml |  190 ++++++++++++++++++++++++++++++++++------------
 1 files changed, 139 insertions(+), 51 deletions(-)

diff --git a/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml b/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
index 8a8a47c..7161490 100644
--- a/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
+++ b/src/main/java/org/springblade/modules/taskPlaceRectification/mapper/TaskPlaceRectificationMapper.xml
@@ -198,22 +198,25 @@
         bu.`name`,
         jpe.legal_tel,
         jpe.legal_person,
-        jda.address_name
+        jp.location as address_name
         FROM
         jczz_task_place_rectification jtpr
-        LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code
-        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code
+        LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code and jp.is_deleted = 0
+        LEFT JOIN jczz_grid jg ON jg.grid_code = jp.grid_code and jg.is_deleted = 0
         LEFT JOIN blade_region br ON br.`code` = jg.community_code
         LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
         LEFT JOIN blade_user bu ON bu.id = jtpr.create_user
-        LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpr.house_code
         LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code
         <where>
             <if test="taskPalce.id != null ">and jtpr.id = #{taskPalce.id}</if>
             <if test="taskPalce.placeCheckId != null ">and jtpr.place_check_id = #{taskPalce.placeCheckId}</if>
             <if test="taskPalce.taskId != null ">and jtpr.task_id = #{taskPalce.taskId}</if>
-            <if test="taskPalce.status != null ">and jtpr.status = #{taskPalce.status}</if>
-            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and jtpr.task_name = #{taskPalce.taskName}
+            <if test="taskPalce.status != null and taskPalce.status != 2  ">and jtpr.status = #{taskPalce.status}</if>
+
+            <if test="taskPalce.status != null and taskPalce.status = 2 ">and jtpr.status in (2,3)</if>
+
+            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and jtpr.task_name =
+                #{taskPalce.taskName}
             </if>
 
             <if test="taskPalce.startTime!=null and taskPalce.startTime!=''">
@@ -228,15 +231,18 @@
             </if>
 
             <if test="taskPalce.addressName!=null and taskPalce.addressName!=''">
-                and jda.address_name like concat('%',#{taskPalce.addressName},'%')
+                and jp.location like concat('%',#{taskPalce.addressName},'%')
             </if>
 
             <if test="taskPalce.deptName!=null and taskPalce.deptName!=''">
                 and jpag.pcs_name like concat('%',#{taskPalce.deptName},'%')
             </if>
 
-            <if test="taskPalce.nineType!=null">
-                and jp.nine_type = #{taskPalce.nineType}
+            <if test="nineTypeList!=null and nineTypeList.size()>0">
+                and jp.nine_type in
+                <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType">
+                    #{nineType}
+                </foreach>
             </if>
 
             <if test="taskPalce.punishFlag!=null">
@@ -258,7 +264,9 @@
             <if test="taskPalce.rectificationCompleteTime != null ">and jtpr.rectification_complete_time =
                 #{taskPalce.rectificationCompleteTime}
             </if>
-            <if test="taskPalce.rectificationFlag != null ">and jtpr.rectification_flag = #{taskPalce.rectificationFlag}</if>
+            <if test="taskPalce.rectificationFlag != null ">and jtpr.rectification_flag =
+                #{taskPalce.rectificationFlag}
+            </if>
             <if test="taskPalce.punishFlag != null ">and jtpr.punish_flag = #{taskPalce.punishFlag}</if>
             <if test="taskPalce.policeStation != null  and taskPalce.policeStation != ''">and jtpr.police_station =
                 #{taskPalce.policeStation}
@@ -275,25 +283,58 @@
             </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="taskPalce.roleName != null and taskPalce.roleName != ''">
+                        <if test="taskPalce.roleName=='wgy'">
+                            <choose>
+                                <when test="gridCodeList !=null and gridCodeList.size()>0">
+                                    and jp.grid_code in
+                                    <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and jp.grid_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
+                        <if test="taskPalce.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>
-                        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
+                                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>
@@ -430,7 +471,7 @@
         bu.`name`,
         jpe.legal_tel,
         jpe.legal_person,
-        jda.address_name
+        jp.location as address_name
         FROM
         jczz_task_place_rectification jtpr
         LEFT JOIN jczz_place jp ON jtpr.house_code = jp.house_code
@@ -438,14 +479,14 @@
         LEFT JOIN blade_region br ON br.`code` = jg.community_code
         LEFT JOIN jczz_place_ext jpe ON jpe.place_id = jp.id
         LEFT JOIN blade_user bu ON bu.id = jtpr.create_user
-        LEFT JOIN jczz_doorplate_address jda on jda.address_code=jtpr.house_code
         LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code
         <where>
             <if test="taskPalce.id != null ">and jtpr.id = #{taskPalce.id}</if>
             <if test="taskPalce.placeCheckId != null ">and jtpr.place_check_id = #{taskPalce.placeCheckId}</if>
             <if test="taskPalce.taskId != null ">and jtpr.task_id = #{taskPalce.taskId}</if>
             <if test="taskPalce.status != null ">and jtpr.status = #{taskPalce.status}</if>
-            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and jtpr.task_name = #{taskPalce.taskName}
+            <if test="taskPalce.taskName != null  and taskPalce.taskName != ''">and jtpr.task_name =
+                #{taskPalce.taskName}
             </if>
 
             <if test="taskPalce.startTime!=null and taskPalce.startTime!=''">
@@ -460,15 +501,18 @@
             </if>
 
             <if test="taskPalce.addressName!=null and taskPalce.addressName!=''">
-                and jda.address_name like concat('%',#{taskPalce.addressName},'%')
+                and jp.location like concat('%',#{taskPalce.addressName},'%')
             </if>
 
             <if test="taskPalce.deptName!=null and taskPalce.deptName!=''">
                 and jpag.pcs_name like concat('%',#{taskPalce.deptName},'%')
             </if>
 
-            <if test="taskPalce.nineType!=null">
-                and jp.nine_type = #{taskPalce.nineType}
+            <if test="nineTypeList!=null and nineTypeList.size()>0">
+                and jp.nine_type in
+                <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType">
+                    #{nineType}
+                </foreach>
             </if>
 
             <if test="taskPalce.punishFlag!=null">
@@ -490,7 +534,9 @@
             <if test="taskPalce.rectificationCompleteTime != null ">and jtpr.rectification_complete_time =
                 #{taskPalce.rectificationCompleteTime}
             </if>
-            <if test="taskPalce.rectificationFlag != null ">and jtpr.rectification_flag = #{taskPalce.rectificationFlag}</if>
+            <if test="taskPalce.rectificationFlag != null ">and jtpr.rectification_flag =
+                #{taskPalce.rectificationFlag}
+            </if>
             <if test="taskPalce.punishFlag != null ">and jtpr.punish_flag = #{taskPalce.punishFlag}</if>
             <if test="taskPalce.policeStation != null  and taskPalce.policeStation != ''">and jtpr.police_station =
                 #{taskPalce.policeStation}
@@ -507,25 +553,58 @@
             </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="taskPalce.roleName != null and taskPalce.roleName != ''">
+                        <if test="taskPalce.roleName=='wgy'">
+                            <choose>
+                                <when test="gridCodeList !=null and gridCodeList.size()>0">
+                                    and jp.grid_code in
+                                    <foreach collection="gridCodeList" item="code" open="(" close=")" separator=",">
+                                        #{code}
+                                    </foreach>
+                                </when>
+                                <otherwise>
+                                    and jp.grid_code in ('')
+                                </otherwise>
+                            </choose>
+                        </if>
+                        <if test="taskPalce.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>
-                        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
+                                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>
@@ -533,5 +612,14 @@
         order by jtpr.create_time desc
     </select>
 
+    <select id="getCount" resultType="java.lang.Integer">
+        SELECT count(1)
+        FROM jczz_task_place_rectification jtpr
+                 LEFT JOIN jczz_place jp ON jp.house_code = jtpr.house_code
+        WHERE jp.jw_grid_code IN
+              (SELECT jpag.jw_grid_code FROM jczz_police_affairs_grid jpag WHERE jpag.police_user_id like concat('%',${userId},'%'))
+          AND jtpr.`status` = 1
+    </select>
+
 
 </mapper>

--
Gitblit v1.9.3