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
<?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_dangjian.dao.ComPbMemberRoleDAO">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.panzhihua.service_dangjian.model.dos.ComPbMemberRoleDO">
        <id column="id" property="id" />
        <result column="phone" property="phone" />
        <result column="is_reg" property="isReg" />
        <result column="name" property="name" />
        <result column="sex" property="sex" />
        <result column="birth_time" property="birthTime" />
        <result column="position" property="position" />
        <result column="position_two" property="positionTwo" />
        <result column="job_responsibilities" property="jobResponsibilities" />
        <result column="photo_path" property="photoPath" />
        <result column="create_at" property="createAt" />
        <result column="update_at" property="updateAt" />
        <result column="community_id" property="communityId" />
        <result column="org_id" property="orgId" />
        <result column="check_unit_id" property="checkUnitId" />
        <result column="id_card" property="idCard" />
        <result column="type" property="type" />
        <result column="join_time" property="joinTime" />
        <result column="employment_time" property="employmentTime" />
        <result column="function" property="function" />
        <result column="specialty_category" property="specialtyCategory" />
        <result column="specialty_name" property="specialtyName" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, phone, is_reg, name, sex, birth_time, position, position_two, job_responsibilities, photo_path, create_at, update_at, community_id, org_id
        , check_unit_id, id_card, type, join_time, employment_time, function, specialty_category, specialty_name
    </sql>
 
    <select id="getSysUserIdByPhone" resultType="long">
        SELECT user_id FROM sys_user WHERE phone = #{phone} AND app_id = #{appid} AND `type` = 1
    </select>
 
    <select id="getSysUserByIdCardCount" resultType="integer">
        SELECT count(user_id) FROM sys_user WHERE id_card = #{idCard} AND `type` = 1
    </select>
 
    <select id="getUserIdByIdCard" resultType="long">
        select user_id from sys_user  WHERE id_card = #{idCard} AND `type` = 1
    </select>
 
    <select id="pagePartyOrganization" resultType="com.panzhihua.common.model.vos.partybuilding.west.PartyCommitteeVO">
        select cpmr.id,cpmr.community_id,cpmr.`name`,cpmr.id_card,cpmr.org_id,cpmr.check_unit_id
        , cpmr.phone,cpmr.is_reg,cpmr.sex,cpmr.birth_time,cpmr.position,cpmr.position_two
        , cpmr.job_responsibilities,cpmr.photo_path,cpmr.type,cpmr.join_time,cpmr.employment_time
        , cpmr.create_at,cpmr.update_at,cpmr.function,cpmr.specialty_category,cpmr.specialty_name
        ,YEAR (now()) - YEAR (substring(cpmr.id_card, 7, 8)) age,cpo.`name` as orgName,cpcu.`name` as checkUnitName
        from com_pb_member_role as cpmr
        left join com_pb_org as cpo on cpo.id = cpmr.org_id
        left join com_pb_check_unit as cpcu on cpcu.id = cpmr.check_unit_id
        <where>
            <if test="partyCommitteeVO.communityId != null">
                and cpmr.community_id = #{partyCommitteeVO.communityId}
            </if>
            <if test="partyCommitteeVO.type != null">
                and cpmr.type = #{partyCommitteeVO.type}
            </if>
            <if test="partyCommitteeVO.sex != null">
                and cpmr.sex = #{partyCommitteeVO.sex}
            </if>
            <if test="partyCommitteeVO.keyWord != null and partyCommitteeVO.keyWord != ''">
                and (cpmr.name like concat (#{partyCommitteeVO.keyWord},'%') or
                cpmr.phone like concat (#{partyCommitteeVO.keyWord},'%') or
                cpmr.id_card = #{partyCommitteeVO.keyWord}
                )
            </if>
        </where>
        order by cpmr.create_at desc
    </select>
 
 
 
    <select id="pagePartyOrganizations" resultType="com.panzhihua.common.model.vos.partybuilding.PartyCommitteeVO">
        select cpmr.id,cpmr.community_id,cpmr.`name`,cpmr.id_card,cpmr.org_id,cpmr.check_unit_id
        , cpmr.phone,cpmr.is_reg,cpmr.sex,cpmr.birth_time,cpmr.position,cpmr.position_two
        , cpmr.job_responsibilities,cpmr.photo_path,cpmr.type,cpmr.join_time,cpmr.employment_time
        , cpmr.create_at,cpmr.update_at,cpmr.function,cpmr.specialty_category,cpmr.specialty_name
        ,YEAR (now()) - YEAR (substring(cpmr.id_card, 7, 8)) age,cpo.`name` as orgName,cpcu.`name` as checkUnitName
        from com_pb_member_role as cpmr
        left join com_pb_org as cpo on cpo.id = cpmr.org_id
        left join com_pb_check_unit as cpcu on cpcu.id = cpmr.check_unit_id
        <where>
            <if test="partyCommitteeVO.communityId != null">
                and cpmr.community_id = #{partyCommitteeVO.communityId}
            </if>
            <if test="partyCommitteeVO.type != null">
                and cpmr.type = #{partyCommitteeVO.type}
            </if>
            <if test="partyCommitteeVO.sex != null">
                and cpmr.sex = #{partyCommitteeVO.sex}
            </if>
            <if test="partyCommitteeVO.keyWord != null and partyCommitteeVO.keyWord != ''">
                and (cpmr.name like concat (#{partyCommitteeVO.keyWord},'%') or
                cpmr.phone like concat (#{partyCommitteeVO.keyWord},'%') or
                cpmr.id_card = #{partyCommitteeVO.keyWord}
                )
            </if>
        </where>
        order by cpmr.create_at desc
    </select>
 
</mapper>