CompanyMemberMappingMapper.xml 2.52 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="companyAuthMembersCount" parameterType="long" resultType="integer">
        SELECT
            count(
            DISTINCT ( t2.id ))
        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
            AND t2.first_login IS NOT NULL
    </select>

    <select id="memberCompany" parameterType="long" resultType="com.subsidy.model.CompanyDictDO">
        SELECT
            t2.*
        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_status = 1
            AND t.member_id = #{memberId}
    </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>

    <select id="noCompanyMembers" resultType="com.subsidy.model.MemberDO">
        SELECT
            *
        FROM
            member t
        WHERE
            t.delete_date IS NOT NULL
            AND t.id NOT IN (
            SELECT DISTINCT
                ( t2.member_id )
            FROM
                company_member_mapping t2
            WHERE
            t2.delete_date IS NOT NULL
            AND t2.member_status = 1)
            and t.user_name like concat('%',#{userName} ,'%')
            and t.id_card like concat('%',#{idCard} ,'%')
    </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>

</mapper>