lin
2024-03-14 c4e2c196aad8af656d94bc47e9f1a80bc504b5d7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.rotation.mapper.RotationMapper">
 
    <!-- 通用查询映射结果 -->
    <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"/>
    </resultMap>
 
    <!--自定义分页查询-->
    <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 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>
 
 
</mapper>