CompanyMemberMappingMapper.xml 4.07 KB
<?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
        distinct
        t2.user_name,
        t2.telephone,
        t2.id_card,
        t2.gender,
        t2.email,
        t2.qq_no,
        t2.wechat,
        t.update_date as create_date
        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
        order by t.update_date desc
    </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,
        t1.email,
        t1.status,
        t1.induction_date,
        t1.work_no
        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>

    <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>

</mapper>