From c4e2c196aad8af656d94bc47e9f1a80bc504b5d7 Mon Sep 17 00:00:00 2001
From: lin <sbla5888@163.com>
Date: Thu, 14 Mar 2024 18:15:29 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml |   62 +++++++++++++++++++++++++++++-
 1 files changed, 59 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
index 6927b5c..728410d 100644
--- a/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
+++ b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
@@ -16,10 +16,66 @@
     </resultMap>
 
     <!--自定义分页查询-->
-    <select id="selectRotationPage" resultMap="rotationResultMap">
-        select * from jczz_rotation where is_deleted = 0
+    <select id="selectRotationPage" resultType="org.springblade.modules.rotation.vo.RotationVO">
+        select
+        jr.*,br.name as communityName
+        from jczz_rotation jr
+        left join blade_region br on br.code = jr.community_code
+        where jr.is_deleted = 0
         <if test="rotation.name!=null and rotation.name!=''">
-            and name like concat('%',#{rotation.name},'%')
+            and jr.name like concat('%',#{rotation.name},'%')
+        </if>
+        <if test="rotation.type!=null">
+            and jr.type = #{rotation.type}
+        </if>
+        <if test="rotation.communityName!=null and rotation.communityName!=''">
+            and br.name like concat('%',#{rotation.communityName},'%')
+        </if>
+        <if test="rotation.regionCode!=null and rotation.regionCode!=''">
+            and jr.community_code like concat('%',#{rotation.regionCode},'%')
+        </if>
+        <if test="isAdministrator==2">
+            <choose>
+                <when test="rotation.roleName != null and rotation.roleName != ''">
+                    <if test="rotation.roleName=='wgy'">
+                        <choose>
+                            <when test="gridCodeList !=null and gridCodeList !=''">
+                                and jr.type = 2
+                                and jr.community_code REGEXP #{gridCodeList}
+                            </when>
+                            <otherwise>
+                                and jr.type = 2
+                                and jr.community_code in ('')
+                            </otherwise>
+                        </choose>
+                    </if>
+                    <if test="rotation.roleName=='mj'">
+                        <choose>
+                            <when test="regionChildCodesList !=null and regionChildCodesList!=''">
+                                and jr.type = 1
+                                and jr.community_code REGEXP #{regionChildCodesList}
+                            </when>
+                            <otherwise>
+                                and jr.type = 1
+                                and jr.community_code in ('')
+                            </otherwise>
+                        </choose>
+                    </if>
+                    <if test="rotation.roleName=='inhabitant'">
+                        and jr.type = 3
+                    </if>
+                </when>
+                <otherwise>
+                    <choose>
+                        <when test="regionChildCodesList !=null and regionChildCodesList!=''">
+                            and jr.community_code REGEXP #{regionChildCodesList}
+                        </when>
+                        <otherwise>
+                            and jr.community_code in ('')
+                        </otherwise>
+                    </choose>
+                </otherwise>
+            </choose>
         </if>
     </select>
 

--
Gitblit v1.9.3