From 8b7258c9427882bb1798f1502eaa35184c6e374e Mon Sep 17 00:00:00 2001
From: linwe <872216996@qq.com>
Date: Fri, 09 Aug 2024 14:29:18 +0800
Subject: [PATCH] 短信指定楼栋发送

---
 src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml |   82 ++++++++++++++++++++++++++++++++++++----
 1 files changed, 73 insertions(+), 9 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 c2d3332..44eb280 100644
--- a/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
+++ b/src/main/java/org/springblade/modules/rotation/mapper/RotationMapper.xml
@@ -4,15 +4,19 @@
 
     <!-- 通用查询映射结果 -->
     <resultMap id="rotationResultMap" type="org.springblade.modules.rotation.entity.RotationEntity">
-        <result column="id" property="id"/>
-        <result column="name" property="name"/>
-        <result column="type" property="type"/>
-        <result column="context" property="context"/>
-        <result column="url" property="url"/>
-        <result column="junp_url" property="junpUrl"/>
-        <result column="create_time" property="createTime"/>
-        <result column="create_user" property="createUser"/>
-        <result column="is_deleted" property="isDeleted"/>
+        <result property="id"    column="id"    />
+        <result property="name"    column="name"    />
+        <result property="type"    column="type"    />
+        <result property="context"    column="context"    />
+        <result property="url"    column="url"    />
+        <result property="junpUrl"    column="junp_url"    />
+        <result property="communityCode"    column="community_code"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="createUser"    column="create_user"    />
+        <result property="isDeleted"    column="is_deleted"    />
+        <result property="rotationRange"    column="rotation_range"    />
+        <result property="articleId"    column="article_id"    />
+        <result property="publicFlag"    column="public_flag"    />
     </resultMap>
 
     <!--自定义分页查询-->
@@ -34,6 +38,66 @@
         <if test="rotation.regionCode!=null and rotation.regionCode!=''">
             and jr.community_code like concat('%',#{rotation.regionCode},'%')
         </if>
+
+        <if test="rotation.rotationRange != null  and rotation.rotationRange != ''">and jr.rotation_range =
+            #{rotation.rotationRange}
+        </if>
+        <if test="rotation.articleId != null ">and jr.article_id = #{rotation.articleId}</if>
+        <if test="rotation.publicFlag != null ">and jr.public_flag = #{rotation.publicFlag}</if>
+
+        <if test="rotation.districtIdList != null and rotation.districtIdList.size() > 0 ">
+            and (jr.rotation_range like
+            <foreach collection="rotation.districtIdList" separator=" or jr.rotation_range like" item="id">'%${id}%'
+            </foreach>
+            ) or jr.rotation_range is null
+        </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' or rotation.roleName=='xyzt' or rotation.roleName=='xyty'">
+                        and jr.type = 3
+                        <if test="rotation.districtIdList == null ">
+                            and jr.rotation_range is null
+                        </if>
+                    </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