mitao
2025-02-21 31573d6180d15ef65ed0df9c2732495f40b12663
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?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="com.panzhihua.service_community.dao.ComClusterOrganizationMemberMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_community.model.dos.ComClusterOrganizationMemberDO">
        <id column="id" property="id" />
        <result column="cluster_id" property="clusterId" />
        <result column="name" property="name" />
        <result column="phone" property="phone" />
        <result column="address" property="address" />
        <result column="image_url" property="imageUrl" />
        <result column="job" property="job" />
        <result column="id_card" property="idCard" />
        <result column="nation_code" property="nationCode" />
        <result column="status" property="status" />
        <result column="is_del" property="isDel" />
        <result column="create_at" property="createAt" />
        <result column="update_at" property="updateAt" />
        <result column="community_id" property="communityId" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, cluster_id, name, phone, address, image_url, job, id_card, nation_code, status, is_del, create_at, update_at, community_id
    </sql>
 
    <select id="pageClusterMemberApplets" resultType="com.panzhihua.common.model.vos.community.cluster.PageClusterMemberVo">
        SELECT
            ccom.id,ccom.`name`,ccom.cluster_id,cco.`name` as clusterName,ccom.phone,ccom.address,ccom.image_url,ccom.job,ccom.id_card
        FROM
            com_cluster_organization_member AS ccom
            LEFT JOIN com_cluster_organization AS cco ON cco.id = ccom.cluster_id
            <where>
                ccom.status = 1 and ccom.is_del = 2
                <if test="pageClusterMemberDto.communityId != null">
                    and ccom.community_id = ${pageClusterMemberDto.communityId}
                </if>
                <if test="pageClusterMemberDto.clusterId != null">
                    and ccom.cluster_id = #{pageClusterMemberDto.clusterId}
                </if>
                <if test="pageClusterMemberDto.keyWord != null and pageClusterMemberDto.keyWord != &quot;&quot;">
                    and ccom.`name` like concat(#{pageClusterMemberDto.keyWord}, '%' )
                </if>
            </where>
            order by ccom.create_at desc
    </select>
 
    <select id="pageClusterMemberAdmin" resultType="com.panzhihua.common.model.vos.community.cluster.admin.PageClusterMemberAdminVo">
        SELECT
            ccom.id,
            ccom.`name`,
            ccom.image_url,
            cco.`name` AS clusterName,
            ccom.job,
            ccom.phone,
            ccom.`status`
        FROM
            com_cluster_organization_member AS ccom
            LEFT JOIN com_cluster_organization AS cco ON cco.id = ccom.cluster_id
        WHERE
            ccom.is_del = 2
            <if test="pageClusterMemberAdminDto.communityId != null">
                and ccom.community_id = ${pageClusterMemberAdminDto.communityId}
            </if>
            <if test="pageClusterMemberAdminDto.status != null">
                and ccom.`status` = #{pageClusterMemberAdminDto.status}
            </if>
            <if test="pageClusterMemberAdminDto.clusterId != null">
                and ccom.cluster_id = #{pageClusterMemberAdminDto.clusterId}
            </if>
            <if test="pageClusterMemberAdminDto.keyWord != null">
                and (
                ccom.`name` like concat(#{pageClusterMemberAdminDto.keyWord}, '%' ) or
                ccom.phone like concat(#{pageClusterMemberAdminDto.keyWord}, '%' )
                )
            </if>
        order by ccom.create_at desc
    </select>
 
    <select id="memberNationListAdmin" resultType="com.panzhihua.common.model.vos.community.cluster.admin.ClusterMemberNationVo">
        SELECT
            dict_value AS nationCode,
            dict_item_name AS nationName
        FROM
            bc_dictionary_item
        WHERE
            dict_id = (
            SELECT
                id
            FROM
                bc_dictionary
        WHERE
            `dict_key` = #{key})
    </select>
 
    <select id="getNationCode" resultType="Map">
        SELECT
            dict_value
        FROM
            bc_dictionary_item
        WHERE
            dict_id = ( SELECT id FROM bc_dictionary WHERE dict_key =#{key} )
            AND dict_item_name = #{nationName}
    </select>
 
    <select id="exportClusterMember" resultType="com.panzhihua.common.model.vos.community.cluster.admin.ComClusterMemberExcelExportAdminVO">
        SELECT
        ccom.`name`,
        cco.`name` AS clusterName,
        ccom.job,
        ccom.phone,
        case ccom.`status`
        when '1' then '启用'
        when '2' then '停用'
        end `status`
        FROM
        com_cluster_organization_member AS ccom
        LEFT JOIN com_cluster_organization AS cco ON cco.id = ccom.cluster_id
        WHERE
        ccom.is_del = 2
        <if test="pageClusterMemberAdminDto.communityId != null">
            and ccom.community_id = ${pageClusterMemberAdminDto.communityId}
        </if>
        <if test="pageClusterMemberAdminDto.status != null">
            and ccom.`status` = #{pageClusterMemberAdminDto.status}
        </if>
        <if test="pageClusterMemberAdminDto.clusterId != null">
            and ccom.cluster_id = #{pageClusterMemberAdminDto.clusterId}
        </if>
        <if test="pageClusterMemberAdminDto.keyWord != null">
            and (
            ccom.`name` like concat(#{pageClusterMemberAdminDto.keyWord}, '%' ) or
            ccom.phone like concat(#{pageClusterMemberAdminDto.keyWord}, '%' )
            )
        </if>
        order by ccom.create_at desc
    </select>
</mapper>