Blame view

CompanyMemberMappingMapper.xml 4.07 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
<?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.subsidy.mapper.CompanyMemberMappingMapper">

    <select id="memberCompanys" parameterType="long" resultType="com.subsidy.vo.company.MemberCompanyVO">
        SELECT
            t.company_id,
            t2.company_name,
            t.create_date
        FROM
            company_member_mapping t
            LEFT JOIN company_dict t2 ON t.company_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.member_id =#{memberId}
            order by t.create_date desc,t.id desc
    </select>


    <select id="departMembers" parameterType="long" resultType="com.subsidy.vo.member.DepartMembersVO">
        SELECT
23
        distinct
涂亚平 committed
24 25 26 27 28 29 30
        t2.user_name,
        t2.telephone,
        t2.id_card,
        t2.gender,
        t2.email,
        t2.qq_no,
        t2.wechat,
31
        t.update_date as create_date
涂亚平 committed
32 33 34 35 36 37 38 39 40 41 42 43 44
        FROM
        company_member_mapping t
        LEFT JOIN member t2 ON t.member_id = t2.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND t.company_id = #{companyId}
        <if test="userName != null and userName !=''">
            and ( t2.user_name like concat('%',#{userName} ,'%')
            or t2.id_card like concat('%',#{userName} ,'%')
            or t2.telephone like concat('%',#{userName} ,'%'))
        </if>
        and t.member_status = 0
45
        order by t.update_date desc
涂亚平 committed
46 47 48 49 50 51 52 53 54 55 56
    </select>

    <select id="attendMembers" resultType="com.subsidy.vo.member.AttendMembersVO">
        SELECT DISTINCT
        t1.id,
        t1.user_name,
        t1.account_name_en,
        t1.account_name,
        t1.gender,
        t1.telephone,
        t1.id_card,
57 58 59 60
        t1.email,
        t1.status,
        t1.induction_date,
        t1.work_no
涂亚平 committed
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
        FROM
        member t1
        LEFT JOIN company_member_mapping t3 ON t1.id = t3.member_id
        LEFT JOIN class_member_mapping t2 ON t1.id = t2.member_id
        LEFT JOIN member_department_mapping t4 ON t1.id = t4.member_id
        WHERE
        t1.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND t3.delete_date IS NULL
        AND t4.delete_date IS NULL
        AND t3.member_status = 1
        AND t2.id IS NOT NULL
        AND t3.company_id = #{companyId}
        AND t4.member_status = 1
        AND t4.department_id = #{departmentId}
        <if test="userName != null and userName != ''">
            and ( t1.user_name like concat('%',#{userName} ,'%')
            or t1.id_card like concat('%',#{userName} ,'%')
            or t1.telephone like concat('%',#{userName} ,'%'))
        </if>
    </select>

    <select id="memberAttendInfo" resultType="com.subsidy.vo.member.MemberAttendInfoVO">
        SELECT
            t2.id,
            t2.class_name,
            t.create_date
        FROM
            class_member_mapping t
            LEFT JOIN class_dict t2 ON t.class_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.member_id = #{memberId}
            AND t2.company_id = #{companyId}
        order by t.create_date desc
    </select>

    <select id="companyAccountMembers" resultType="com.subsidy.model.MemberDO">
        SELECT
            t2.*
        FROM
            company_member_mapping t
            LEFT JOIN member t2 ON t.member_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.company_id = #{companyId}
            AND t2.account_name = #{accountName}
            AND t.member_status = 1
    </select>

涂亚平 committed
113 114 115 116 117 118 119 120 121 122 123 124 125
    <select id="companyMembers" parameterType="long" resultType="string">
        SELECT
            concat(t2.user_name,t2.telephone,t2.id_card)
        FROM
            company_member_mapping t
            LEFT JOIN member t2 ON t.member_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t.company_id = #{companyId}
            AND t.member_status = 1
    </select>

涂亚平 committed
126
</mapper>