101captain
2021-12-23 5a8a90c095280fbd2106869ecd2bad10e01a57a6
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
<?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.ComActFourMemberDao">
 
    <resultMap type="com.panzhihua.service_community.entity.ComActFourMember" id="ComActFourMemberBaseResultMap">
        <result property="id" column="id"/>
        <result property="userId" column="user_id"/>
        <result property="position" column="position"/>
        <result property="jurisdiction" column="jurisdiction"/>
        <result property="communityId" column="community_id"/>
        <result property="createTime" column="create_time"/>
        <result property="jurisdictionContent" column="jurisdiction_content"/>
        <result property="idCard" column="id_card"/>
    </resultMap>
 
    <resultMap id="baseResultMap" type="com.panzhihua.common.model.vos.community.ComActFourMemberVO">
        <collection property="buildings"
                    ofType="String"
                    column="{id = jurisdiction}"
                    select="selectBuilding"
                    javaType="java.util.ArrayList" />
    </resultMap>
 
    <select id="pageList" resultMap="baseResultMap">
        select t.*,t1.*,t2.role_id from com_act_four_member t left join sys_user t1 on t.user_id = t1.user_id left join sys_user_role t2 on t.user_id =t2.user_id
        <where>
            1=1
            <if test="commonPage.paramId !=null">
                and t.community_id =#{commonPage.paramId}
            </if>
            <if test="commonPage.position !=null and commonPage.position !=''">
                and t.position like concat('%',#{commonPage.position},'%')
            </if>
            <if test="commonPage.keyword !=null and commonPage.keyword !=''">
                and (t1.name like concat(#{commonPage.keyword},'%') or t1.phone like concat(#{commonPage.keyword},'%') or t.jurisdiction_content like concat('%',#{commonPage.keyword},'%'))
            </if>
            <if test="commonPage.status !=null">
                and t1.status =#{commonPage.status}
            </if>
        </where>
        order by t.create_time desc
    </select>
 
    <select id="selectBuilding" resultType="String">
        select distinct concat(alley,house_num,'号',IFNULL(floor,0),'栋') from com_mng_population_house   where id in (${id})
    </select>
 
    <select id="getById" resultMap="baseResultMap">
        select t.*,t1.*,t2.role_id from com_act_four_member t left join sys_user t1 on t.user_id = t1.user_id left join sys_user_role t2 on t.user_id =t2.user_id where t.id =#{id}
    </select>
 
</mapper>